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_ex(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
75 char **ret, OSSL_LIB_CTX *libctx, const char *propq)
77 if (ctx->method == NULL)
79 if (ctx->method->ctrl_ex != NULL)
80 return ctx->method->ctrl_ex(ctx, cmd, argc, argl, ret, libctx, propq);
81 if (ctx->method->ctrl != NULL)
82 return ctx->method->ctrl(ctx, cmd, argc, argl, ret);
86 int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
89 return X509_LOOKUP_ctrl_ex(ctx, cmd, argc, argl, ret, NULL, NULL);
92 int X509_LOOKUP_by_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
93 const X509_NAME *name, X509_OBJECT *ret,
94 OSSL_LIB_CTX *libctx, const char *propq)
97 || ctx->method == NULL
98 || (ctx->method->get_by_subject == NULL
99 && ctx->method->get_by_subject_ex == NULL))
101 if (ctx->method->get_by_subject_ex != NULL)
102 return ctx->method->get_by_subject_ex(ctx, type, name, ret, libctx,
105 return ctx->method->get_by_subject(ctx, type, name, ret);
108 int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
109 const X509_NAME *name, X509_OBJECT *ret)
111 return X509_LOOKUP_by_subject_ex(ctx, type, name, ret, NULL, NULL);
114 int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
115 const X509_NAME *name,
116 const ASN1_INTEGER *serial,
119 if ((ctx->method == NULL) || (ctx->method->get_by_issuer_serial == NULL))
121 return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret);
124 int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
125 const unsigned char *bytes, int len,
128 if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL))
130 return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret);
133 int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
134 const char *str, int len, X509_OBJECT *ret)
136 if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL))
138 return ctx->method->get_by_alias(ctx, type, str, len, ret);
141 int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data)
143 ctx->method_data = data;
147 void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx)
149 return ctx->method_data;
152 X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx)
154 return ctx->store_ctx;
158 static int x509_object_cmp(const X509_OBJECT *const *a,
159 const X509_OBJECT *const *b)
163 ret = ((*a)->type - (*b)->type);
166 switch ((*a)->type) {
168 ret = X509_subject_name_cmp((*a)->data.x509, (*b)->data.x509);
171 ret = X509_CRL_cmp((*a)->data.crl, (*b)->data.crl);
180 X509_STORE *X509_STORE_new(void)
182 X509_STORE *ret = OPENSSL_zalloc(sizeof(*ret));
185 X509err(0, ERR_R_MALLOC_FAILURE);
188 if ((ret->objs = sk_X509_OBJECT_new(x509_object_cmp)) == NULL) {
189 X509err(0, ERR_R_MALLOC_FAILURE);
193 if ((ret->get_cert_methods = sk_X509_LOOKUP_new_null()) == NULL) {
194 X509err(0, ERR_R_MALLOC_FAILURE);
198 if ((ret->param = X509_VERIFY_PARAM_new()) == NULL) {
199 X509err(0, ERR_R_MALLOC_FAILURE);
202 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data)) {
203 X509err(0, ERR_R_MALLOC_FAILURE);
207 ret->lock = CRYPTO_THREAD_lock_new();
208 if (ret->lock == NULL) {
209 X509err(0, ERR_R_MALLOC_FAILURE);
216 X509_VERIFY_PARAM_free(ret->param);
217 sk_X509_OBJECT_free(ret->objs);
218 sk_X509_LOOKUP_free(ret->get_cert_methods);
223 void X509_STORE_free(X509_STORE *vfy)
226 STACK_OF(X509_LOOKUP) *sk;
231 CRYPTO_DOWN_REF(&vfy->references, &i, vfy->lock);
232 REF_PRINT_COUNT("X509_STORE", vfy);
235 REF_ASSERT_ISNT(i < 0);
237 sk = vfy->get_cert_methods;
238 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
239 lu = sk_X509_LOOKUP_value(sk, i);
240 X509_LOOKUP_shutdown(lu);
241 X509_LOOKUP_free(lu);
243 sk_X509_LOOKUP_free(sk);
244 sk_X509_OBJECT_pop_free(vfy->objs, X509_OBJECT_free);
246 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);
247 X509_VERIFY_PARAM_free(vfy->param);
248 CRYPTO_THREAD_lock_free(vfy->lock);
252 int X509_STORE_up_ref(X509_STORE *vfy)
256 if (CRYPTO_UP_REF(&vfy->references, &i, vfy->lock) <= 0)
259 REF_PRINT_COUNT("X509_STORE", vfy);
260 REF_ASSERT_ISNT(i < 2);
261 return ((i > 1) ? 1 : 0);
264 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
267 STACK_OF(X509_LOOKUP) *sk;
270 sk = v->get_cert_methods;
271 for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
272 lu = sk_X509_LOOKUP_value(sk, i);
273 if (m == lu->method) {
278 lu = X509_LOOKUP_new(m);
280 X509err(X509_F_X509_STORE_ADD_LOOKUP, ERR_R_MALLOC_FAILURE);
285 if (sk_X509_LOOKUP_push(v->get_cert_methods, lu))
288 X509err(X509_F_X509_STORE_ADD_LOOKUP, ERR_R_MALLOC_FAILURE);
289 X509_LOOKUP_free(lu);
293 X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,
294 X509_LOOKUP_TYPE type,
295 const X509_NAME *name)
297 X509_OBJECT *ret = X509_OBJECT_new();
301 if (!X509_STORE_CTX_get_by_subject(vs, type, name, ret)) {
302 X509_OBJECT_free(ret);
308 int X509_STORE_CTX_get_by_subject(const X509_STORE_CTX *vs,
309 X509_LOOKUP_TYPE type,
310 const X509_NAME *name, X509_OBJECT *ret)
312 X509_STORE *store = vs->store;
314 X509_OBJECT stmp, *tmp;
320 stmp.type = X509_LU_NONE;
321 stmp.data.ptr = NULL;
324 X509_STORE_lock(store);
325 tmp = X509_OBJECT_retrieve_by_subject(store->objs, type, name);
326 X509_STORE_unlock(store);
328 if (tmp == NULL || type == X509_LU_CRL) {
329 for (i = 0; i < sk_X509_LOOKUP_num(store->get_cert_methods); i++) {
330 lu = sk_X509_LOOKUP_value(store->get_cert_methods, i);
331 j = X509_LOOKUP_by_subject_ex(lu, type, name, &stmp, vs->libctx,
342 if (!X509_OBJECT_up_ref_count(tmp))
345 ret->type = tmp->type;
346 ret->data.ptr = tmp->data.ptr;
351 static int x509_store_add(X509_STORE *store, void *x, int crl) {
353 int ret = 0, added = 0;
357 obj = X509_OBJECT_new();
362 obj->type = X509_LU_CRL;
363 obj->data.crl = (X509_CRL *)x;
365 obj->type = X509_LU_X509;
366 obj->data.x509 = (X509 *)x;
368 if (!X509_OBJECT_up_ref_count(obj)) {
369 obj->type = X509_LU_NONE;
370 X509_OBJECT_free(obj);
374 X509_STORE_lock(store);
375 if (X509_OBJECT_retrieve_match(store->objs, obj)) {
378 added = sk_X509_OBJECT_push(store->objs, obj);
381 X509_STORE_unlock(store);
383 if (added == 0) /* obj not pushed */
384 X509_OBJECT_free(obj);
389 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
391 if (!x509_store_add(ctx, x, 0)) {
392 X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
398 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
400 if (!x509_store_add(ctx, x, 1)) {
401 X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
407 int X509_OBJECT_up_ref_count(X509_OBJECT *a)
413 return X509_up_ref(a->data.x509);
415 return X509_CRL_up_ref(a->data.crl);
420 X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a)
422 if (a == NULL || a->type != X509_LU_X509)
427 X509_CRL *X509_OBJECT_get0_X509_CRL(const X509_OBJECT *a)
429 if (a == NULL || a->type != X509_LU_CRL)
434 X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a)
439 X509_OBJECT *X509_OBJECT_new(void)
441 X509_OBJECT *ret = OPENSSL_zalloc(sizeof(*ret));
444 X509err(X509_F_X509_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
447 ret->type = X509_LU_NONE;
451 static void x509_object_free_internal(X509_OBJECT *a)
459 X509_free(a->data.x509);
462 X509_CRL_free(a->data.crl);
467 int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj)
469 if (a == NULL || !X509_up_ref(obj))
472 x509_object_free_internal(a);
473 a->type = X509_LU_X509;
478 int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj)
480 if (a == NULL || !X509_CRL_up_ref(obj))
483 x509_object_free_internal(a);
484 a->type = X509_LU_CRL;
489 void X509_OBJECT_free(X509_OBJECT *a)
491 x509_object_free_internal(a);
495 static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
496 const X509_NAME *name, int *pnmatch)
506 stmp.data.x509 = &x509_s;
507 x509_s.cert_info.subject = (X509_NAME *)name; /* won't modify it */
510 stmp.data.crl = &crl_s;
511 crl_s.crl.issuer = (X509_NAME *)name; /* won't modify it */
518 idx = sk_X509_OBJECT_find(h, &stmp);
519 if (idx >= 0 && pnmatch) {
521 const X509_OBJECT *tobj, *pstmp;
524 for (tidx = idx + 1; tidx < sk_X509_OBJECT_num(h); tidx++) {
525 tobj = sk_X509_OBJECT_value(h, tidx);
526 if (x509_object_cmp(&tobj, &pstmp))
534 int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
535 const X509_NAME *name)
537 return x509_object_idx_cnt(h, type, name, NULL);
540 X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
541 X509_LOOKUP_TYPE type,
542 const X509_NAME *name)
545 idx = X509_OBJECT_idx_by_subject(h, type, name);
548 return sk_X509_OBJECT_value(h, idx);
551 STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(const X509_STORE *v)
556 /* TODO param type could be constified as change to lock is intermittent */
557 STACK_OF(X509) *X509_STORE_get1_all_certs(X509_STORE *store)
560 STACK_OF(X509_OBJECT) *objs;
564 X509err(0, ERR_R_PASSED_NULL_PARAMETER);
567 if ((sk = sk_X509_new_null()) == NULL)
569 X509_STORE_lock(store);
570 objs = X509_STORE_get0_objects(store);
571 for (i = 0; i < sk_X509_OBJECT_num(objs); i++) {
572 X509 *cert = X509_OBJECT_get0_X509(sk_X509_OBJECT_value(objs, i));
575 && !X509_add_cert(sk, cert, X509_ADD_FLAG_UP_REF))
578 X509_STORE_unlock(store);
582 X509_STORE_unlock(store);
583 sk_X509_pop_free(sk, X509_free);
587 STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx,
591 STACK_OF(X509) *sk = NULL;
594 X509_STORE *store = ctx->store;
599 X509_STORE_lock(store);
600 idx = x509_object_idx_cnt(store->objs, X509_LU_X509, nm, &cnt);
603 * Nothing found in cache: do lookup to possibly add new objects to
606 X509_OBJECT *xobj = X509_OBJECT_new();
608 X509_STORE_unlock(store);
612 if (!X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, nm, xobj)) {
613 X509_OBJECT_free(xobj);
616 X509_OBJECT_free(xobj);
617 X509_STORE_lock(store);
618 idx = x509_object_idx_cnt(store->objs, X509_LU_X509, nm, &cnt);
620 X509_STORE_unlock(store);
625 sk = sk_X509_new_null();
626 for (i = 0; i < cnt; i++, idx++) {
627 obj = sk_X509_OBJECT_value(store->objs, idx);
629 if (!X509_add_cert(sk, x, X509_ADD_FLAG_UP_REF)) {
630 X509_STORE_unlock(store);
631 sk_X509_pop_free(sk, X509_free);
635 X509_STORE_unlock(store);
639 STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(const X509_STORE_CTX *ctx,
643 STACK_OF(X509_CRL) *sk = sk_X509_CRL_new_null();
645 X509_OBJECT *obj, *xobj = X509_OBJECT_new();
646 X509_STORE *store = ctx->store;
648 /* Always do lookup to possibly add new CRLs to cache */
652 || !X509_STORE_CTX_get_by_subject(ctx, X509_LU_CRL, nm, xobj)) {
653 X509_OBJECT_free(xobj);
654 sk_X509_CRL_free(sk);
657 X509_OBJECT_free(xobj);
658 X509_STORE_lock(store);
659 idx = x509_object_idx_cnt(store->objs, X509_LU_CRL, nm, &cnt);
661 X509_STORE_unlock(store);
662 sk_X509_CRL_free(sk);
666 for (i = 0; i < cnt; i++, idx++) {
667 obj = sk_X509_OBJECT_value(store->objs, idx);
669 if (!X509_CRL_up_ref(x)) {
670 X509_STORE_unlock(store);
671 sk_X509_CRL_pop_free(sk, X509_CRL_free);
674 if (!sk_X509_CRL_push(sk, x)) {
675 X509_STORE_unlock(store);
677 sk_X509_CRL_pop_free(sk, X509_CRL_free);
681 X509_STORE_unlock(store);
685 X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
691 idx = sk_X509_OBJECT_find(h, x);
694 if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
695 return sk_X509_OBJECT_value(h, idx);
696 for (i = idx, num = sk_X509_OBJECT_num(h); i < num; i++) {
697 obj = sk_X509_OBJECT_value(h, i);
698 if (x509_object_cmp((const X509_OBJECT **)&obj,
699 (const X509_OBJECT **)&x))
701 if (x->type == X509_LU_X509) {
702 if (!X509_cmp(obj->data.x509, x->data.x509))
704 } else if (x->type == X509_LU_CRL) {
705 if (!X509_CRL_match(obj->data.crl, x->data.crl))
714 * Try to get issuer certificate from store. Due to limitations
715 * of the API this can only retrieve a single certificate matching
716 * a given subject name. However it will fill the cache with all
717 * matching certificates, so we can examine the cache for all
721 * 1 lookup successful.
722 * 0 certificate not found.
723 * -1 some other error.
725 int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
728 X509_OBJECT *obj = X509_OBJECT_new(), *pobj = NULL;
729 X509_STORE *store = ctx->store;
735 xn = X509_get_issuer_name(x);
736 ok = X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, xn, obj);
738 X509_OBJECT_free(obj);
741 /* If certificate matches all OK */
742 if (ctx->check_issued(ctx, x, obj->data.x509)) {
743 if (x509_check_cert_time(ctx, obj->data.x509, -1)) {
744 *issuer = obj->data.x509;
745 if (!X509_up_ref(*issuer)) {
749 X509_OBJECT_free(obj);
753 X509_OBJECT_free(obj);
758 /* Else find index of first cert accepted by 'check_issued' */
760 X509_STORE_lock(store);
761 idx = X509_OBJECT_idx_by_subject(store->objs, X509_LU_X509, xn);
762 if (idx != -1) { /* should be true as we've had at least one
764 /* Look through all matching certs for suitable issuer */
765 for (i = idx; i < sk_X509_OBJECT_num(store->objs); i++) {
766 pobj = sk_X509_OBJECT_value(store->objs, i);
767 /* See if we've run past the matches */
768 if (pobj->type != X509_LU_X509)
770 if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509)))
772 if (ctx->check_issued(ctx, x, pobj->data.x509)) {
773 *issuer = pobj->data.x509;
776 * If times check, exit with match,
777 * otherwise keep looking. Leave last
778 * match in issuer so we return nearest
779 * match if no certificate time is OK.
782 if (x509_check_cert_time(ctx, *issuer, -1))
787 if (*issuer && !X509_up_ref(*issuer)) {
791 X509_STORE_unlock(store);
795 int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags)
797 return X509_VERIFY_PARAM_set_flags(ctx->param, flags);
800 int X509_STORE_set_depth(X509_STORE *ctx, int depth)
802 X509_VERIFY_PARAM_set_depth(ctx->param, depth);
806 int X509_STORE_set_purpose(X509_STORE *ctx, int purpose)
808 return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
811 int X509_STORE_set_trust(X509_STORE *ctx, int trust)
813 return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
816 int X509_STORE_set1_param(X509_STORE *ctx, const X509_VERIFY_PARAM *param)
818 return X509_VERIFY_PARAM_set1(ctx->param, param);
821 X509_VERIFY_PARAM *X509_STORE_get0_param(const X509_STORE *ctx)
826 void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify)
828 ctx->verify = verify;
831 X509_STORE_CTX_verify_fn X509_STORE_get_verify(const X509_STORE *ctx)
836 void X509_STORE_set_verify_cb(X509_STORE *ctx,
837 X509_STORE_CTX_verify_cb verify_cb)
839 ctx->verify_cb = verify_cb;
842 X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(const X509_STORE *ctx)
844 return ctx->verify_cb;
847 void X509_STORE_set_get_issuer(X509_STORE *ctx,
848 X509_STORE_CTX_get_issuer_fn get_issuer)
850 ctx->get_issuer = get_issuer;
853 X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(const X509_STORE *ctx)
855 return ctx->get_issuer;
858 void X509_STORE_set_check_issued(X509_STORE *ctx,
859 X509_STORE_CTX_check_issued_fn check_issued)
861 ctx->check_issued = check_issued;
864 X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(const X509_STORE *ctx)
866 return ctx->check_issued;
869 void X509_STORE_set_check_revocation(X509_STORE *ctx,
870 X509_STORE_CTX_check_revocation_fn check_revocation)
872 ctx->check_revocation = check_revocation;
875 X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(const X509_STORE *ctx)
877 return ctx->check_revocation;
880 void X509_STORE_set_get_crl(X509_STORE *ctx,
881 X509_STORE_CTX_get_crl_fn get_crl)
883 ctx->get_crl = get_crl;
886 X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(const X509_STORE *ctx)
891 void X509_STORE_set_check_crl(X509_STORE *ctx,
892 X509_STORE_CTX_check_crl_fn check_crl)
894 ctx->check_crl = check_crl;
897 X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(const X509_STORE *ctx)
899 return ctx->check_crl;
902 void X509_STORE_set_cert_crl(X509_STORE *ctx,
903 X509_STORE_CTX_cert_crl_fn cert_crl)
905 ctx->cert_crl = cert_crl;
908 X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(const X509_STORE *ctx)
910 return ctx->cert_crl;
913 void X509_STORE_set_check_policy(X509_STORE *ctx,
914 X509_STORE_CTX_check_policy_fn check_policy)
916 ctx->check_policy = check_policy;
919 X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(const X509_STORE *ctx)
921 return ctx->check_policy;
924 void X509_STORE_set_lookup_certs(X509_STORE *ctx,
925 X509_STORE_CTX_lookup_certs_fn lookup_certs)
927 ctx->lookup_certs = lookup_certs;
930 X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(const X509_STORE *ctx)
932 return ctx->lookup_certs;
935 void X509_STORE_set_lookup_crls(X509_STORE *ctx,
936 X509_STORE_CTX_lookup_crls_fn lookup_crls)
938 ctx->lookup_crls = lookup_crls;
941 X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(const X509_STORE *ctx)
943 return ctx->lookup_crls;
946 void X509_STORE_set_cleanup(X509_STORE *ctx,
947 X509_STORE_CTX_cleanup_fn ctx_cleanup)
949 ctx->cleanup = ctx_cleanup;
952 X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(const X509_STORE *ctx)
957 int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data)
959 return CRYPTO_set_ex_data(&ctx->ex_data, idx, data);
962 void *X509_STORE_get_ex_data(const X509_STORE *ctx, int idx)
964 return CRYPTO_get_ex_data(&ctx->ex_data, idx);
967 X509_STORE *X509_STORE_CTX_get0_store(const X509_STORE_CTX *ctx)