Skip to content

Commit 2dbfb16

Browse files
siemen11nasahlpa
authored andcommitted
[crypto/gcm] Check tag length
When performing a redundant calculation on the tag, we create a copy buffer. That buffer is maximally 128 bits. The input tag length should follow suit to be checked as maximally 128 bits. Signed-off-by: Siemen Dhooghe <sdhooghe@google.com>
1 parent 18b1373 commit 2dbfb16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sw/device/lib/crypto/impl/aes_gcm/aes_gcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ status_t aes_gcm_decrypt_final(aes_gcm_context_t *ctx, size_t tag_len,
678678
const uint32_t *tag, size_t *output_len,
679679
uint8_t *output, hardened_bool_t *success) {
680680
// Get the expected authentication tag.
681-
uint32_t expected_tag[tag_len];
681+
uint32_t expected_tag[kAesBlockNumWords];
682682
size_t bytes_written;
683683
HARDENED_TRY(
684684
aes_gcm_final(ctx, tag_len, expected_tag, &bytes_written, output));

0 commit comments

Comments
 (0)