Add buffer copying to psa_aead_set_nonce()

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2023-12-11 15:17:11 +00:00
parent 52402ec0fe
commit 8f0ef519d4

View File

@ -4938,11 +4938,14 @@ exit:
/* Set the nonce for a multipart authenticated encryption or decryption /* Set the nonce for a multipart authenticated encryption or decryption
operation.*/ operation.*/
psa_status_t psa_aead_set_nonce(psa_aead_operation_t *operation, psa_status_t psa_aead_set_nonce(psa_aead_operation_t *operation,
const uint8_t *nonce, const uint8_t *nonce_external,
size_t nonce_length) size_t nonce_length)
{ {
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
LOCAL_INPUT_DECLARE(nonce_external, nonce);
LOCAL_INPUT_ALLOC(nonce_external, nonce_length, nonce);
if (operation->id == 0) { if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE; status = PSA_ERROR_BAD_STATE;
goto exit; goto exit;
@ -4969,6 +4972,8 @@ exit:
psa_aead_abort(operation); psa_aead_abort(operation);
} }
LOCAL_INPUT_FREE(nonce_external, nonce);
return status; return status;
} }