summaryrefslogtreecommitdiffstats
path: root/apps/genrsa.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-10-04 16:34:31 +0200
committerRichard Levitte <levitte@openssl.org>2020-11-18 23:38:34 +0100
commitd7e498ac55f12bc2f4e7f948cbb8de2e3eeafc74 (patch)
tree755ca6bcbcd3b85d0371713d754b26f4a9d70250 /apps/genrsa.c
parentb24d6c335d3beb431f8f9847623d4db39ae1f96b (diff)
Deprecate RSA harder
This deprecates all functions that deal with the types RSA and RSA_METHOD Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13096)
Diffstat (limited to 'apps/genrsa.c')
-rw-r--r--apps/genrsa.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/genrsa.c b/apps/genrsa.c
index f471814e08..32f088238d 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -79,9 +79,7 @@ int genrsa_main(int argc, char **argv)
BN_GENCB *cb = BN_GENCB_new();
ENGINE *eng = NULL;
BIGNUM *bn = BN_new();
- RSA *rsa;
BIO *out = NULL;
- const BIGNUM *e;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
const EVP_CIPHER *enc = NULL;
@@ -205,9 +203,11 @@ opthelp:
}
if (verbose) {
- if ((rsa = EVP_PKEY_get0_RSA(pkey)) != NULL) {
- RSA_get0_key(rsa, NULL, &e, NULL);
- } else {
+ BIGNUM *e = NULL;
+
+ /* Every RSA key has an 'e' */
+ EVP_PKEY_get_bn_param(pkey, "e", &e);
+ if (e == NULL) {
BIO_printf(bio_err, "Error cannot access RSA e\n");
goto end;
}
@@ -218,6 +218,7 @@ opthelp:
}
OPENSSL_free(hexe);
OPENSSL_free(dece);
+ BN_free(e);
}
if (traditional) {
if (!PEM_write_bio_PrivateKey_traditional(out, pkey, enc, NULL, 0,