psa_crypto: add internal helper to signal that cipher driver is ready
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index d61e118..a9ba787 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -115,6 +115,14 @@
(void) hash_alg;
return global_data.drivers_initialized;
}
+
+int psa_can_do_cipher(psa_algorithm_t cipher_alg)
+{
+ (void) cipher_alg;
+ return global_data.drivers_initialized;
+}
+
+
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index 46c5775..43b1c23 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -33,6 +33,18 @@
*/
int psa_can_do_hash(psa_algorithm_t hash_alg);
+/**
+ * Tell if PSA is ready for this cipher.
+ *
+ * \note For now, only checks the state of the driver subsystem,
+ * not the algorithm. Might do more in the future.
+ *
+ * \param cipher_alg The cipher algorithm (ignored for now).
+ *
+ * \return 1 if the driver subsytem is ready, 0 otherwise.
+ */
+int psa_can_do_cipher(psa_algorithm_t cipher_alg);
+
typedef enum {
PSA_SLOT_EMPTY = 0,
PSA_SLOT_OCCUPIED,