diff options
author | tb <> | 2021-10-31 16:47:27 +0000 |
---|---|---|
committer | tb <> | 2021-10-31 16:47:27 +0000 |
commit | 9088131a0bf4a9930c61b7096992aa4e3fec2959 (patch) | |
tree | 3c9769bd20746b2b91b2bda913b17dee8a2a1288 | |
parent | 5975302da7b3560abf4c50749b73f63f7772d1b6 (diff) | |
download | openbsd-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 '')
-rw-r--r-- | src/usr.bin/openssl/crl.c | 14 | ||||
-rw-r--r-- | src/usr.bin/openssl/pkcs12.c | 7 | ||||
-rw-r--r-- | src/usr.bin/openssl/s_server.c | 14 |
3 files changed, 23 insertions, 12 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 | } |
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c index 4d5c0bbf21..e1a89211c0 100644 --- a/src/usr.bin/openssl/pkcs12.c +++ b/src/usr.bin/openssl/pkcs12.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs12.c,v 1.15 2021/10/23 14:48:33 tb Exp $ */ | 1 | /* $OpenBSD: pkcs12.c,v 1.16 2021/10/31 16:47:27 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -905,8 +905,11 @@ dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, | |||
905 | 905 | ||
906 | case NID_pkcs8ShroudedKeyBag: | 906 | case NID_pkcs8ShroudedKeyBag: |
907 | if (options & INFO) { | 907 | if (options & INFO) { |
908 | const X509_ALGOR *tp8alg; | ||
909 | |||
908 | BIO_printf(bio_err, "Shrouded Keybag: "); | 910 | BIO_printf(bio_err, "Shrouded Keybag: "); |
909 | alg_print(bio_err, bag->value.shkeybag->algor); | 911 | X509_SIG_get0(bag->value.shkeybag, &tp8alg, NULL); |
912 | alg_print(bio_err, tp8alg); | ||
910 | } | 913 | } |
911 | if (options & NOKEYS) | 914 | if (options & NOKEYS) |
912 | return 1; | 915 | return 1; |
diff --git a/src/usr.bin/openssl/s_server.c b/src/usr.bin/openssl/s_server.c index 84fb114292..233b8fdced 100644 --- a/src/usr.bin/openssl/s_server.c +++ b/src/usr.bin/openssl/s_server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_server.c,v 1.52 2021/10/23 14:52:51 tb Exp $ */ | 1 | /* $OpenBSD: s_server.c,v 1.53 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 | * |
@@ -2337,7 +2337,7 @@ cert_status_cb(SSL *s, void *arg) | |||
2337 | STACK_OF(OPENSSL_STRING) *aia = NULL; | 2337 | STACK_OF(OPENSSL_STRING) *aia = NULL; |
2338 | X509 *x = NULL; | 2338 | X509 *x = NULL; |
2339 | X509_STORE_CTX *inctx = NULL; | 2339 | X509_STORE_CTX *inctx = NULL; |
2340 | X509_OBJECT obj; | 2340 | X509_OBJECT *obj = NULL; |
2341 | OCSP_REQUEST *req = NULL; | 2341 | OCSP_REQUEST *req = NULL; |
2342 | OCSP_RESPONSE *resp = NULL; | 2342 | OCSP_RESPONSE *resp = NULL; |
2343 | OCSP_CERTID *id = NULL; | 2343 | OCSP_CERTID *id = NULL; |
@@ -2378,8 +2378,10 @@ cert_status_cb(SSL *s, void *arg) | |||
2378 | SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), | 2378 | SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), |
2379 | NULL, NULL)) | 2379 | NULL, NULL)) |
2380 | goto err; | 2380 | goto err; |
2381 | if ((obj = X509_OBJECT_new()) == NULL) | ||
2382 | goto done; | ||
2381 | if (X509_STORE_get_by_subject(inctx, X509_LU_X509, | 2383 | if (X509_STORE_get_by_subject(inctx, X509_LU_X509, |
2382 | X509_get_issuer_name(x), &obj) <= 0) { | 2384 | X509_get_issuer_name(x), obj) <= 0) { |
2383 | BIO_puts(err, | 2385 | BIO_puts(err, |
2384 | "cert_status: Can't retrieve issuer certificate.\n"); | 2386 | "cert_status: Can't retrieve issuer certificate.\n"); |
2385 | X509_STORE_CTX_cleanup(inctx); | 2387 | X509_STORE_CTX_cleanup(inctx); |
@@ -2388,8 +2390,9 @@ cert_status_cb(SSL *s, void *arg) | |||
2388 | req = OCSP_REQUEST_new(); | 2390 | req = OCSP_REQUEST_new(); |
2389 | if (!req) | 2391 | if (!req) |
2390 | goto err; | 2392 | goto err; |
2391 | id = OCSP_cert_to_id(NULL, x, X509_OBJECT_get0_X509(&obj)); | 2393 | id = OCSP_cert_to_id(NULL, x, X509_OBJECT_get0_X509(obj)); |
2392 | X509_OBJECT_free_contents(&obj); | 2394 | X509_OBJECT_free(obj); |
2395 | obj = NULL; | ||
2393 | X509_STORE_CTX_free(inctx); | 2396 | X509_STORE_CTX_free(inctx); |
2394 | inctx = NULL; | 2397 | inctx = NULL; |
2395 | if (!id) | 2398 | if (!id) |
@@ -2421,6 +2424,7 @@ cert_status_cb(SSL *s, void *arg) | |||
2421 | ret = SSL_TLSEXT_ERR_OK; | 2424 | ret = SSL_TLSEXT_ERR_OK; |
2422 | done: | 2425 | done: |
2423 | X509_STORE_CTX_free(inctx); | 2426 | X509_STORE_CTX_free(inctx); |
2427 | X509_OBJECT_free(obj); | ||
2424 | if (ret != SSL_TLSEXT_ERR_OK) | 2428 | if (ret != SSL_TLSEXT_ERR_OK) |
2425 | ERR_print_errors(err); | 2429 | ERR_print_errors(err); |
2426 | if (aia) { | 2430 | if (aia) { |