diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_lu.c | 31 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 30 |
2 files changed, 32 insertions, 29 deletions
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index cd1c807f50..ee72e67d1a 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.34 2021/10/24 09:27:48 tb Exp $ */ | 1 | /* $OpenBSD: x509_lu.c,v 1.35 2021/10/31 16:20:37 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 | * |
| @@ -132,7 +132,7 @@ X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | int | 134 | int |
| 135 | X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, | 135 | X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, X509_NAME *name, |
| 136 | X509_OBJECT *ret) | 136 | X509_OBJECT *ret) |
| 137 | { | 137 | { |
| 138 | if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) | 138 | if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) |
| @@ -143,8 +143,8 @@ X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | int | 145 | int |
| 146 | X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, | 146 | X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 147 | ASN1_INTEGER *serial, X509_OBJECT *ret) | 147 | X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret) |
| 148 | { | 148 | { |
| 149 | if ((ctx->method == NULL) || | 149 | if ((ctx->method == NULL) || |
| 150 | (ctx->method->get_by_issuer_serial == NULL)) | 150 | (ctx->method->get_by_issuer_serial == NULL)) |
| @@ -153,7 +153,7 @@ X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | int | 155 | int |
| 156 | X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, | 156 | X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 157 | const unsigned char *bytes, int len, X509_OBJECT *ret) | 157 | const unsigned char *bytes, int len, X509_OBJECT *ret) |
| 158 | { | 158 | { |
| 159 | if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL)) | 159 | if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL)) |
| @@ -162,8 +162,8 @@ X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, | |||
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | int | 164 | int |
| 165 | X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, const char *str, int len, | 165 | X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const char *str, |
| 166 | X509_OBJECT *ret) | 166 | int len, X509_OBJECT *ret) |
| 167 | { | 167 | { |
| 168 | if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL)) | 168 | if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL)) |
| 169 | return 0; | 169 | return 0; |
| @@ -242,7 +242,7 @@ X509_OBJECT_new(void) | |||
| 242 | return NULL; | 242 | return NULL; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | ret->type = 0; | 245 | ret->type = X509_LU_NONE; |
| 246 | 246 | ||
| 247 | return ret; | 247 | return ret; |
| 248 | } | 248 | } |
| @@ -322,8 +322,8 @@ X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) | |||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | int | 324 | int |
| 325 | X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, | 325 | X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, |
| 326 | X509_OBJECT *ret) | 326 | X509_NAME *name, X509_OBJECT *ret) |
| 327 | { | 327 | { |
| 328 | X509_STORE *ctx = vs->ctx; | 328 | X509_STORE *ctx = vs->ctx; |
| 329 | X509_LOOKUP *lu; | 329 | X509_LOOKUP *lu; |
| @@ -471,7 +471,7 @@ X509_OBJECT_up_ref_count(X509_OBJECT *a) | |||
| 471 | return 1; | 471 | return 1; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | int | 474 | X509_LOOKUP_TYPE |
| 475 | X509_OBJECT_get_type(const X509_OBJECT *a) | 475 | X509_OBJECT_get_type(const X509_OBJECT *a) |
| 476 | { | 476 | { |
| 477 | return a->type; | 477 | return a->type; |
| @@ -491,8 +491,8 @@ X509_OBJECT_free_contents(X509_OBJECT *a) | |||
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | static int | 493 | static int |
| 494 | x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name, | 494 | x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, |
| 495 | int *pnmatch) | 495 | X509_NAME *name, int *pnmatch) |
| 496 | { | 496 | { |
| 497 | X509_OBJECT stmp; | 497 | X509_OBJECT stmp; |
| 498 | X509 x509_s; | 498 | X509 x509_s; |
| @@ -535,13 +535,14 @@ x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name, | |||
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | int | 537 | int |
| 538 | X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name) | 538 | X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, |
| 539 | X509_NAME *name) | ||
| 539 | { | 540 | { |
| 540 | return x509_object_idx_cnt(h, type, name, NULL); | 541 | return x509_object_idx_cnt(h, type, name, NULL); |
| 541 | } | 542 | } |
| 542 | 543 | ||
| 543 | X509_OBJECT * | 544 | X509_OBJECT * |
| 544 | X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 545 | X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, |
| 545 | X509_NAME *name) | 546 | X509_NAME *name) |
| 546 | { | 547 | { |
| 547 | int idx; | 548 | int idx; |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index ee6b9a614b..b78c857cdb 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.40 2021/10/31 16:17:14 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.41 2021/10/31 16:20:37 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 | * |
| @@ -437,12 +437,13 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
| 437 | X509_OBJECT *X509_OBJECT_new(void); | 437 | X509_OBJECT *X509_OBJECT_new(void); |
| 438 | void X509_OBJECT_free(X509_OBJECT *a); | 438 | void X509_OBJECT_free(X509_OBJECT *a); |
| 439 | #endif | 439 | #endif |
| 440 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 440 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, |
| 441 | X509_NAME *name); | 441 | X509_NAME *name); |
| 442 | X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); | 442 | X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, |
| 443 | X509_LOOKUP_TYPE type, X509_NAME *name); | ||
| 443 | X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); | 444 | X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); |
| 444 | int X509_OBJECT_up_ref_count(X509_OBJECT *a); | 445 | int X509_OBJECT_up_ref_count(X509_OBJECT *a); |
| 445 | int X509_OBJECT_get_type(const X509_OBJECT *a); | 446 | X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); |
| 446 | void X509_OBJECT_free_contents(X509_OBJECT *a); | 447 | void X509_OBJECT_free_contents(X509_OBJECT *a); |
| 447 | X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); | 448 | X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); |
| 448 | X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo); | 449 | X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo); |
| @@ -496,8 +497,9 @@ X509_LOOKUP_METHOD *X509_LOOKUP_mem(void); | |||
| 496 | int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); | 497 | int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); |
| 497 | int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); | 498 | int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); |
| 498 | 499 | ||
| 499 | int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, | 500 | int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, |
| 500 | X509_OBJECT *ret); | 501 | X509_NAME *name, X509_OBJECT *ret); |
| 502 | #define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject | ||
| 501 | 503 | ||
| 502 | int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, | 504 | int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, |
| 503 | long argl, char **ret); | 505 | long argl, char **ret); |
| @@ -510,14 +512,14 @@ int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); | |||
| 510 | X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); | 512 | X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); |
| 511 | void X509_LOOKUP_free(X509_LOOKUP *ctx); | 513 | void X509_LOOKUP_free(X509_LOOKUP *ctx); |
| 512 | int X509_LOOKUP_init(X509_LOOKUP *ctx); | 514 | int X509_LOOKUP_init(X509_LOOKUP *ctx); |
| 513 | int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, | 515 | int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 514 | X509_OBJECT *ret); | 516 | X509_NAME *name, X509_OBJECT *ret); |
| 515 | int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, | 517 | int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 516 | ASN1_INTEGER *serial, X509_OBJECT *ret); | 518 | X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret); |
| 517 | int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, | 519 | int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 518 | const unsigned char *bytes, int len, X509_OBJECT *ret); | 520 | const unsigned char *bytes, int len, X509_OBJECT *ret); |
| 519 | int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, const char *str, | 521 | int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 520 | int len, X509_OBJECT *ret); | 522 | const char *str, int len, X509_OBJECT *ret); |
| 521 | int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); | 523 | int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); |
| 522 | 524 | ||
| 523 | int X509_STORE_load_locations (X509_STORE *ctx, | 525 | int X509_STORE_load_locations (X509_STORE *ctx, |
