From ba5f3a736e448ad0913d610e52768879025dc9b1 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 12 Dec 2021 20:29:15 +0000 Subject: [PATCH] Simplify x509.c slightly by using X509_get0_pubkey() instead of X509_get_pubkey() ok inoguchi --- usr.bin/openssl/x509.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/usr.bin/openssl/x509.c b/usr.bin/openssl/x509.c index 38838729afd..5248c678868 100644 --- a/usr.bin/openssl/x509.c +++ b/usr.bin/openssl/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.27 2021/12/12 20:28:02 tb Exp $ */ +/* $OpenBSD: x509.c,v 1.28 2021/12/12 20:29:15 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1045,7 +1045,7 @@ x509_main(int argc, char **argv) } else if (x509_config.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"); @@ -1070,11 +1070,10 @@ x509_main(int argc, char **argv) BIO_printf(STDout, "Wrong Algorithm type"); BIO_printf(STDout, "\n"); - EVP_PKEY_free(pkey); } else if (x509_config.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"); @@ -1082,7 +1081,6 @@ x509_main(int argc, char **argv) goto end; } PEM_write_bio_PUBKEY(STDout, pkey); - EVP_PKEY_free(pkey); } else if (x509_config.C == i) { unsigned char *d; char *m; -- 2.20.1