Add utility function to check for drivers init
This will be used in the next commit.
While at it, move driver initialization before RNG init - this will be
handy when the entropy module wants to use drivers for hashes.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data
index eddac7f..86b2f66 100644
--- a/tests/suites/test_suite_psa_crypto.data
+++ b/tests/suites/test_suite_psa_crypto.data
@@ -1,3 +1,6 @@
+PSA can_do_hash
+psa_can_do_hash:
+
PSA compile-time sanity checks
static_checks:
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 231b47f..41a3237 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -13,6 +13,9 @@
#include "psa/crypto.h"
#include "psa_crypto_slot_management.h"
+/* For psa_can_do_hash() */
+#include "psa_crypto_core.h"
+
#include "test/asn1_helpers.h"
#include "test/psa_crypto_helpers.h"
#include "test/psa_exercise_key.h"
@@ -1256,6 +1259,18 @@
*/
/* BEGIN_CASE */
+void psa_can_do_hash()
+{
+ /* We can't test that this is specific to drivers until partial init has
+ * been implemented, but we can at least test before/after full init. */
+ TEST_EQUAL(0, psa_can_do_hash(PSA_ALG_NONE));
+ PSA_INIT();
+ TEST_EQUAL(1, psa_can_do_hash(PSA_ALG_NONE));
+ PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
void static_checks()
{
size_t max_truncated_mac_size =