Latest update
This commit is contained in:
@@ -125,8 +125,8 @@ void RSA_free(RSA *r)
|
||||
|
||||
CRYPTO_THREAD_lock_free(r->lock);
|
||||
|
||||
BN_clear_free(r->n);
|
||||
BN_clear_free(r->e);
|
||||
BN_free(r->n);
|
||||
BN_free(r->e);
|
||||
BN_clear_free(r->d);
|
||||
BN_clear_free(r->p);
|
||||
BN_clear_free(r->q);
|
||||
@@ -196,7 +196,7 @@ int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
|
||||
r->e = e;
|
||||
}
|
||||
if (d != NULL) {
|
||||
BN_free(r->d);
|
||||
BN_clear_free(r->d);
|
||||
r->d = d;
|
||||
}
|
||||
|
||||
@@ -213,11 +213,11 @@ int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
|
||||
return 0;
|
||||
|
||||
if (p != NULL) {
|
||||
BN_free(r->p);
|
||||
BN_clear_free(r->p);
|
||||
r->p = p;
|
||||
}
|
||||
if (q != NULL) {
|
||||
BN_free(r->q);
|
||||
BN_clear_free(r->q);
|
||||
r->q = q;
|
||||
}
|
||||
|
||||
@@ -235,15 +235,15 @@ int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
|
||||
return 0;
|
||||
|
||||
if (dmp1 != NULL) {
|
||||
BN_free(r->dmp1);
|
||||
BN_clear_free(r->dmp1);
|
||||
r->dmp1 = dmp1;
|
||||
}
|
||||
if (dmq1 != NULL) {
|
||||
BN_free(r->dmq1);
|
||||
BN_clear_free(r->dmq1);
|
||||
r->dmq1 = dmq1;
|
||||
}
|
||||
if (iqmp != NULL) {
|
||||
BN_free(r->iqmp);
|
||||
BN_clear_free(r->iqmp);
|
||||
r->iqmp = iqmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -680,10 +680,11 @@ static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
|
||||
*/
|
||||
|| !bn_mod_sub_fixed_top(r1, r1, m1, rsa->p)
|
||||
|
||||
/* r0 = r0 * iqmp mod p */
|
||||
/* r1 = r1 * iqmp mod p */
|
||||
|| !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx)
|
||||
|| !bn_mul_mont_fixed_top(r1, r1, rsa->iqmp, rsa->_method_mod_p,
|
||||
ctx)
|
||||
/* r0 = r1 * q + m1 */
|
||||
|| !bn_mul_fixed_top(r0, r1, rsa->q, ctx)
|
||||
|| !bn_mod_add_fixed_top(r0, r0, m1, rsa->n))
|
||||
goto err;
|
||||
|
||||
Reference in New Issue
Block a user