summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/freebl/chacha20poly1305.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-10-24 22:41:05 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-10-24 22:41:05 +0200
commit565ae72f5af3bcc9fb85945233e2a7afa115d435 (patch)
tree52dd8525956f7bea1fcb2bc89b9af73269666855 /security/nss/lib/freebl/chacha20poly1305.c
parentf1308011aef318f40d05d93353db17d059db83a0 (diff)
parentfbf84d5155f7d47df85e1d389955a9529a04158f (diff)
downloadUXP-565ae72f5af3bcc9fb85945233e2a7afa115d435.tar
UXP-565ae72f5af3bcc9fb85945233e2a7afa115d435.tar.gz
UXP-565ae72f5af3bcc9fb85945233e2a7afa115d435.tar.lz
UXP-565ae72f5af3bcc9fb85945233e2a7afa115d435.tar.xz
UXP-565ae72f5af3bcc9fb85945233e2a7afa115d435.zip
Merge branch 'nss-work'
Diffstat (limited to 'security/nss/lib/freebl/chacha20poly1305.c')
-rw-r--r--security/nss/lib/freebl/chacha20poly1305.c5
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