diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-04-03 23:37:32 +0200 |
---|---|---|
committer | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-04-04 20:38:14 +0200 |
commit | c5137473bdc7bcf7c43b4bd5d28827f8ddd70490 (patch) | |
tree | 6a3bf41f6437c0021d89bd7dae4dac152d4174c3 /apps/req.c | |
parent | 97458daade31c32ea8816b7e065e3bda3be588fa (diff) | |
download | openssl-c5137473bdc7bcf7c43b4bd5d28827f8ddd70490.tar.gz |
Use X509_REQ_get0_pubkey
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/apps/req.c b/apps/req.c index edf998ba70..561cccc98f 100644 --- a/apps/req.c +++ b/apps/req.c @@ -375,6 +375,7 @@ int req_main(int argc, char **argv) if (!nmflag_set) nmflag = XN_FLAG_ONELINE; + /* TODO: simplify this as pkey is still always NULL here */ private = newreq && (pkey == NULL) ? 1 : 0; if (!app_passwd(passargin, passargout, &passin, &passout)) { @@ -666,10 +667,9 @@ int req_main(int argc, char **argv) if (!X509_set_subject_name (x509ss, X509_REQ_get_subject_name(req))) goto end; - tmppkey = X509_REQ_get_pubkey(req); + tmppkey = X509_REQ_get0_pubkey(req); if (!tmppkey || !X509_set_pubkey(x509ss, tmppkey)) goto end; - EVP_PKEY_free(tmppkey); /* Set up V3 context struct */ @@ -739,20 +739,15 @@ int req_main(int argc, char **argv) } if (verify && !x509) { - int tmp = 0; + EVP_PKEY *pubkey = pkey; - if (pkey == NULL) { - pkey = X509_REQ_get_pubkey(req); - tmp = 1; - if (pkey == NULL) + if (pubkey == NULL) { + pubkey = X509_REQ_get0_pubkey(req); + if (pubkey == NULL) goto end; } - i = X509_REQ_verify(req, pkey); - if (tmp) { - EVP_PKEY_free(pkey); - pkey = NULL; - } + i = X509_REQ_verify(req, pubkey); if (i < 0) { goto end; |