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:
parent
9a4cc122a7
commit
1fff4f2012
3 changed files with 6 additions and 4 deletions
|
@ -88,8 +88,9 @@ int mbedtls_block_cipher_setup(mbedtls_block_cipher_context_t *ctx,
|
||||||
MBEDTLS_BLOCK_CIPHER_ID_NONE;
|
MBEDTLS_BLOCK_CIPHER_ID_NONE;
|
||||||
|
|
||||||
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
|
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
|
||||||
if (psa_can_do_cipher(cipher_id) &&
|
psa_key_type_t psa_key_type = psa_key_type_from_block_cipher_id(ctx->id);
|
||||||
(psa_key_type_from_block_cipher_id(ctx->id) != PSA_KEY_TYPE_NONE)) {
|
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;
|
ctx->engine = MBEDTLS_BLOCK_CIPHER_ENGINE_PSA;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,9 @@ int psa_can_do_hash(psa_algorithm_t hash_alg)
|
||||||
return global_data.drivers_initialized;
|
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;
|
(void) cipher_alg;
|
||||||
return global_data.drivers_initialized;
|
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.
|
* \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 {
|
typedef enum {
|
||||||
PSA_SLOT_EMPTY = 0,
|
PSA_SLOT_EMPTY = 0,
|
||||||
|
|
Loading…
Reference in a new issue