mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-15 23:42:41 +00:00
Add buffer copying to psa_aead_generate_nonce()
Note that this is not strictly necessary as this function only copies to the output buffer at the end. However, it simplifies testing for the time being. Future optimisation work could consider removing this copying. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
7f2e040a9b
commit
d3cad8b017
@ -4876,7 +4876,7 @@ psa_status_t psa_aead_decrypt_setup(psa_aead_operation_t *operation,
|
||||
|
||||
/* Generate a random nonce / IV for multipart AEAD operation */
|
||||
psa_status_t psa_aead_generate_nonce(psa_aead_operation_t *operation,
|
||||
uint8_t *nonce,
|
||||
uint8_t *nonce_external,
|
||||
size_t nonce_size,
|
||||
size_t *nonce_length)
|
||||
{
|
||||
@ -4884,6 +4884,9 @@ psa_status_t psa_aead_generate_nonce(psa_aead_operation_t *operation,
|
||||
uint8_t local_nonce[PSA_AEAD_NONCE_MAX_SIZE];
|
||||
size_t required_nonce_size = 0;
|
||||
|
||||
LOCAL_OUTPUT_DECLARE(nonce_external, nonce);
|
||||
LOCAL_OUTPUT_ALLOC(nonce_external, nonce_size, nonce);
|
||||
|
||||
*nonce_length = 0;
|
||||
|
||||
if (operation->id == 0) {
|
||||
@ -4927,6 +4930,8 @@ exit:
|
||||
psa_aead_abort(operation);
|
||||
}
|
||||
|
||||
LOCAL_OUTPUT_FREE(nonce_external, nonce);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user