mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 17:43:14 +00:00
Add buffer copying to psa_aead_set_nonce()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
52402ec0fe
commit
8f0ef519d4
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user