mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Properly handle GCM's range of nonce sizes
Add comment to the effect that we cannot really check nonce size as the GCM spec allows almost arbitrarily large nonces. As a result of this, change the operation nonce over to an allocated buffer to avoid overflow situations. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@ -135,7 +135,6 @@ typedef struct
|
||||
unsigned int body_started : 1;
|
||||
|
||||
uint8_t tag_length;
|
||||
uint8_t nonce_length;
|
||||
|
||||
/* Buffers for AD/data - only required until CCM gets proper multipart
|
||||
support. */
|
||||
@ -149,7 +148,8 @@ typedef struct
|
||||
|
||||
/* buffer to store Nonce - only required until CCM and GCM get proper
|
||||
multipart support. */
|
||||
uint8_t nonce[PSA_AEAD_NONCE_MAX_SIZE];
|
||||
uint8_t *nonce;
|
||||
size_t nonce_length;
|
||||
|
||||
union
|
||||
{
|
||||
@ -168,7 +168,7 @@ typedef struct
|
||||
|
||||
} mbedtls_psa_aead_operation_t;
|
||||
|
||||
#define MBEDTLS_PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}, {0}}
|
||||
#define MBEDTLS_PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0}}
|
||||
|
||||
/*
|
||||
* BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY.
|
||||
|
Reference in New Issue
Block a user