Skip to content

Commit

Permalink
RsaFunctionPrivate: detect when only n,e,d are available
Browse files Browse the repository at this point in the history
  • Loading branch information
julek-wolfssl committed Jul 31, 2024
1 parent 8ef893b commit 7d8c040
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wolfcrypt/src/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,13 @@ static int RsaFunctionPrivate(mp_int* tmp, RsaKey* key, WC_RNG* rng)
}
}
#else
if (ret == 0) {
if (ret == 0 && (mp_iszero(&key->p) || mp_iszero(&key->q) ||
mp_iszero(&key->dP) || mp_iszero(&key->dQ))) {
if (mp_exptmod(tmp, &key->d, &key->n, tmp) != MP_OKAY) {
ret = MP_EXPTMOD_E;
}
}
else if (ret == 0) {
mp_int* tmpa = tmp;
#if defined(WC_RSA_BLINDING) && !defined(WC_NO_RNG)
mp_int* tmpb = rnd;
Expand Down

0 comments on commit 7d8c040

Please sign in to comment.