diff options
author | tb <> | 2021-12-12 20:29:15 +0000 |
---|---|---|
committer | tb <> | 2021-12-12 20:29:15 +0000 |
commit | 5b598f42c0c982dd743e932a1f79bd651cd6fda8 (patch) | |
tree | b52a905a4ab566d2479e6ae55844ce805857bcda /src | |
parent | 6a16a9c80a0d29a10f70a0ba34a26914a1171284 (diff) | |
download | openbsd-5b598f42c0c982dd743e932a1f79bd651cd6fda8.tar.gz openbsd-5b598f42c0c982dd743e932a1f79bd651cd6fda8.tar.bz2 openbsd-5b598f42c0c982dd743e932a1f79bd651cd6fda8.zip |
Simplify x509.c slightly by using X509_get0_pubkey() instead of
X509_get_pubkey()
ok inoguchi
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/x509.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c index 38838729af..5248c67886 100644 --- a/src/usr.bin/openssl/x509.c +++ b/src/usr.bin/openssl/x509.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509.c,v 1.27 2021/12/12 20:28:02 tb Exp $ */ | 1 | /* $OpenBSD: x509.c,v 1.28 2021/12/12 20:29:15 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1045,7 +1045,7 @@ x509_main(int argc, char **argv) | |||
1045 | } else if (x509_config.modulus == i) { | 1045 | } else if (x509_config.modulus == i) { |
1046 | EVP_PKEY *pkey; | 1046 | EVP_PKEY *pkey; |
1047 | 1047 | ||
1048 | pkey = X509_get_pubkey(x); | 1048 | pkey = X509_get0_pubkey(x); |
1049 | if (pkey == NULL) { | 1049 | if (pkey == NULL) { |
1050 | BIO_printf(bio_err, | 1050 | BIO_printf(bio_err, |
1051 | "Modulus=unavailable\n"); | 1051 | "Modulus=unavailable\n"); |
@@ -1070,11 +1070,10 @@ x509_main(int argc, char **argv) | |||
1070 | BIO_printf(STDout, | 1070 | BIO_printf(STDout, |
1071 | "Wrong Algorithm type"); | 1071 | "Wrong Algorithm type"); |
1072 | BIO_printf(STDout, "\n"); | 1072 | BIO_printf(STDout, "\n"); |
1073 | EVP_PKEY_free(pkey); | ||
1074 | } else if (x509_config.pubkey == i) { | 1073 | } else if (x509_config.pubkey == i) { |
1075 | EVP_PKEY *pkey; | 1074 | EVP_PKEY *pkey; |
1076 | 1075 | ||
1077 | pkey = X509_get_pubkey(x); | 1076 | pkey = X509_get0_pubkey(x); |
1078 | if (pkey == NULL) { | 1077 | if (pkey == NULL) { |
1079 | BIO_printf(bio_err, | 1078 | BIO_printf(bio_err, |
1080 | "Error getting public key\n"); | 1079 | "Error getting public key\n"); |
@@ -1082,7 +1081,6 @@ x509_main(int argc, char **argv) | |||
1082 | goto end; | 1081 | goto end; |
1083 | } | 1082 | } |
1084 | PEM_write_bio_PUBKEY(STDout, pkey); | 1083 | PEM_write_bio_PUBKEY(STDout, pkey); |
1085 | EVP_PKEY_free(pkey); | ||
1086 | } else if (x509_config.C == i) { | 1084 | } else if (x509_config.C == i) { |
1087 | unsigned char *d; | 1085 | unsigned char *d; |
1088 | char *m; | 1086 | char *m; |