Bug 2029901 - Guard against keySize overflow in IKE PRF/PRF+ output sizing.

This commit is contained in:
Benjamin Beurdouche authored and Moonchild committed 2026-07-27 18:44:55 +02:00
1 parent b799e100ad
commit 5ea9b7b80a
1 file changed
+6
+6
View File
@@ -773,6 +773,12 @@ sftk_ike1_appendix_b_prf(CK_SESSION_HANDLE hSession, const SFTKAttribute *inKey,
}
outKeySize = PR_ROUNDUP(keySize, macSize);
/* Reject if PR_ROUNDUP overflowed 32-bit unsigned arithmetic, which
* would yield an undersized allocation for the loop below. */
if (outKeySize < keySize) {
crv = CKR_KEY_SIZE_RANGE;
goto fail;
}
outKeyData = PORT_Alloc(outKeySize);
if (outKeyData == NULL) {
crv = CKR_HOST_MEMORY;