mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-25 06:39:04 +08:00
Fix issue where input data could be length 0
This commit fixes an issue in the GCM shared buffer test case where input data could be of length 0 and an adequate buffer was not allocated. Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
This commit is contained in:
parent
01d32e76dd
commit
d77207efdd
@ -627,7 +627,7 @@ void gcm_encrypt_input_output_buffer_overlap(int cipher_id, data_t *key_str,
|
||||
* Therefore we must ensure we round up to the nearest 128-bits/16-bytes.
|
||||
*/
|
||||
buffer_len = src_str->len;
|
||||
if (buffer_len % 16 != 0) {
|
||||
if (buffer_len % 16 != 0 || buffer_len == 0) {
|
||||
buffer_len += (16 - (buffer_len % 16));
|
||||
}
|
||||
TEST_CALLOC(buffer, buffer_len);
|
||||
@ -686,7 +686,7 @@ void gcm_decrypt_input_output_buffer_overlap(int cipher_id, data_t *key_str,
|
||||
* Therefore we must ensure we round up to the nearest 128-bits/16-bytes.
|
||||
*/
|
||||
buffer_len = src_str->len;
|
||||
if (buffer_len % 16 != 0) {
|
||||
if (buffer_len % 16 != 0 || buffer_len == 0) {
|
||||
buffer_len += (16 - (buffer_len % 16));
|
||||
}
|
||||
TEST_CALLOC(buffer, buffer_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user