mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-31 01:20:35 +00:00
block_cipher: use PSA_BITS_TO_BYTES() in mbedtls_block_cipher_setkey()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
291571b447
commit
785ec17795
@ -131,7 +131,7 @@ int mbedtls_block_cipher_setkey(mbedtls_block_cipher_context_t *ctx,
|
|||||||
psa_set_key_algorithm(&key_attr, PSA_ALG_ECB_NO_PADDING);
|
psa_set_key_algorithm(&key_attr, PSA_ALG_ECB_NO_PADDING);
|
||||||
psa_set_key_usage_flags(&key_attr, PSA_KEY_USAGE_ENCRYPT);
|
psa_set_key_usage_flags(&key_attr, PSA_KEY_USAGE_ENCRYPT);
|
||||||
|
|
||||||
status = psa_import_key(&key_attr, key, key_bitlen/8, &ctx->psa_key_id);
|
status = psa_import_key(&key_attr, key, PSA_BITS_TO_BYTES(key_bitlen), &ctx->psa_key_id);
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
return mbedtls_cipher_error_from_psa(status);
|
return mbedtls_cipher_error_from_psa(status);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user