| Index: nss/lib/freebl/rsa.c
|
| diff --git a/nss/lib/freebl/rsa.c b/nss/lib/freebl/rsa.c
|
| index fb4b5d058945fc4c7821d6ad0259a6ce94475eb3..34bc395fe2baae872645712fb190656100af5738 100644
|
| --- a/nss/lib/freebl/rsa.c
|
| +++ b/nss/lib/freebl/rsa.c
|
| @@ -1353,33 +1353,8 @@ RSA_PrivateKeyOpDoubleChecked(RSAPrivateKey *key,
|
| return rsa_PrivateKeyOp(key, output, input, PR_TRUE);
|
| }
|
|
|
| -static SECStatus
|
| -swap_in_key_value(PLArenaPool *arena, mp_int *mpval, SECItem *buffer)
|
| -{
|
| - int len;
|
| - mp_err err = MP_OKAY;
|
| - memset(buffer->data, 0, buffer->len);
|
| - len = mp_unsigned_octet_size(mpval);
|
| - if (len <= 0) return SECFailure;
|
| - if ((unsigned int)len <= buffer->len) {
|
| - /* The new value is no longer than the old buffer, so use it */
|
| - err = mp_to_unsigned_octets(mpval, buffer->data, len);
|
| - if (err >= 0) err = MP_OKAY;
|
| - buffer->len = len;
|
| - } else if (arena) {
|
| - /* The new value is longer, but working within an arena */
|
| - (void)SECITEM_AllocItem(arena, buffer, len);
|
| - err = mp_to_unsigned_octets(mpval, buffer->data, len);
|
| - if (err >= 0) err = MP_OKAY;
|
| - } else {
|
| - /* The new value is longer, no arena, can't handle this key */
|
| - return SECFailure;
|
| - }
|
| - return (err == MP_OKAY) ? SECSuccess : SECFailure;
|
| -}
|
| -
|
| SECStatus
|
| -RSA_PrivateKeyCheck(RSAPrivateKey *key)
|
| +RSA_PrivateKeyCheck(const RSAPrivateKey *key)
|
| {
|
| mp_int p, q, n, psub1, qsub1, e, d, d_p, d_q, qInv, res;
|
| mp_err err = MP_OKAY;
|
| @@ -1425,18 +1400,10 @@ RSA_PrivateKeyCheck(RSAPrivateKey *key)
|
| SECITEM_TO_MPINT(key->exponent1, &d_p);
|
| SECITEM_TO_MPINT(key->exponent2, &d_q);
|
| SECITEM_TO_MPINT(key->coefficient, &qInv);
|
| - /* 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) */
|
| - SECItem tmp;
|
| - mp_exch(&p, &q);
|
| - mp_exch(&d_p,&d_q);
|
| - tmp = key->prime1;
|
| - key->prime1 = key->prime2;
|
| - key->prime2 = tmp;
|
| - tmp = key->exponent1;
|
| - key->exponent1 = key->exponent2;
|
| - key->exponent2 = tmp;
|
| + rv = SECFailure;
|
| + goto cleanup;
|
| }
|
| #define VERIFY_MPI_EQUAL(m1, m2) \
|
| if (mp_cmp(m1, m2) != 0) { \
|
|
|