summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-10-23 14:49:39 +0000
committertb <>2021-10-23 14:49:39 +0000
commit0636e301829f8bb433caf6702aa41f3c467a6423 (patch)
tree7b2bf72ba0421d2d2c6ea171117842b7c7b7d74d /src
parentbbbf84f2ed93d2384ef90bd8529a667c3f8cbc46 (diff)
downloadopenbsd-0636e301829f8bb433caf6702aa41f3c467a6423.tar.gz
openbsd-0636e301829f8bb433caf6702aa41f3c467a6423.tar.bz2
openbsd-0636e301829f8bb433caf6702aa41f3c467a6423.zip
Prepare crl.c for opaque structs in libcrypto.
ok beck jsing
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/crl.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/usr.bin/openssl/crl.c b/src/usr.bin/openssl/crl.c
index fc189f4c3f..ff64c62152 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.13 2019/07/14 03:30:45 guenther Exp $ */ 1/* $OpenBSD: crl.c,v 1.14 2021/10/23 14:49:39 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 *
@@ -223,7 +223,7 @@ crl_main(int argc, char **argv)
223 int ret = 1, i; 223 int ret = 1, i;
224 BIO *out = NULL; 224 BIO *out = NULL;
225 X509_STORE *store = NULL; 225 X509_STORE *store = NULL;
226 X509_STORE_CTX ctx; 226 X509_STORE_CTX *ctx = NULL;
227 X509_LOOKUP *lookup = NULL; 227 X509_LOOKUP *lookup = NULL;
228 X509_OBJECT xobj; 228 X509_OBJECT xobj;
229 EVP_PKEY *pkey; 229 EVP_PKEY *pkey;
@@ -281,6 +281,8 @@ crl_main(int argc, char **argv)
281 281
282 if (crl_config.verify) { 282 if (crl_config.verify) {
283 store = X509_STORE_new(); 283 store = X509_STORE_new();
284 if (store == NULL)
285 goto end;
284 lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); 286 lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
285 if (lookup == NULL) 287 if (lookup == NULL)
286 goto end; 288 goto end;
@@ -298,19 +300,22 @@ crl_main(int argc, char **argv)
298 X509_FILETYPE_DEFAULT); 300 X509_FILETYPE_DEFAULT);
299 ERR_clear_error(); 301 ERR_clear_error();
300 302
301 if (!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) { 303 if ((ctx = X509_STORE_CTX_new()) == NULL)
304 goto end;
305
306 if (!X509_STORE_CTX_init(ctx, store, NULL, NULL)) {
302 BIO_printf(bio_err, 307 BIO_printf(bio_err,
303 "Error initialising X509 store\n"); 308 "Error initialising X509 store\n");
304 goto end; 309 goto end;
305 } 310 }
306 i = X509_STORE_get_by_subject(&ctx, X509_LU_X509, 311 i = X509_STORE_get_by_subject(ctx, X509_LU_X509,
307 X509_CRL_get_issuer(x), &xobj); 312 X509_CRL_get_issuer(x), &xobj);
308 if (i <= 0) { 313 if (i <= 0) {
309 BIO_printf(bio_err, 314 BIO_printf(bio_err,
310 "Error getting CRL issuer certificate\n"); 315 "Error getting CRL issuer certificate\n");
311 goto end; 316 goto end;
312 } 317 }
313 pkey = X509_get_pubkey(xobj.data.x509); 318 pkey = X509_get_pubkey(X509_OBJECT_get0_X509(&xobj));
314 X509_OBJECT_free_contents(&xobj); 319 X509_OBJECT_free_contents(&xobj);
315 if (!pkey) { 320 if (!pkey) {
316 BIO_printf(bio_err, 321 BIO_printf(bio_err,
@@ -429,10 +434,8 @@ crl_main(int argc, char **argv)
429 BIO_free_all(bio_out); 434 BIO_free_all(bio_out);
430 bio_out = NULL; 435 bio_out = NULL;
431 X509_CRL_free(x); 436 X509_CRL_free(x);
432 if (store) { 437 X509_STORE_CTX_free(ctx);
433 X509_STORE_CTX_cleanup(&ctx); 438 X509_STORE_free(store);
434 X509_STORE_free(store);
435 }
436 439
437 return (ret); 440 return (ret);
438} 441}