mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-24 20:16:57 +00:00
psa: cipher: Use PSA_CIPHER_IV_LENGTH to compute the IV length
The IV length computed in the cipher PSA implementation is the default IV length thus use the PSA macro PSA_CIPHER_IV_LENGTH defined to do that. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
6ad554cb83
commit
c17e8a9bf2
|
@ -221,17 +221,7 @@ static psa_status_t cipher_setup(
|
|||
|
||||
operation->block_length = ( PSA_ALG_IS_STREAM_CIPHER( alg ) ? 1 :
|
||||
PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type ) );
|
||||
if( ( alg & PSA_ALG_CIPHER_FROM_BLOCK_FLAG ) != 0 &&
|
||||
alg != PSA_ALG_ECB_NO_PADDING )
|
||||
{
|
||||
operation->iv_length = PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type );
|
||||
}
|
||||
#if defined(BUILTIN_KEY_TYPE_CHACHA20)
|
||||
else
|
||||
if( ( alg == PSA_ALG_STREAM_CIPHER ) &&
|
||||
( key_type == PSA_KEY_TYPE_CHACHA20 ) )
|
||||
operation->iv_length = 12;
|
||||
#endif
|
||||
operation->iv_length = PSA_CIPHER_IV_LENGTH( key_type, alg );
|
||||
|
||||
exit:
|
||||
return( mbedtls_to_psa_error( ret ) );
|
||||
|
|
Loading…
Reference in a new issue