summaryrefslogtreecommitdiffstats
path: root/apps/x509.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-12-14 13:13:32 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-12-14 23:06:14 +0000
commitc01ff880d47392b82cce2f93ac4a9bb8c68f8cc7 (patch)
tree5d4bfc88099fab5f8178b3cdfee4e8f4db2ad68d /apps/x509.c
parent2872dbe1c46eceb20c38bc55a5fe2a4c4c52fe9d (diff)
New function X509_get0_pubkey
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'apps/x509.c')
-rw-r--r--apps/x509.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/apps/x509.c b/apps/x509.c
index 7155b33246..1677ba5fda 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -723,7 +723,7 @@ int x509_main(int argc, char **argv)
} else if (modulus == i) {
EVP_PKEY *pkey;
- pkey = X509_get_pubkey(x);
+ pkey = X509_get0_pubkey(x);
if (pkey == NULL) {
BIO_printf(bio_err, "Modulus=unavailable\n");
ERR_print_errors(bio_err);
@@ -742,18 +742,16 @@ int x509_main(int argc, char **argv)
#endif
BIO_printf(out, "Wrong Algorithm type");
BIO_printf(out, "\n");
- EVP_PKEY_free(pkey);
} else if (pubkey == i) {
EVP_PKEY *pkey;
- pkey = X509_get_pubkey(x);
+ pkey = X509_get0_pubkey(x);
if (pkey == NULL) {
BIO_printf(bio_err, "Error getting public key\n");
ERR_print_errors(bio_err);
goto end;
}
PEM_write_bio_PUBKEY(out, pkey);
- EVP_PKEY_free(pkey);
} else if (C == i) {
unsigned char *d;
char *m;
@@ -991,9 +989,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
X509_STORE_CTX xsc;
EVP_PKEY *upkey;
- upkey = X509_get_pubkey(xca);
+ upkey = X509_get0_pubkey(xca);
EVP_PKEY_copy_parameters(upkey, pkey);
- EVP_PKEY_free(upkey);
if (!X509_STORE_CTX_init(&xsc, ctx, x, NULL)) {
BIO_printf(bio_err, "Error initialising X509 store\n");