summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/req.c10
-rw-r--r--crypto/x509/t_req.c3
-rw-r--r--test/ssltest_old.c8
3 files changed, 9 insertions, 12 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");
}
diff --git a/crypto/x509/t_req.c b/crypto/x509/t_req.c
index 0d0447bd2b..dbe4be3db1 100644
--- a/crypto/x509/t_req.c
+++ b/crypto/x509/t_req.c
@@ -86,13 +86,12 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags,
if (BIO_puts(bp, "\n") <= 0)
goto err;
- pkey = X509_REQ_get_pubkey(x);
+ pkey = X509_REQ_get0_pubkey(x);
if (pkey == NULL) {
BIO_printf(bp, "%12sUnable to load Public Key\n", "");
ERR_print_errors(bp);
} else {
EVP_PKEY_print_public(bp, pkey, 16, NULL);
- EVP_PKEY_free(pkey);
}
}
diff --git a/test/ssltest_old.c b/test/ssltest_old.c
index 74908b0087..8863465f99 100644
--- a/test/ssltest_old.c
+++ b/test/ssltest_old.c
@@ -852,11 +852,11 @@ static void print_details(SSL *c_ssl, const char *prefix)
SSL_CIPHER_get_version(ciph), SSL_CIPHER_get_name(ciph));
cert = SSL_get_peer_certificate(c_ssl);
if (cert != NULL) {
- pkey = X509_get_pubkey(cert);
- if (pkey != NULL) {
+ EVP_PKEY* pubkey = X509_get0_pubkey(cert);
+
+ if (pubkey != NULL) {
BIO_puts(bio_stdout, ", ");
- print_key_details(bio_stdout, pkey);
- EVP_PKEY_free(pkey);
+ print_key_details(bio_stdout, pubkey);
}
X509_free(cert);
}