diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-10-24 22:41:05 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-10-24 22:41:05 +0200 |
commit | 565ae72f5af3bcc9fb85945233e2a7afa115d435 (patch) | |
tree | 52dd8525956f7bea1fcb2bc89b9af73269666855 /security/nss/lib/freebl/ctr.c | |
parent | f1308011aef318f40d05d93353db17d059db83a0 (diff) | |
parent | fbf84d5155f7d47df85e1d389955a9529a04158f (diff) | |
download | UXP-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/ctr.c')
-rw-r--r-- | security/nss/lib/freebl/ctr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/security/nss/lib/freebl/ctr.c b/security/nss/lib/freebl/ctr.c index d7652c060..4d26a5b06 100644 --- a/security/nss/lib/freebl/ctr.c +++ b/security/nss/lib/freebl/ctr.c @@ -128,6 +128,12 @@ CTR_Update(CTRContext *ctr, unsigned char *outbuf, unsigned int tmp; SECStatus rv; + // Limit block count to 2^counterBits - 2 + if (ctr->counterBits < (sizeof(unsigned int) * 8) && + inlen > ((1 << ctr->counterBits) - 2) * AES_BLOCK_SIZE) { + PORT_SetError(SEC_ERROR_INPUT_LEN); + return SECFailure; + } if (maxout < inlen) { *outlen = inlen; PORT_SetError(SEC_ERROR_OUTPUT_LEN); @@ -199,6 +205,12 @@ CTR_Update_HW_AES(CTRContext *ctr, unsigned char *outbuf, unsigned int tmp; SECStatus rv; + // Limit block count to 2^counterBits - 2 + if (ctr->counterBits < (sizeof(unsigned int) * 8) && + inlen > ((1 << ctr->counterBits) - 2) * AES_BLOCK_SIZE) { + PORT_SetError(SEC_ERROR_INPUT_LEN); + return SECFailure; + } if (maxout < inlen) { *outlen = inlen; PORT_SetError(SEC_ERROR_OUTPUT_LEN); |