diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/crypto_platform_spe.h b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/crypto_platform_spe.h index d70dce77e0..c79749d988 100644 --- a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/crypto_platform_spe.h +++ b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/crypto_platform_spe.h @@ -141,7 +141,7 @@ typedef struct psa_key_mng_ipc_s */ // Max length supported for nonce is 16 bytes. -#define PSA_MAX_NONCE_SIZE 16 +#define PSA_AEAD_MAX_NONCE_SIZE 16 typedef struct psa_crypto_ipc_aead_s { psa_sec_function_t func; @@ -150,7 +150,7 @@ typedef struct psa_crypto_ipc_aead_s uint16_t nonce_size; size_t additional_data_length; size_t input_length; - uint8_t nonce[PSA_MAX_NONCE_SIZE]; + uint8_t nonce[PSA_AEAD_MAX_NONCE_SIZE]; } psa_crypto_ipc_aead_t; /** psa_crypto_ipc_asymmetric_s struct used for asymmetric diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c index dbe3629437..7201556dee 100644 --- a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c +++ b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c @@ -351,7 +351,7 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key, psa_crypto_ipc.additional_data_length = additional_data_length; psa_crypto_ipc.input_length = plaintext_length; - if( nonce_length > PSA_MAX_NONCE_SIZE ) + if( nonce_length > PSA_AEAD_MAX_NONCE_SIZE ) return( PSA_ERROR_INVALID_ARGUMENT ); psa_crypto_ipc.nonce_size = nonce_length; @@ -412,7 +412,7 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key, psa_crypto_ipc.additional_data_length = additional_data_length; psa_crypto_ipc.input_length = ciphertext_length; - if( nonce_length > PSA_MAX_NONCE_SIZE ) + if( nonce_length > PSA_AEAD_MAX_NONCE_SIZE ) return( PSA_ERROR_INVALID_ARGUMENT ); psa_crypto_ipc.nonce_size = nonce_length; diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c b/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c index 9e47f67549..db4a20241a 100755 --- a/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c +++ b/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c @@ -773,7 +773,7 @@ static void psa_symmetric_operation( void ) { size_t iv_length = 0; size_t iv_size = msg.out_size[0]; - unsigned char iv[PSA_MAX_NONCE_SIZE] = { 0 }; + unsigned char iv[PSA_AEAD_MAX_NONCE_SIZE] = { 0 }; status = psa_cipher_generate_iv( msg.rhandle, iv, iv_size, &iv_length ); @@ -788,7 +788,7 @@ static void psa_symmetric_operation( void ) case PSA_CIPHER_SET_IV: { size_t iv_length = msg.in_size[1]; - unsigned char iv[PSA_MAX_NONCE_SIZE] = { 0 }; + unsigned char iv[PSA_AEAD_MAX_NONCE_SIZE] = { 0 }; bytes_read = psa_read( msg.handle, 1, iv, iv_length ); if( bytes_read != iv_length )