Skip to content

Commit 0a6af8d

Browse files
committed
rsa_exptmod(): verify that p and q are valid before going the CRT path
1 parent f5b8cc9 commit 0a6af8d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/pk/rsa/rsa_exptmod.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen,
9797
}
9898
#endif /* LTC_RSA_BLINDING */
9999

100-
has_crt_parameters = (key->dP != NULL) && (mp_get_digit_count(key->dP) != 0) &&
101-
(key->dQ != NULL) && (mp_get_digit_count(key->dQ) != 0) &&
102-
(key->qP != NULL) && (mp_get_digit_count(key->qP) != 0);
100+
has_crt_parameters = (key->p != NULL) && (mp_get_digit_count(key->p) != 0) &&
101+
(key->q != NULL) && (mp_get_digit_count(key->q) != 0) &&
102+
(key->dP != NULL) && (mp_get_digit_count(key->dP) != 0) &&
103+
(key->dQ != NULL) && (mp_get_digit_count(key->dQ) != 0) &&
104+
(key->qP != NULL) && (mp_get_digit_count(key->qP) != 0);
103105

104106
if (!has_crt_parameters) {
105107
/*

0 commit comments

Comments
 (0)