2 * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 #include "internal/cryptlib.h"
12 #include "internal/refcount.h"
13 #include <openssl/x509.h>
14 #include "crypto/x509.h"
15 #include <openssl/x509v3.h>
16 #include "x509_local.h"
18 X509_LOOKUP
*X509_LOOKUP_new(X509_LOOKUP_METHOD
*method
)
20 X509_LOOKUP
*ret
= OPENSSL_zalloc(sizeof(*ret
));
23 X509err(X509_F_X509_LOOKUP_NEW
, ERR_R_MALLOC_FAILURE
);
28 if (method
->new_item
!= NULL
&& method
->new_item(ret
) == 0) {
35 void X509_LOOKUP_free(X509_LOOKUP
*ctx
)
39 if ((ctx
->method
!= NULL
) && (ctx
->method
->free
!= NULL
))
40 (*ctx
->method
->free
) (ctx
);
44 int X509_STORE_lock(X509_STORE
*s
)
46 return CRYPTO_THREAD_write_lock(s
->lock
);
49 int X509_STORE_unlock(X509_STORE
*s
)
51 return CRYPTO_THREAD_unlock(s
->lock
);
54 int X509_LOOKUP_init(X509_LOOKUP
*ctx
)
56 if (ctx
->method
== NULL
)
58 if (ctx
->method
->init
!= NULL
)
59 return ctx
->method
->init(ctx
);
64 int X509_LOOKUP_shutdown(X509_LOOKUP
*ctx
)
66 if (ctx
->method
== NULL
)
68 if (ctx
->method
->shutdown
!= NULL
)
69 return ctx
->method
->shutdown(ctx
);
74 int X509_LOOKUP_ctrl(X509_LOOKUP
*ctx
, int cmd
, const char *argc
, long argl
,
77 if (ctx
->method
== NULL
)
79 if (ctx
->method
->ctrl
!= NULL
)
80 return ctx
->method
->ctrl(ctx
, cmd
, argc
, argl
, ret
);
85 int X509_LOOKUP_by_subject(X509_LOOKUP
*ctx
, X509_LOOKUP_TYPE type
,
86 const X509_NAME
*name
, X509_OBJECT
*ret
)
88 if ((ctx
->method
== NULL
) || (ctx
->method
->get_by_subject
== NULL
))
92 return ctx
->method
->get_by_subject(ctx
, type
, name
, ret
);
95 int X509_LOOKUP_by_issuer_serial(X509_LOOKUP
*ctx
, X509_LOOKUP_TYPE type
,
96 const X509_NAME
*name
,
97 const ASN1_INTEGER
*serial
,
100 if ((ctx
->method
== NULL
) || (ctx
->method
->get_by_issuer_serial
== NULL
))
102 return ctx
->method
->get_by_issuer_serial(ctx
, type
, name
, serial
, ret
);
105 int X509_LOOKUP_by_fingerprint(X509_LOOKUP
*ctx
, X509_LOOKUP_TYPE type
,
106 const unsigned char *bytes
, int len
,
109 if ((ctx
->method
== NULL
) || (ctx
->method
->get_by_fingerprint
== NULL
))
111 return ctx
->method
->get_by_fingerprint(ctx
, type
, bytes
, len
, ret
);
114 int X509_LOOKUP_by_alias(X509_LOOKUP
*ctx
, X509_LOOKUP_TYPE type
,
115 const char *str
, int len
, X509_OBJECT
*ret
)
117 if ((ctx
->method
== NULL
) || (ctx
->method
->get_by_alias
== NULL
))
119 return ctx
->method
->get_by_alias(ctx
, type
, str
, len
, ret
);
122 int X509_LOOKUP_set_method_data(X509_LOOKUP
*ctx
, void *data
)
124 ctx
->method_data
= data
;
128 void *X509_LOOKUP_get_method_data(const X509_LOOKUP
*ctx
)
130 return ctx
->method_data
;
133 X509_STORE
*X509_LOOKUP_get_store(const X509_LOOKUP
*ctx
)
135 return ctx
->store_ctx
;
139 static int x509_object_cmp(const X509_OBJECT
*const *a
,
140 const X509_OBJECT
*const *b
)
144 ret
= ((*a
)->type
- (*b
)->type
);
147 switch ((*a
)->type
) {
149 ret
= X509_subject_name_cmp((*a
)->data
.x509
, (*b
)->data
.x509
);
152 ret
= X509_CRL_cmp((*a
)->data
.crl
, (*b
)->data
.crl
);
161 X509_STORE
*X509_STORE_new(void)
163 X509_STORE
*ret
= OPENSSL_zalloc(sizeof(*ret
));
166 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
169 if ((ret
->objs
= sk_X509_OBJECT_new(x509_object_cmp
)) == NULL
) {
170 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
174 if ((ret
->get_cert_methods
= sk_X509_LOOKUP_new_null()) == NULL
) {
175 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
179 if ((ret
->param
= X509_VERIFY_PARAM_new()) == NULL
) {
180 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
183 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE
, ret
, &ret
->ex_data
)) {
184 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
188 ret
->lock
= CRYPTO_THREAD_lock_new();
189 if (ret
->lock
== NULL
) {
190 X509err(X509_F_X509_STORE_NEW
, ERR_R_MALLOC_FAILURE
);
198 X509_VERIFY_PARAM_free(ret
->param
);
199 sk_X509_OBJECT_free(ret
->objs
);
200 sk_X509_LOOKUP_free(ret
->get_cert_methods
);
205 void X509_STORE_free(X509_STORE
*vfy
)
208 STACK_OF(X509_LOOKUP
) *sk
;
213 CRYPTO_DOWN_REF(&vfy
->references
, &i
, vfy
->lock
);
214 REF_PRINT_COUNT("X509_STORE", vfy
);
217 REF_ASSERT_ISNT(i
< 0);
219 sk
= vfy
->get_cert_methods
;
220 for (i
= 0; i
< sk_X509_LOOKUP_num(sk
); i
++) {
221 lu
= sk_X509_LOOKUP_value(sk
, i
);
222 X509_LOOKUP_shutdown(lu
);
223 X509_LOOKUP_free(lu
);
225 sk_X509_LOOKUP_free(sk
);
226 sk_X509_OBJECT_pop_free(vfy
->objs
, X509_OBJECT_free
);
228 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE
, vfy
, &vfy
->ex_data
);
229 X509_VERIFY_PARAM_free(vfy
->param
);
230 CRYPTO_THREAD_lock_free(vfy
->lock
);
234 int X509_STORE_up_ref(X509_STORE
*vfy
)
238 if (CRYPTO_UP_REF(&vfy
->references
, &i
, vfy
->lock
) <= 0)
241 REF_PRINT_COUNT("X509_STORE", vfy
);
242 REF_ASSERT_ISNT(i
< 2);
243 return ((i
> 1) ? 1 : 0);
246 X509_LOOKUP
*X509_STORE_add_lookup(X509_STORE
*v
, X509_LOOKUP_METHOD
*m
)
249 STACK_OF(X509_LOOKUP
) *sk
;
252 sk
= v
->get_cert_methods
;
253 for (i
= 0; i
< sk_X509_LOOKUP_num(sk
); i
++) {
254 lu
= sk_X509_LOOKUP_value(sk
, i
);
255 if (m
== lu
->method
) {
260 lu
= X509_LOOKUP_new(m
);
262 X509err(X509_F_X509_STORE_ADD_LOOKUP
, ERR_R_MALLOC_FAILURE
);
267 if (sk_X509_LOOKUP_push(v
->get_cert_methods
, lu
))
270 X509err(X509_F_X509_STORE_ADD_LOOKUP
, ERR_R_MALLOC_FAILURE
);
271 X509_LOOKUP_free(lu
);
275 X509_OBJECT
*X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX
*vs
,
276 X509_LOOKUP_TYPE type
,
277 const X509_NAME
*name
)
279 X509_OBJECT
*ret
= X509_OBJECT_new();
283 if (!X509_STORE_CTX_get_by_subject(vs
, type
, name
, ret
)) {
284 X509_OBJECT_free(ret
);
290 int X509_STORE_CTX_get_by_subject(const X509_STORE_CTX
*vs
,
291 X509_LOOKUP_TYPE type
,
292 const X509_NAME
*name
, X509_OBJECT
*ret
)
294 X509_STORE
*store
= vs
->store
;
296 X509_OBJECT stmp
, *tmp
;
302 stmp
.type
= X509_LU_NONE
;
303 stmp
.data
.ptr
= NULL
;
306 X509_STORE_lock(store
);
307 tmp
= X509_OBJECT_retrieve_by_subject(store
->objs
, type
, name
);
308 X509_STORE_unlock(store
);
310 if (tmp
== NULL
|| type
== X509_LU_CRL
) {
311 for (i
= 0; i
< sk_X509_LOOKUP_num(store
->get_cert_methods
); i
++) {
312 lu
= sk_X509_LOOKUP_value(store
->get_cert_methods
, i
);
313 j
= X509_LOOKUP_by_subject(lu
, type
, name
, &stmp
);
323 if (!X509_OBJECT_up_ref_count(tmp
))
326 ret
->type
= tmp
->type
;
327 ret
->data
.ptr
= tmp
->data
.ptr
;
332 static int x509_store_add(X509_STORE
*store
, void *x
, int crl
) {
334 int ret
= 0, added
= 0;
338 obj
= X509_OBJECT_new();
343 obj
->type
= X509_LU_CRL
;
344 obj
->data
.crl
= (X509_CRL
*)x
;
346 obj
->type
= X509_LU_X509
;
347 obj
->data
.x509
= (X509
*)x
;
349 if (!X509_OBJECT_up_ref_count(obj
)) {
350 obj
->type
= X509_LU_NONE
;
351 X509_OBJECT_free(obj
);
355 X509_STORE_lock(store
);
356 if (X509_OBJECT_retrieve_match(store
->objs
, obj
)) {
359 added
= sk_X509_OBJECT_push(store
->objs
, obj
);
362 X509_STORE_unlock(store
);
364 if (added
== 0) /* obj not pushed */
365 X509_OBJECT_free(obj
);
370 int X509_STORE_add_cert(X509_STORE
*ctx
, X509
*x
)
372 if (!x509_store_add(ctx
, x
, 0)) {
373 X509err(X509_F_X509_STORE_ADD_CERT
, ERR_R_MALLOC_FAILURE
);
379 int X509_STORE_add_crl(X509_STORE
*ctx
, X509_CRL
*x
)
381 if (!x509_store_add(ctx
, x
, 1)) {
382 X509err(X509_F_X509_STORE_ADD_CRL
, ERR_R_MALLOC_FAILURE
);
388 int X509_OBJECT_up_ref_count(X509_OBJECT
*a
)
394 return X509_up_ref(a
->data
.x509
);
396 return X509_CRL_up_ref(a
->data
.crl
);
401 X509
*X509_OBJECT_get0_X509(const X509_OBJECT
*a
)
403 if (a
== NULL
|| a
->type
!= X509_LU_X509
)
408 X509_CRL
*X509_OBJECT_get0_X509_CRL(const X509_OBJECT
*a
)
410 if (a
== NULL
|| a
->type
!= X509_LU_CRL
)
415 X509_LOOKUP_TYPE
X509_OBJECT_get_type(const X509_OBJECT
*a
)
420 X509_OBJECT
*X509_OBJECT_new(void)
422 X509_OBJECT
*ret
= OPENSSL_zalloc(sizeof(*ret
));
425 X509err(X509_F_X509_OBJECT_NEW
, ERR_R_MALLOC_FAILURE
);
428 ret
->type
= X509_LU_NONE
;
432 static void x509_object_free_internal(X509_OBJECT
*a
)
440 X509_free(a
->data
.x509
);
443 X509_CRL_free(a
->data
.crl
);
448 int X509_OBJECT_set1_X509(X509_OBJECT
*a
, X509
*obj
)
450 if (a
== NULL
|| !X509_up_ref(obj
))
453 x509_object_free_internal(a
);
454 a
->type
= X509_LU_X509
;
459 int X509_OBJECT_set1_X509_CRL(X509_OBJECT
*a
, X509_CRL
*obj
)
461 if (a
== NULL
|| !X509_CRL_up_ref(obj
))
464 x509_object_free_internal(a
);
465 a
->type
= X509_LU_CRL
;
470 void X509_OBJECT_free(X509_OBJECT
*a
)
472 x509_object_free_internal(a
);
476 static int x509_object_idx_cnt(STACK_OF(X509_OBJECT
) *h
, X509_LOOKUP_TYPE type
,
477 const X509_NAME
*name
, int *pnmatch
)
487 stmp
.data
.x509
= &x509_s
;
488 x509_s
.cert_info
.subject
= (X509_NAME
*)name
; /* won't modify it */
491 stmp
.data
.crl
= &crl_s
;
492 crl_s
.crl
.issuer
= (X509_NAME
*)name
; /* won't modify it */
499 idx
= sk_X509_OBJECT_find(h
, &stmp
);
500 if (idx
>= 0 && pnmatch
) {
502 const X509_OBJECT
*tobj
, *pstmp
;
505 for (tidx
= idx
+ 1; tidx
< sk_X509_OBJECT_num(h
); tidx
++) {
506 tobj
= sk_X509_OBJECT_value(h
, tidx
);
507 if (x509_object_cmp(&tobj
, &pstmp
))
515 int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT
) *h
, X509_LOOKUP_TYPE type
,
516 const X509_NAME
*name
)
518 return x509_object_idx_cnt(h
, type
, name
, NULL
);
521 X509_OBJECT
*X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT
) *h
,
522 X509_LOOKUP_TYPE type
,
523 const X509_NAME
*name
)
526 idx
= X509_OBJECT_idx_by_subject(h
, type
, name
);
529 return sk_X509_OBJECT_value(h
, idx
);
532 STACK_OF(X509_OBJECT
) *X509_STORE_get0_objects(const X509_STORE
*v
)
537 /* TODO param type could be constified as change to lock is intermittent */
538 STACK_OF(X509
) *X509_STORE_get1_all_certs(X509_STORE
*store
)
541 STACK_OF(X509_OBJECT
) *objs
;
545 X509err(0, ERR_R_PASSED_NULL_PARAMETER
);
548 if ((sk
= sk_X509_new_null()) == NULL
)
550 X509_STORE_lock(store
);
551 objs
= X509_STORE_get0_objects(store
);
552 for (i
= 0; i
< sk_X509_OBJECT_num(objs
); i
++) {
553 X509
*cert
= X509_OBJECT_get0_X509(sk_X509_OBJECT_value(objs
, i
));
556 if (!X509_up_ref(cert
))
558 if (!sk_X509_push(sk
, cert
)) {
564 X509_STORE_unlock(store
);
568 X509_STORE_unlock(store
);
569 sk_X509_pop_free(sk
, X509_free
);
573 STACK_OF(X509
) *X509_STORE_CTX_get1_certs(X509_STORE_CTX
*ctx
,
577 STACK_OF(X509
) *sk
= NULL
;
580 X509_STORE
*store
= ctx
->store
;
585 X509_STORE_lock(store
);
586 idx
= x509_object_idx_cnt(store
->objs
, X509_LU_X509
, nm
, &cnt
);
589 * Nothing found in cache: do lookup to possibly add new objects to
592 X509_OBJECT
*xobj
= X509_OBJECT_new();
594 X509_STORE_unlock(store
);
598 if (!X509_STORE_CTX_get_by_subject(ctx
, X509_LU_X509
, nm
, xobj
)) {
599 X509_OBJECT_free(xobj
);
602 X509_OBJECT_free(xobj
);
603 X509_STORE_lock(store
);
604 idx
= x509_object_idx_cnt(store
->objs
, X509_LU_X509
, nm
, &cnt
);
606 X509_STORE_unlock(store
);
611 sk
= sk_X509_new_null();
612 for (i
= 0; i
< cnt
; i
++, idx
++) {
613 obj
= sk_X509_OBJECT_value(store
->objs
, idx
);
615 if (!X509_up_ref(x
)) {
616 X509_STORE_unlock(store
);
617 sk_X509_pop_free(sk
, X509_free
);
620 if (!sk_X509_push(sk
, x
)) {
621 X509_STORE_unlock(store
);
623 sk_X509_pop_free(sk
, X509_free
);
627 X509_STORE_unlock(store
);
631 STACK_OF(X509_CRL
) *X509_STORE_CTX_get1_crls(const X509_STORE_CTX
*ctx
,
635 STACK_OF(X509_CRL
) *sk
= sk_X509_CRL_new_null();
637 X509_OBJECT
*obj
, *xobj
= X509_OBJECT_new();
638 X509_STORE
*store
= ctx
->store
;
640 /* Always do lookup to possibly add new CRLs to cache */
644 || !X509_STORE_CTX_get_by_subject(ctx
, X509_LU_CRL
, nm
, xobj
)) {
645 X509_OBJECT_free(xobj
);
646 sk_X509_CRL_free(sk
);
649 X509_OBJECT_free(xobj
);
650 X509_STORE_lock(store
);
651 idx
= x509_object_idx_cnt(store
->objs
, X509_LU_CRL
, nm
, &cnt
);
653 X509_STORE_unlock(store
);
654 sk_X509_CRL_free(sk
);
658 for (i
= 0; i
< cnt
; i
++, idx
++) {
659 obj
= sk_X509_OBJECT_value(store
->objs
, idx
);
661 if (!X509_CRL_up_ref(x
)) {
662 X509_STORE_unlock(store
);
663 sk_X509_CRL_pop_free(sk
, X509_CRL_free
);
666 if (!sk_X509_CRL_push(sk
, x
)) {
667 X509_STORE_unlock(store
);
669 sk_X509_CRL_pop_free(sk
, X509_CRL_free
);
673 X509_STORE_unlock(store
);
677 X509_OBJECT
*X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT
) *h
,
683 idx
= sk_X509_OBJECT_find(h
, x
);
686 if ((x
->type
!= X509_LU_X509
) && (x
->type
!= X509_LU_CRL
))
687 return sk_X509_OBJECT_value(h
, idx
);
688 for (i
= idx
, num
= sk_X509_OBJECT_num(h
); i
< num
; i
++) {
689 obj
= sk_X509_OBJECT_value(h
, i
);
690 if (x509_object_cmp((const X509_OBJECT
**)&obj
,
691 (const X509_OBJECT
**)&x
))
693 if (x
->type
== X509_LU_X509
) {
694 if (!X509_cmp(obj
->data
.x509
, x
->data
.x509
))
696 } else if (x
->type
== X509_LU_CRL
) {
697 if (!X509_CRL_match(obj
->data
.crl
, x
->data
.crl
))
706 * Try to get issuer certificate from store. Due to limitations
707 * of the API this can only retrieve a single certificate matching
708 * a given subject name. However it will fill the cache with all
709 * matching certificates, so we can examine the cache for all
713 * 1 lookup successful.
714 * 0 certificate not found.
715 * -1 some other error.
717 int X509_STORE_CTX_get1_issuer(X509
**issuer
, X509_STORE_CTX
*ctx
, X509
*x
)
720 X509_OBJECT
*obj
= X509_OBJECT_new(), *pobj
= NULL
;
721 X509_STORE
*store
= ctx
->store
;
727 xn
= X509_get_issuer_name(x
);
728 ok
= X509_STORE_CTX_get_by_subject(ctx
, X509_LU_X509
, xn
, obj
);
730 X509_OBJECT_free(obj
);
733 /* If certificate matches all OK */
734 if (ctx
->check_issued(ctx
, x
, obj
->data
.x509
)) {
735 if (x509_check_cert_time(ctx
, obj
->data
.x509
, -1)) {
736 *issuer
= obj
->data
.x509
;
737 if (!X509_up_ref(*issuer
)) {
741 X509_OBJECT_free(obj
);
745 X509_OBJECT_free(obj
);
750 /* Else find index of first cert accepted by 'check_issued' */
752 X509_STORE_lock(store
);
753 idx
= X509_OBJECT_idx_by_subject(store
->objs
, X509_LU_X509
, xn
);
754 if (idx
!= -1) { /* should be true as we've had at least one
756 /* Look through all matching certs for suitable issuer */
757 for (i
= idx
; i
< sk_X509_OBJECT_num(store
->objs
); i
++) {
758 pobj
= sk_X509_OBJECT_value(store
->objs
, i
);
759 /* See if we've run past the matches */
760 if (pobj
->type
!= X509_LU_X509
)
762 if (X509_NAME_cmp(xn
, X509_get_subject_name(pobj
->data
.x509
)))
764 if (ctx
->check_issued(ctx
, x
, pobj
->data
.x509
)) {
765 *issuer
= pobj
->data
.x509
;
768 * If times check, exit with match,
769 * otherwise keep looking. Leave last
770 * match in issuer so we return nearest
771 * match if no certificate time is OK.
774 if (x509_check_cert_time(ctx
, *issuer
, -1))
779 if (*issuer
&& !X509_up_ref(*issuer
)) {
783 X509_STORE_unlock(store
);
787 int X509_STORE_set_flags(X509_STORE
*ctx
, unsigned long flags
)
789 return X509_VERIFY_PARAM_set_flags(ctx
->param
, flags
);
792 int X509_STORE_set_depth(X509_STORE
*ctx
, int depth
)
794 X509_VERIFY_PARAM_set_depth(ctx
->param
, depth
);
798 int X509_STORE_set_purpose(X509_STORE
*ctx
, int purpose
)
800 return X509_VERIFY_PARAM_set_purpose(ctx
->param
, purpose
);
803 int X509_STORE_set_trust(X509_STORE
*ctx
, int trust
)
805 return X509_VERIFY_PARAM_set_trust(ctx
->param
, trust
);
808 int X509_STORE_set1_param(X509_STORE
*ctx
, const X509_VERIFY_PARAM
*param
)
810 return X509_VERIFY_PARAM_set1(ctx
->param
, param
);
813 X509_VERIFY_PARAM
*X509_STORE_get0_param(const X509_STORE
*ctx
)
818 void X509_STORE_set_verify(X509_STORE
*ctx
, X509_STORE_CTX_verify_fn verify
)
820 ctx
->verify
= verify
;
823 X509_STORE_CTX_verify_fn
X509_STORE_get_verify(const X509_STORE
*ctx
)
828 void X509_STORE_set_verify_cb(X509_STORE
*ctx
,
829 X509_STORE_CTX_verify_cb verify_cb
)
831 ctx
->verify_cb
= verify_cb
;
834 X509_STORE_CTX_verify_cb
X509_STORE_get_verify_cb(const X509_STORE
*ctx
)
836 return ctx
->verify_cb
;
839 void X509_STORE_set_get_issuer(X509_STORE
*ctx
,
840 X509_STORE_CTX_get_issuer_fn get_issuer
)
842 ctx
->get_issuer
= get_issuer
;
845 X509_STORE_CTX_get_issuer_fn
X509_STORE_get_get_issuer(const X509_STORE
*ctx
)
847 return ctx
->get_issuer
;
850 void X509_STORE_set_check_issued(X509_STORE
*ctx
,
851 X509_STORE_CTX_check_issued_fn check_issued
)
853 ctx
->check_issued
= check_issued
;
856 X509_STORE_CTX_check_issued_fn
X509_STORE_get_check_issued(const X509_STORE
*ctx
)
858 return ctx
->check_issued
;
861 void X509_STORE_set_check_revocation(X509_STORE
*ctx
,
862 X509_STORE_CTX_check_revocation_fn check_revocation
)
864 ctx
->check_revocation
= check_revocation
;
867 X509_STORE_CTX_check_revocation_fn
X509_STORE_get_check_revocation(const X509_STORE
*ctx
)
869 return ctx
->check_revocation
;
872 void X509_STORE_set_get_crl(X509_STORE
*ctx
,
873 X509_STORE_CTX_get_crl_fn get_crl
)
875 ctx
->get_crl
= get_crl
;
878 X509_STORE_CTX_get_crl_fn
X509_STORE_get_get_crl(const X509_STORE
*ctx
)
883 void X509_STORE_set_check_crl(X509_STORE
*ctx
,
884 X509_STORE_CTX_check_crl_fn check_crl
)
886 ctx
->check_crl
= check_crl
;
889 X509_STORE_CTX_check_crl_fn
X509_STORE_get_check_crl(const X509_STORE
*ctx
)
891 return ctx
->check_crl
;
894 void X509_STORE_set_cert_crl(X509_STORE
*ctx
,
895 X509_STORE_CTX_cert_crl_fn cert_crl
)
897 ctx
->cert_crl
= cert_crl
;
900 X509_STORE_CTX_cert_crl_fn
X509_STORE_get_cert_crl(const X509_STORE
*ctx
)
902 return ctx
->cert_crl
;
905 void X509_STORE_set_check_policy(X509_STORE
*ctx
,
906 X509_STORE_CTX_check_policy_fn check_policy
)
908 ctx
->check_policy
= check_policy
;
911 X509_STORE_CTX_check_policy_fn
X509_STORE_get_check_policy(const X509_STORE
*ctx
)
913 return ctx
->check_policy
;
916 void X509_STORE_set_lookup_certs(X509_STORE
*ctx
,
917 X509_STORE_CTX_lookup_certs_fn lookup_certs
)
919 ctx
->lookup_certs
= lookup_certs
;
922 X509_STORE_CTX_lookup_certs_fn
X509_STORE_get_lookup_certs(const X509_STORE
*ctx
)
924 return ctx
->lookup_certs
;
927 void X509_STORE_set_lookup_crls(X509_STORE
*ctx
,
928 X509_STORE_CTX_lookup_crls_fn lookup_crls
)
930 ctx
->lookup_crls
= lookup_crls
;
933 X509_STORE_CTX_lookup_crls_fn
X509_STORE_get_lookup_crls(const X509_STORE
*ctx
)
935 return ctx
->lookup_crls
;
938 void X509_STORE_set_cleanup(X509_STORE
*ctx
,
939 X509_STORE_CTX_cleanup_fn ctx_cleanup
)
941 ctx
->cleanup
= ctx_cleanup
;
944 X509_STORE_CTX_cleanup_fn
X509_STORE_get_cleanup(const X509_STORE
*ctx
)
949 int X509_STORE_set_ex_data(X509_STORE
*ctx
, int idx
, void *data
)
951 return CRYPTO_set_ex_data(&ctx
->ex_data
, idx
, data
);
954 void *X509_STORE_get_ex_data(const X509_STORE
*ctx
, int idx
)
956 return CRYPTO_get_ex_data(&ctx
->ex_data
, idx
);
959 X509_STORE
*X509_STORE_CTX_get0_store(const X509_STORE_CTX
*ctx
)