mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-26 20:36:23 +00:00
Supply actual key bits to PSA_MAC_LENGTH during MAC setup
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
9621f444a7
commit
a6474de2ac
|
@ -2333,11 +2333,11 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
|
||||||
|
|
||||||
operation->is_sign = is_sign;
|
operation->is_sign = is_sign;
|
||||||
|
|
||||||
/* Get the output length for the algorithm and key combination. None of the
|
/* Get the output length for the algorithm and key combination */
|
||||||
* currently supported algorithms have an output length dependent on actual
|
|
||||||
* key size, so setting it to a bogus value is currently OK. */
|
|
||||||
operation->mac_size = PSA_MAC_LENGTH(
|
operation->mac_size = PSA_MAC_LENGTH(
|
||||||
psa_get_key_type( &attributes ), 0, alg );
|
psa_get_key_type( &attributes ),
|
||||||
|
psa_get_key_bits( &attributes ),
|
||||||
|
alg );
|
||||||
|
|
||||||
if( operation->mac_size < 4 )
|
if( operation->mac_size < 4 )
|
||||||
{
|
{
|
||||||
|
@ -2350,7 +2350,7 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( operation->mac_size > PSA_MAC_LENGTH( psa_get_key_type( &attributes ),
|
if( operation->mac_size > PSA_MAC_LENGTH( psa_get_key_type( &attributes ),
|
||||||
0,
|
psa_get_key_bits( &attributes ),
|
||||||
PSA_ALG_FULL_LENGTH_MAC( alg ) ) )
|
PSA_ALG_FULL_LENGTH_MAC( alg ) ) )
|
||||||
{
|
{
|
||||||
/* It's impossible to "truncate" to a larger length than the full length
|
/* It's impossible to "truncate" to a larger length than the full length
|
||||||
|
|
Loading…
Reference in a new issue