mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
psa: add key_type as input parameter of psa_can_do_cipher()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user