From 4fc744f8af1fef75f8d005584275dc3a6e209090 Mon Sep 17 00:00:00 2001 From: mohammad1603 Date: Sun, 3 Jun 2018 15:10:47 +0300 Subject: [PATCH] change the check of block size for all supported algorithms --- library/psa_crypto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 317417d69..905b9a80f 100755 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1509,8 +1509,8 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key, //TODO: check key policy - if ( !( ( key_type & PSA_KEY_TYPE_CATEGORY_MASK ) == PSA_KEY_TYPE_CATEGORY_CIPHER - && PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) == 16 ) ) + if ( !( ( key_type & PSA_KEY_TYPE_CATEGORY_MASK ) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC + && PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) == cipher_info->block_size ) ) return( PSA_ERROR_INVALID_ARGUMENT ); if( alg == PSA_ALG_GCM ) @@ -1633,8 +1633,8 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key, return( PSA_ERROR_NOT_SUPPORTED ); //TODO: check key policy - if ( !( ( key_type & PSA_KEY_TYPE_CATEGORY_MASK ) == PSA_KEY_TYPE_CATEGORY_CIPHER - && PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) == 16 ) ) + if ( !( ( key_type & PSA_KEY_TYPE_CATEGORY_MASK ) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC + && PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) == cipher_info->block_size ) ) return( PSA_ERROR_INVALID_ARGUMENT ); if( alg == PSA_ALG_GCM )