summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/crl.c
diff options
context:
space:
mode:
authortb <>2021-10-31 16:47:27 +0000
committertb <>2021-10-31 16:47:27 +0000
commit9088131a0bf4a9930c61b7096992aa4e3fec2959 (patch)
tree3c9769bd20746b2b91b2bda913b17dee8a2a1288 /src/usr.bin/openssl/crl.c
parent5975302da7b3560abf4c50749b73f63f7772d1b6 (diff)
downloadopenbsd-9088131a0bf4a9930c61b7096992aa4e3fec2959.tar.gz
openbsd-9088131a0bf4a9930c61b7096992aa4e3fec2959.tar.bz2
openbsd-9088131a0bf4a9930c61b7096992aa4e3fec2959.zip
Various minor adjustments to make openssl(1) compile with opaque
structs in X509.
Diffstat (limited to 'src/usr.bin/openssl/crl.c')
-rw-r--r--src/usr.bin/openssl/crl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/crl.c b/src/usr.bin/openssl/crl.c
index ff64c62152..031360854c 100644
--- a/src/usr.bin/openssl/crl.c
+++ b/src/usr.bin/openssl/crl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crl.c,v 1.14 2021/10/23 14:49:39 tb Exp $ */ 1/* $OpenBSD: crl.c,v 1.15 2021/10/31 16:47:27 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 *
@@ -225,7 +225,7 @@ crl_main(int argc, char **argv)
225 X509_STORE *store = NULL; 225 X509_STORE *store = NULL;
226 X509_STORE_CTX *ctx = NULL; 226 X509_STORE_CTX *ctx = NULL;
227 X509_LOOKUP *lookup = NULL; 227 X509_LOOKUP *lookup = NULL;
228 X509_OBJECT xobj; 228 X509_OBJECT *xobj = NULL;
229 EVP_PKEY *pkey; 229 EVP_PKEY *pkey;
230 const EVP_MD *digest; 230 const EVP_MD *digest;
231 char *digest_name = NULL; 231 char *digest_name = NULL;
@@ -302,6 +302,8 @@ crl_main(int argc, char **argv)
302 302
303 if ((ctx = X509_STORE_CTX_new()) == NULL) 303 if ((ctx = X509_STORE_CTX_new()) == NULL)
304 goto end; 304 goto end;
305 if ((xobj = X509_OBJECT_new()) == NULL)
306 goto end;
305 307
306 if (!X509_STORE_CTX_init(ctx, store, NULL, NULL)) { 308 if (!X509_STORE_CTX_init(ctx, store, NULL, NULL)) {
307 BIO_printf(bio_err, 309 BIO_printf(bio_err,
@@ -309,14 +311,15 @@ crl_main(int argc, char **argv)
309 goto end; 311 goto end;
310 } 312 }
311 i = X509_STORE_get_by_subject(ctx, X509_LU_X509, 313 i = X509_STORE_get_by_subject(ctx, X509_LU_X509,
312 X509_CRL_get_issuer(x), &xobj); 314 X509_CRL_get_issuer(x), xobj);
313 if (i <= 0) { 315 if (i <= 0) {
314 BIO_printf(bio_err, 316 BIO_printf(bio_err,
315 "Error getting CRL issuer certificate\n"); 317 "Error getting CRL issuer certificate\n");
316 goto end; 318 goto end;
317 } 319 }
318 pkey = X509_get_pubkey(X509_OBJECT_get0_X509(&xobj)); 320 pkey = X509_get_pubkey(X509_OBJECT_get0_X509(xobj));
319 X509_OBJECT_free_contents(&xobj); 321 X509_OBJECT_free(xobj);
322 xobj = NULL;
320 if (!pkey) { 323 if (!pkey) {
321 BIO_printf(bio_err, 324 BIO_printf(bio_err,
322 "Error getting CRL issuer public key\n"); 325 "Error getting CRL issuer public key\n");
@@ -436,6 +439,7 @@ crl_main(int argc, char **argv)
436 X509_CRL_free(x); 439 X509_CRL_free(x);
437 X509_STORE_CTX_free(ctx); 440 X509_STORE_CTX_free(ctx);
438 X509_STORE_free(store); 441 X509_STORE_free(store);
442 X509_OBJECT_free(xobj);
439 443
440 return (ret); 444 return (ret);
441} 445}