summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/freebl/gcm.c
diff options
context:
space:
mode:
authorKevin Jacobs <kjacobs@mozilla.com>2019-10-24 16:47:28 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-10-24 16:47:28 +0200
commitc525bb791873ecdcce59c0da4ceafc8f5f557b2f (patch)
treef35f574e4213bd9a0cfaafbc8c283d7653ac063d /security/nss/lib/freebl/gcm.c
parentedfba06ce39f155f9394381d4f445a0c986bac77 (diff)
downloadUXP-c525bb791873ecdcce59c0da4ceafc8f5f557b2f.tar
UXP-c525bb791873ecdcce59c0da4ceafc8f5f557b2f.tar.gz
UXP-c525bb791873ecdcce59c0da4ceafc8f5f557b2f.tar.lz
UXP-c525bb791873ecdcce59c0da4ceafc8f5f557b2f.tar.xz
UXP-c525bb791873ecdcce59c0da4ceafc8f5f557b2f.zip
Add length checks for cryptographic primitives
This rollup patch adds additional length checks around cryptographic primitives.
Diffstat (limited to 'security/nss/lib/freebl/gcm.c')
-rw-r--r--security/nss/lib/freebl/gcm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/security/nss/lib/freebl/gcm.c b/security/nss/lib/freebl/gcm.c
index f1e16da78..e93970b88 100644
--- a/security/nss/lib/freebl/gcm.c
+++ b/security/nss/lib/freebl/gcm.c
@@ -469,6 +469,12 @@ gcmHash_Reset(gcmHashContext *ghash, const unsigned char *AAD,
{
SECStatus rv;
+ // Limit AADLen in accordance with SP800-38D
+ if (sizeof(AADLen) >= 8 && AADLen > (1ULL << 61) - 1) {
+ PORT_SetError(SEC_ERROR_INPUT_LEN);
+ return SECFailure;
+ }
+
ghash->cLen = 0;
PORT_Memset(ghash->counterBuf, 0, GCM_HASH_LEN_LEN * 2);
ghash->bufLen = 0;