RSA: Fix rsa_todata() to only add params for existing data
authorRichard Levitte <levitte@openssl.org>
Tue, 18 Aug 2020 21:00:24 +0000 (23:00 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 20 Aug 2020 05:50:55 +0000 (07:50 +0200)
commit26a8f2ac95ad4f652b1719aab356ad9c042c6fad
treefb201b21e5a9c5da29c3c40f08c79216d462bb36
parente6ed04a9dcc2ead94e35c4a7400b9c998b5ad9ac
RSA: Fix rsa_todata() to only add params for existing data

The RSA key could be a public key, and yet, rsa_todata() always tries
to add the private parts as well.  The resulting parameters will look
a bit odd, such as a zero |d|, resulting in an invalid key.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12676)
crypto/rsa/rsa_backend.c