diff options
author | Nikolay Sivov <nsivov@codeweavers.com> | 2020-09-01 19:29:20 +0300 |
---|---|---|
committer | Nikolay Sivov <nsivov@codeweavers.com> | 2020-09-01 19:30:19 +0300 |
commit | 86c3a4db8f340ac03c47c694fb24c5110c5abf8e (patch) | |
tree | a578a09017bb10b0e0c414ffb86625185a3b5c14 | |
parent | e53fd9ba2510239fcd7f29ed8525e04137ef5cbc (diff) | |
download | gnutls-86c3a4db8f340ac03c47c694fb24c5110c5abf8e.tar.gz |
Fix optional parameters counter when importing RSA private keys.
Currently gnutls_privkey_import_rsa_raw() allows 3 last arguments to be omitted,
key fixup logic however checks for 3 missing arguments when updating coefficient 'u'
but then asserts when updating exponents 'e1' and 'e2' assuming only 2 parameters
are missing at that point.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
-rw-r--r-- | lib/nettle/pk.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c index 94027bff86..29698461d5 100644 --- a/lib/nettle/pk.c +++ b/lib/nettle/pk.c @@ -3342,6 +3342,9 @@ wrap_nettle_pk_fixup(gnutls_pk_algorithm_t algo, TOMPZ(params->params[RSA_PRIME1])) == 0) return gnutls_assert_val(GNUTLS_E_PK_INVALID_PRIVKEY); + /* marks RSA_COEF as present */ + params->params_nr = RSA_PRIVATE_PARAMS - 2; + /* calculate exp1 [6] and exp2 [7] */ zrelease_mpi_key(¶ms->params[RSA_E1]); zrelease_mpi_key(¶ms->params[RSA_E2]); |