diff options
author | Wan-Teh Chang <wtc@google.com> | 2014-06-12 15:22:15 -0700 |
---|---|---|
committer | Wan-Teh Chang <wtc@google.com> | 2014-06-12 15:22:15 -0700 |
commit | 37e606c4f7b5c9700f2eae1db6f32cec9bcf6042 (patch) | |
tree | 162240cf980b9cbc83c744371df0d6271df5df08 /lib/freebl/rsa.c | |
parent | c32f8a03ccef80c276a08e2ee2a34a95f783e4e4 (diff) | |
download | nss-hg-37e606c4f7b5c9700f2eae1db6f32cec9bcf6042.tar.gz |
Bug 1021102: RSA_PrivateKeyCheck should require p > q. r=rlb.NSS_3_16_2_BETA4
Diffstat (limited to 'lib/freebl/rsa.c')
-rw-r--r-- | lib/freebl/rsa.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/freebl/rsa.c b/lib/freebl/rsa.c index 2490b39c3..fc6f91861 100644 --- a/lib/freebl/rsa.c +++ b/lib/freebl/rsa.c @@ -1400,11 +1400,10 @@ RSA_PrivateKeyCheck(const RSAPrivateKey *key) SECITEM_TO_MPINT(key->exponent1, &d_p); SECITEM_TO_MPINT(key->exponent2, &d_q); SECITEM_TO_MPINT(key->coefficient, &qInv); - /* The qInv check depends on p > q. */ + /* p > q */ if (mp_cmp(&p, &q) <= 0) { - /* mind the p's and q's (and d_p's and d_q's) */ - mp_exch(&p, &q); - mp_exch(&d_p,&d_q); + rv = SECFailure; + goto cleanup; } #define VERIFY_MPI_EQUAL(m1, m2) \ if (mp_cmp(m1, m2) != 0) { \ |