summaryrefslogtreecommitdiffstats
path: root/apps/req.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-04-07 00:20:11 +0200
committerRich Salz <rsalz@openssl.org>2016-07-20 01:35:38 -0400
commit1c72f70df43a0ceb118a990b9554913e26a83696 (patch)
tree6f7e4ed58214f50f32417ee89fcacd68bcb8ca96 /apps/req.c
parent415e7c488e09119a42be24129e38ddd43524ee06 (diff)
Use more X509_REQ_get0_pubkey & X509_get0_pubkey
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1284)
Diffstat (limited to 'apps/req.c')
-rw-r--r--apps/req.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/apps/req.c b/apps/req.c
index f1ee9515a4..e459a71213 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -727,15 +727,14 @@ int req_main(int argc, char **argv)
goto end;
if (pubkey) {
- EVP_PKEY *tpubkey;
- tpubkey = X509_REQ_get_pubkey(req);
+ EVP_PKEY *tpubkey = X509_REQ_get0_pubkey(req);
+
if (tpubkey == NULL) {
BIO_printf(bio_err, "Error getting public key\n");
ERR_print_errors(bio_err);
goto end;
}
PEM_write_bio_PUBKEY(out, tpubkey);
- EVP_PKEY_free(tpubkey);
}
if (text) {
@@ -758,9 +757,9 @@ int req_main(int argc, char **argv)
EVP_PKEY *tpubkey;
if (x509)
- tpubkey = X509_get_pubkey(x509ss);
+ tpubkey = X509_get0_pubkey(x509ss);
else
- tpubkey = X509_REQ_get_pubkey(req);
+ tpubkey = X509_REQ_get0_pubkey(req);
if (tpubkey == NULL) {
fprintf(stdout, "Modulus=unavailable\n");
goto end;
@@ -774,7 +773,6 @@ int req_main(int argc, char **argv)
} else
#endif
fprintf(stdout, "Wrong Algorithm type");
- EVP_PKEY_free(tpubkey);
fprintf(stdout, "\n");
}