mirror of https://github.com/ARMmbed/mbed-os.git
Change PSA_MAX_NONCE_SIZE to PSA_AEAD_MAX_NONCE_SIZE
parent
ba47b450aa
commit
79d957ac7b
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in New Issue