Fix theoretical off-by-one error in GCM AAD limit This is not a real issue, as it's not actually possible to hit this. Bug: 582789503 Change-Id: I23e4ba4438598f51fd8bb9e6724e0fe42916e227 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/105528 Auto-Submit: David Benjamin <davidben@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Lily Chen <chlily@google.com> Commit-Queue: Lily Chen <chlily@google.com>
diff --git a/crypto/fipsmodule/aes/gcm.cc.inc b/crypto/fipsmodule/aes/gcm.cc.inc index 732a76c..4aebc3a 100644 --- a/crypto/fipsmodule/aes/gcm.cc.inc +++ b/crypto/fipsmodule/aes/gcm.cc.inc
@@ -357,7 +357,7 @@ } uint64_t alen = ctx->len.aad + aad_len; - if (alen > (UINT64_C(1) << 61) || (sizeof(aad_len) == 8 && alen < aad_len)) { + if (alen >= (UINT64_C(1) << 61) || (sizeof(aad_len) == 8 && alen < aad_len)) { return 0; } ctx->len.aad = alen;