diff options
author | Kevin Jacobs <kjacobs@mozilla.com> | 2019-10-24 16:47:28 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-10-24 16:47:28 +0200 |
commit | c525bb791873ecdcce59c0da4ceafc8f5f557b2f (patch) | |
tree | f35f574e4213bd9a0cfaafbc8c283d7653ac063d /security/nss/lib/freebl/chacha20poly1305.c | |
parent | edfba06ce39f155f9394381d4f445a0c986bac77 (diff) | |
download | UXP-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/chacha20poly1305.c')
-rw-r--r-- | security/nss/lib/freebl/chacha20poly1305.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/security/nss/lib/freebl/chacha20poly1305.c b/security/nss/lib/freebl/chacha20poly1305.c index 302f0db9e..8fdaf3fec 100644 --- a/security/nss/lib/freebl/chacha20poly1305.c +++ b/security/nss/lib/freebl/chacha20poly1305.c @@ -234,6 +234,11 @@ ChaCha20Poly1305_Open(const ChaCha20Poly1305Context *ctx, unsigned char *output, PORT_SetError(SEC_ERROR_OUTPUT_LEN); return SECFailure; } + // ChaCha has a 64 octet block, with a 32-bit block counter. + if (inputLen >= (1ULL << (6 + 32)) + ctx->tagLen) { + PORT_SetError(SEC_ERROR_INPUT_LEN); + return SECFailure; + } PORT_Memset(block, 0, sizeof(block)); // Generate a block of keystream. The first 32 bytes will be the poly1305 |