diff options
Diffstat (limited to 'lib/softoken')
-rw-r--r-- | lib/softoken/pkcs11c.c | 4 | ||||
-rw-r--r-- | lib/softoken/pkcs11i.h | 2 | ||||
-rw-r--r-- | lib/softoken/pkcs11u.c | 2 | ||||
-rw-r--r-- | lib/softoken/sftkdhverify.c | 6 |
4 files changed, 9 insertions, 5 deletions
diff --git a/lib/softoken/pkcs11c.c b/lib/softoken/pkcs11c.c index c3216b3fd..201a0c728 100644 --- a/lib/softoken/pkcs11c.c +++ b/lib/softoken/pkcs11c.c @@ -5193,7 +5193,7 @@ sftk_PairwiseConsistencyCheck(CK_SESSION_HANDLE hSession, SFTKSlot *slot, /* subprime not supplied, In this case look it up. * This only works with approved primes, but in FIPS mode * that's the only kine of prime that will get here */ - subPrimePtr = sftk_VerifyDH_Prime(&prime); + subPrimePtr = sftk_VerifyDH_Prime(&prime, isFIPS); if (subPrimePtr == NULL) { crv = CKR_GENERAL_ERROR; goto done; @@ -8351,7 +8351,7 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession, /* if the prime is an approved prime, we can skip all the other * checks. */ - subPrime = sftk_VerifyDH_Prime(&dhPrime); + subPrime = sftk_VerifyDH_Prime(&dhPrime, isFIPS); if (subPrime == NULL) { SECItem dhSubPrime; /* If the caller set the subprime value, it means that diff --git a/lib/softoken/pkcs11i.h b/lib/softoken/pkcs11i.h index aa212f09e..032e85fee 100644 --- a/lib/softoken/pkcs11i.h +++ b/lib/softoken/pkcs11i.h @@ -946,7 +946,7 @@ char **NSC_ModuleDBFunc(unsigned long function, char *parameters, void *args); /* dh verify functions */ /* verify that dhPrime matches one of our known primes, and if so return * it's subprime value */ -const SECItem *sftk_VerifyDH_Prime(SECItem *dhPrime); +const SECItem *sftk_VerifyDH_Prime(SECItem *dhPrime, PRBool isFIPS); /* check if dhSubPrime claims dhPrime is a safe prime. */ SECStatus sftk_IsSafePrime(SECItem *dhPrime, SECItem *dhSubPrime, PRBool *isSafe); /* map an operation Attribute to a Mechanism flag */ diff --git a/lib/softoken/pkcs11u.c b/lib/softoken/pkcs11u.c index 43d4ba9d5..f37aab92f 100644 --- a/lib/softoken/pkcs11u.c +++ b/lib/softoken/pkcs11u.c @@ -2312,7 +2312,7 @@ sftk_handleSpecial(SFTKSlot *slot, CK_MECHANISM *mech, if (crv != CKR_OK) { return PR_FALSE; } - dhSubPrime = sftk_VerifyDH_Prime(&dhPrime); + dhSubPrime = sftk_VerifyDH_Prime(&dhPrime, PR_TRUE); SECITEM_ZfreeItem(&dhPrime, PR_FALSE); return (dhSubPrime) ? PR_TRUE : PR_FALSE; } diff --git a/lib/softoken/sftkdhverify.c b/lib/softoken/sftkdhverify.c index d85fba94f..6ac5e852a 100644 --- a/lib/softoken/sftkdhverify.c +++ b/lib/softoken/sftkdhverify.c @@ -1171,11 +1171,15 @@ static const SECItem subprime_tls_8192 = * verify that dhPrime matches one of our known primes */ const SECItem * -sftk_VerifyDH_Prime(SECItem *dhPrime) +sftk_VerifyDH_Prime(SECItem *dhPrime, PRBool isFIPS) { /* use the length to decide which primes to check */ switch (dhPrime->len) { case 1536 / PR_BITS_PER_BYTE: + /* don't accept 1536 bit primes in FIPS mode */ + if (isFIPS) { + break; + } if (PORT_Memcmp(dhPrime->data, prime_ike_1536, sizeof(prime_ike_1536)) == 0) { return &subprime_ike_1536; |