From a6e89d58d4fbb89a770be0e94f482bd7f4416b14 Mon Sep 17 00:00:00 2001 From: Pascal Brand Date: Thu, 18 Sep 2014 20:45:42 +0200 Subject: [PATCH] RSA in CRT optimization parameters are empty --- src/pk/rsa/rsa_exptmod.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pk/rsa/rsa_exptmod.c b/src/pk/rsa/rsa_exptmod.c index b9f8870..dcb036e 100644 --- a/src/pk/rsa/rsa_exptmod.c +++ b/src/pk/rsa/rsa_exptmod.c @@ -100,16 +100,11 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen, } #endif /* LTC_RSA_BLINDING */ - if (key->dP == NULL) { + if ((key->dP == NULL) || (mp_get_digit_count(key->dP) == 0)) { /* - * In case CRT optimization parameters are provided, - * the private key is directly used + * In case CRT optimization parameters are not provided, + * the private key is directly used to exptmod it */ - LTC_ARGCHK(key->dQ == NULL); - LTC_ARGCHK(key->qP == NULL); - LTC_ARGCHK(key->p == NULL); - LTC_ARGCHK(key->q == NULL); - /* exptmod it */ if ((err = mp_exptmod(tmp, key->d, key->N, tmp)) != CRYPT_OK) { goto error; } } else { /* tmpa = tmp^dP mod p */