diff options
author | tb <> | 2023-04-16 08:30:21 +0000 |
---|---|---|
committer | tb <> | 2023-04-16 08:30:21 +0000 |
commit | bf613b30d54cf44f466a8bbcadeac93dbe63512f (patch) | |
tree | 1a6f82b024ec538bd602323e462b30de63a97335 /src/lib | |
parent | 5155e77c7b0c5d2688974520972a5bae814d3d03 (diff) | |
download | openbsd-bf613b30d54cf44f466a8bbcadeac93dbe63512f.tar.gz openbsd-bf613b30d54cf44f466a8bbcadeac93dbe63512f.tar.bz2 openbsd-bf613b30d54cf44f466a8bbcadeac93dbe63512f.zip |
Prepare addition of X509_STORE_CTX_get1_{certs,crls}(3)
X509_STORE_get1_{certs,crls}(3) was added to the OpenSSL 1.1 API with the
usual care. At some point later it was noticed that they didn't deal with
an X509_STORE at all, but rather with an X509_STORE_CTX, so were misnamed.
The fact that X509_STORE_CTX and X509_STORE have their roles reversed when
compared to other FOO vs FOO_CTX in this API may or may not be related.
Anyway, the X509_STORE versions will be demoted to compat defines and the
X509_STORE_CTX will be added to match OpenSSL 1.1 API more closely. This
was pointed out by schwarze a long time ago and missed in a few bumps.
Hopefully we'll manage to do it this time around.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/x509/x509_lu.c | 20 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 9 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index 65d11d9107..584251d18f 100644 --- a/src/lib/libcrypto/x509/x509_lu.c +++ b/src/lib/libcrypto/x509/x509_lu.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_lu.c,v 1.58 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: x509_lu.c,v 1.59 2023/04/16 08:30:21 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 | * |
@@ -593,8 +593,13 @@ X509_get1_certs_from_cache(X509_STORE *store, X509_NAME *name) | |||
593 | return NULL; | 593 | return NULL; |
594 | } | 594 | } |
595 | 595 | ||
596 | #if defined(LIBRESSL_NEXT_API) | ||
597 | STACK_OF(X509) * | ||
598 | X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) | ||
599 | #else | ||
596 | STACK_OF(X509) * | 600 | STACK_OF(X509) * |
597 | X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) | 601 | X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) |
602 | #endif | ||
598 | { | 603 | { |
599 | X509_STORE *store = ctx->store; | 604 | X509_STORE *store = ctx->store; |
600 | STACK_OF(X509) *sk; | 605 | STACK_OF(X509) *sk; |
@@ -614,10 +619,19 @@ X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *name) | |||
614 | 619 | ||
615 | return X509_get1_certs_from_cache(store, name); | 620 | return X509_get1_certs_from_cache(store, name); |
616 | } | 621 | } |
622 | #if defined(LIBRESSL_NEXT_API) | ||
623 | LCRYPTO_ALIAS(X509_STORE_CTX_get1_certs); | ||
624 | #else | ||
617 | LCRYPTO_ALIAS(X509_STORE_get1_certs); | 625 | LCRYPTO_ALIAS(X509_STORE_get1_certs); |
626 | #endif | ||
618 | 627 | ||
628 | #if defined(LIBRESSL_NEXT_API) | ||
629 | STACK_OF(X509_CRL) * | ||
630 | X509_STORE_CTX_get1_crls(X509_STORE_CTX *ctx, X509_NAME *name) | ||
631 | #else | ||
619 | STACK_OF(X509_CRL) * | 632 | STACK_OF(X509_CRL) * |
620 | X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *name) | 633 | X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *name) |
634 | #endif | ||
621 | { | 635 | { |
622 | X509_STORE *store = ctx->store; | 636 | X509_STORE *store = ctx->store; |
623 | STACK_OF(X509_CRL) *sk = NULL; | 637 | STACK_OF(X509_CRL) *sk = NULL; |
@@ -665,7 +679,11 @@ X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *name) | |||
665 | sk_X509_CRL_pop_free(sk, X509_CRL_free); | 679 | sk_X509_CRL_pop_free(sk, X509_CRL_free); |
666 | return NULL; | 680 | return NULL; |
667 | } | 681 | } |
682 | #if defined(LIBRESSL_NEXT_API) | ||
683 | LCRYPTO_ALIAS(X509_STORE_CTX_get1_crls); | ||
684 | #else | ||
668 | LCRYPTO_ALIAS(X509_STORE_get1_crls); | 685 | LCRYPTO_ALIAS(X509_STORE_get1_crls); |
686 | #endif | ||
669 | 687 | ||
670 | X509_OBJECT * | 688 | X509_OBJECT * |
671 | X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x) | 689 | X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x) |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index f5b103a0e7..3eb92b0f7f 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.h,v 1.59 2023/04/16 08:21:12 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.60 2023/04/16 08:30:21 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 | * |
@@ -285,8 +285,15 @@ X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo); | |||
285 | X509_STORE *X509_STORE_new(void); | 285 | X509_STORE *X509_STORE_new(void); |
286 | void X509_STORE_free(X509_STORE *v); | 286 | void X509_STORE_free(X509_STORE *v); |
287 | int X509_STORE_up_ref(X509_STORE *x); | 287 | int X509_STORE_up_ref(X509_STORE *x); |
288 | #if defined(LIBRESSL_NEXT_API) | ||
289 | #define X509_STORE_get1_certs X509_STORE_CTX_get1_certs | ||
290 | #define X509_STORE_get1_crls X509_STORE_CTX_get1_crls | ||
291 | STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); | ||
292 | STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); | ||
293 | #else | ||
288 | STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); | 294 | STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); |
289 | STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); | 295 | STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); |
296 | #endif | ||
290 | STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *xs); | 297 | STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *xs); |
291 | void *X509_STORE_get_ex_data(X509_STORE *xs, int idx); | 298 | void *X509_STORE_get_ex_data(X509_STORE *xs, int idx); |
292 | int X509_STORE_set_ex_data(X509_STORE *xs, int idx, void *data); | 299 | int X509_STORE_set_ex_data(X509_STORE *xs, int idx, void *data); |