psa_crypto: add internal helper to signal that cipher driver is ready

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-12-12 11:27:36 +01:00
parent 8ceaa75b73
commit c6f004f0e2
2 changed files with 20 additions and 0 deletions

View file

@ -115,6 +115,14 @@ int psa_can_do_hash(psa_algorithm_t hash_alg)
(void) hash_alg; (void) hash_alg;
return global_data.drivers_initialized; 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) || \ #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_IMPORT) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \ defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_PUBLIC_KEY) || \
defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE) defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)

View file

@ -33,6 +33,18 @@
*/ */
int psa_can_do_hash(psa_algorithm_t hash_alg); 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 { typedef enum {
PSA_SLOT_EMPTY = 0, PSA_SLOT_EMPTY = 0,
PSA_SLOT_OCCUPIED, PSA_SLOT_OCCUPIED,