summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2021-10-31 16:20:37 +0000
committertb <>2021-10-31 16:20:37 +0000
commit58a62c3b9192355c355017eb66b7107975796833 (patch)
tree026e9449ccb2e602b74681bacc0c5ffc068c677d /src/lib
parentffa34fcb9fe3bc69390b8f4cebf181d753feed2b (diff)
downloadopenbsd-58a62c3b9192355c355017eb66b7107975796833.tar.gz
openbsd-58a62c3b9192355c355017eb66b7107975796833.tar.bz2
openbsd-58a62c3b9192355c355017eb66b7107975796833.zip
Switch various X509 API to use the new X509_LOOKUP_TYPE to match
OpenSSL's signatures. ok beck inoguchi jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_lu.c31
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.h30
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
134int 134int
135X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, 135X509_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
145int 145int
146X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, 146X509_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
155int 155int
156X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, 156X509_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
164int 164int
165X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, const char *str, int len, 165X509_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
324int 324int
325X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, 325X509_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
474int 474X509_LOOKUP_TYPE
475X509_OBJECT_get_type(const X509_OBJECT *a) 475X509_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
493static int 493static int
494x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name, 494x509_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
537int 537int
538X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, X509_NAME *name) 538X509_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
543X509_OBJECT * 544X509_OBJECT *
544X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type, 545X509_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);
437X509_OBJECT *X509_OBJECT_new(void); 437X509_OBJECT *X509_OBJECT_new(void);
438void X509_OBJECT_free(X509_OBJECT *a); 438void X509_OBJECT_free(X509_OBJECT *a);
439#endif 439#endif
440int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, 440int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
441 X509_NAME *name); 441 X509_NAME *name);
442X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); 442X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
443 X509_LOOKUP_TYPE type, X509_NAME *name);
443X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); 444X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
444int X509_OBJECT_up_ref_count(X509_OBJECT *a); 445int X509_OBJECT_up_ref_count(X509_OBJECT *a);
445int X509_OBJECT_get_type(const X509_OBJECT *a); 446X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a);
446void X509_OBJECT_free_contents(X509_OBJECT *a); 447void X509_OBJECT_free_contents(X509_OBJECT *a);
447X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo); 448X509 *X509_OBJECT_get0_X509(const X509_OBJECT *xo);
448X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo); 449X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *xo);
@@ -496,8 +497,9 @@ X509_LOOKUP_METHOD *X509_LOOKUP_mem(void);
496int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); 497int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
497int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); 498int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
498 499
499int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, 500int 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
502int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, 504int 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);
510X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); 512X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
511void X509_LOOKUP_free(X509_LOOKUP *ctx); 513void X509_LOOKUP_free(X509_LOOKUP *ctx);
512int X509_LOOKUP_init(X509_LOOKUP *ctx); 514int X509_LOOKUP_init(X509_LOOKUP *ctx);
513int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, 515int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
514 X509_OBJECT *ret); 516 X509_NAME *name, X509_OBJECT *ret);
515int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, 517int 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);
517int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, 519int 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);
519int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, const char *str, 521int 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);
521int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); 523int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
522 524
523int X509_STORE_load_locations (X509_STORE *ctx, 525int X509_STORE_load_locations (X509_STORE *ctx,