mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 05:25:33 +00:00
Parameters validation fixes
Fix key_type validation test and no need to ask for place for tag in decryption
This commit is contained in:
parent
9112693930
commit
db6247315f
|
@ -1503,8 +1503,9 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key,
|
|||
if( cipher_info == NULL )
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
|
||||
if ( key_type != PSA_KEY_TYPE_RAW_DATA)
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
if ( ( key_type & PSA_KEY_TYPE_CATEGORY_MASK ) == PSA_KEY_TYPE_CATEGORY_CIPHER
|
||||
&& PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) == 16 )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
operation->block_size = cipher_info->block_size;
|
||||
|
||||
|
@ -1586,7 +1587,7 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key,
|
|||
const mbedtls_cipher_info_t *cipher_info = NULL;
|
||||
unsigned char tag[16];
|
||||
|
||||
if( plaintext_size < ( ciphertext_length + sizeof( tag ) ) )
|
||||
if( plaintext_size < ciphertext_length )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
status = psa_get_key_information( key, &key_type, &key_bits );
|
||||
|
|
Loading…
Reference in a new issue