diff --git a/library/block_cipher.c b/library/block_cipher.c index e21541ec15..04cd7fb444 100644 --- a/library/block_cipher.c +++ b/library/block_cipher.c @@ -88,8 +88,9 @@ int mbedtls_block_cipher_setup(mbedtls_block_cipher_context_t *ctx, MBEDTLS_BLOCK_CIPHER_ID_NONE; #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) - if (psa_can_do_cipher(cipher_id) && - (psa_key_type_from_block_cipher_id(ctx->id) != PSA_KEY_TYPE_NONE)) { + psa_key_type_t psa_key_type = psa_key_type_from_block_cipher_id(ctx->id); + if (psa_key_type != PSA_KEY_TYPE_NONE && + psa_can_do_cipher(psa_key_type, PSA_ALG_ECB_NO_PADDING)) { ctx->engine = MBEDTLS_BLOCK_CIPHER_ENGINE_PSA; return 0; } diff --git a/library/psa_crypto.c b/library/psa_crypto.c index a9ba787d0f..dd5b4465f3 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -116,8 +116,9 @@ int psa_can_do_hash(psa_algorithm_t hash_alg) return global_data.drivers_initialized; } -int psa_can_do_cipher(psa_algorithm_t cipher_alg) +int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg) { + (void) key_type; (void) cipher_alg; return global_data.drivers_initialized; } diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h index 43b1c2377e..ff01add958 100644 --- a/library/psa_crypto_core.h +++ b/library/psa_crypto_core.h @@ -43,7 +43,7 @@ int psa_can_do_hash(psa_algorithm_t hash_alg); * * \return 1 if the driver subsytem is ready, 0 otherwise. */ -int psa_can_do_cipher(psa_algorithm_t cipher_alg); +int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg); typedef enum { PSA_SLOT_EMPTY = 0,