diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-04-07 00:20:11 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-07-20 07:35:38 +0200 |
commit | 1c72f70df43a0ceb118a990b9554913e26a83696 (patch) | |
tree | 6f7e4ed58214f50f32417ee89fcacd68bcb8ca96 /apps/req.c | |
parent | OCSP_request_add0_id() inconsistent error return (diff) | |
download | openssl-1c72f70df43a0ceb118a990b9554913e26a83696.tar.xz openssl-1c72f70df43a0ceb118a990b9554913e26a83696.zip |
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.c | 10 |
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"); } |