From a7e6df76ead156437d97aa592aa8bbec28f77b9d Mon Sep 17 00:00:00 2001 From: mohammad1603 Date: Mon, 30 Apr 2018 17:25:45 +0300 Subject: [PATCH] Validation fixes for key_type --- library/psa_crypto.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 0ed9dd9bf..33e265766 100755 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1600,8 +1600,9 @@ psa_status_t psa_aead_decrypt( 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;