summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/freebl/ctr.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-10-30 18:42:38 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-10-30 18:42:38 +0100
commitd0da27ef572152d1fdd82a9ac15bd5c23ad68160 (patch)
treea617d33237e64a1f95a09e40c06a962b586583a1 /security/nss/lib/freebl/ctr.c
parent0f7f961e8894c8408b7fa21bbeba7ac503d372eb (diff)
parent50ef259a2df60d020ccb02d76dc5aa4835ee319e (diff)
downloadUXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar
UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.gz
UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.lz
UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.tar.xz
UXP-d0da27ef572152d1fdd82a9ac15bd5c23ad68160.zip
Merge branch 'release' into Basilisk-releasev2019.10.31
Diffstat (limited to 'security/nss/lib/freebl/ctr.c')
-rw-r--r--security/nss/lib/freebl/ctr.c12
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);