1=pod
2
3=head1 NAME
4
5X509_STORE_set_lookup_crls_cb,
6X509_STORE_set_verify_func,
7X509_STORE_get_cleanup,
8X509_STORE_set_cleanup,
9X509_STORE_get_lookup_crls,
10X509_STORE_set_lookup_crls,
11X509_STORE_get_lookup_certs,
12X509_STORE_set_lookup_certs,
13X509_STORE_get_check_policy,
14X509_STORE_set_check_policy,
15X509_STORE_get_cert_crl,
16X509_STORE_set_cert_crl,
17X509_STORE_get_check_crl,
18X509_STORE_set_check_crl,
19X509_STORE_get_get_crl,
20X509_STORE_set_get_crl,
21X509_STORE_get_check_revocation,
22X509_STORE_set_check_revocation,
23X509_STORE_get_check_issued,
24X509_STORE_set_check_issued,
25X509_STORE_get_get_issuer,
26X509_STORE_set_get_issuer,
27X509_STORE_CTX_get_verify,
28X509_STORE_set_verify,
29X509_STORE_get_verify_cb,
30X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb,
31X509_STORE_CTX_cert_crl_fn, X509_STORE_CTX_check_crl_fn,
32X509_STORE_CTX_check_issued_fn, X509_STORE_CTX_check_policy_fn,
33X509_STORE_CTX_check_revocation_fn, X509_STORE_CTX_cleanup_fn,
34X509_STORE_CTX_get_crl_fn, X509_STORE_CTX_get_issuer_fn,
35X509_STORE_CTX_lookup_certs_fn, X509_STORE_CTX_lookup_crls_fn
36- set verification callback
37
38=head1 SYNOPSIS
39
40 #include <openssl/x509_vfy.h>
41
42 typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,
43                                             X509_STORE_CTX *ctx, X509 *x);
44 typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,
45                                               X509 *x, X509 *issuer);
46 typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);
47 typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,
48                                          X509_CRL **crl, X509 *x);
49 typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);
50 typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,
51                                           X509_CRL *crl, X509 *x);
52 typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);
53 typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,
54                                                           X509_NAME *nm);
55 typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx,
56                                                              X509_NAME *nm);
57 typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);
58
59 void X509_STORE_set_verify_cb(X509_STORE *ctx,
60                               X509_STORE_CTX_verify_cb verify_cb);
61 X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE_CTX *ctx);
62
63 void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);
64 X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx);
65
66 void X509_STORE_set_get_issuer(X509_STORE *ctx,
67                                X509_STORE_CTX_get_issuer_fn get_issuer);
68 X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE_CTX *ctx);
69
70 void X509_STORE_set_check_issued(X509_STORE *ctx,
71                                  X509_STORE_CTX_check_issued_fn check_issued);
72 X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE_CTX *ctx);
73
74 void X509_STORE_set_check_revocation(X509_STORE *ctx,
75                                      X509_STORE_CTX_check_revocation_fn check_revocation);
76 X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE_CTX *ctx);
77
78 void X509_STORE_set_get_crl(X509_STORE *ctx,
79                             X509_STORE_CTX_get_crl_fn get_crl);
80 X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE_CTX *ctx);
81
82 void X509_STORE_set_check_crl(X509_STORE *ctx,
83                               X509_STORE_CTX_check_crl_fn check_crl);
84 X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE_CTX *ctx);
85
86 void X509_STORE_set_cert_crl(X509_STORE *ctx,
87                              X509_STORE_CTX_cert_crl_fn cert_crl);
88 X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE_CTX *ctx);
89
90 void X509_STORE_set_check_policy(X509_STORE *ctx,
91                                  X509_STORE_CTX_check_policy_fn check_policy);
92 X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE_CTX *ctx);
93
94 void X509_STORE_set_lookup_certs(X509_STORE *ctx,
95                                  X509_STORE_CTX_lookup_certs_fn lookup_certs);
96 X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE_CTX *ctx);
97
98 void X509_STORE_set_lookup_crls(X509_STORE *ctx,
99                                 X509_STORE_CTX_lookup_crls_fn lookup_crls);
100 X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE_CTX *ctx);
101
102 void X509_STORE_set_cleanup(X509_STORE *ctx,
103                             X509_STORE_CTX_cleanup_fn cleanup);
104 X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE_CTX *ctx);
105
106 /* Aliases */
107 void X509_STORE_set_verify_cb_func(X509_STORE *st,
108                                    X509_STORE_CTX_verify_cb verify_cb);
109 void X509_STORE_set_verify_func(X509_STORE *ctx,
110                                 X509_STORE_CTX_verify_fn verify);
111 void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,
112                                    X509_STORE_CTX_lookup_crls_fn lookup_crls);
113
114=head1 DESCRIPTION
115
116X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to
117B<verify_cb> overwriting the previous callback.
118The callback assigned with this function becomes a default for the one
119that can be assigned directly to the corresponding B<X509_STORE_CTX>,
120please see L<X509_STORE_CTX_set_verify_cb(3)> for further information.
121
122X509_STORE_set_verify() sets the final chain verification function for
123B<ctx> to B<verify>.
124Its purpose is to go through the chain of certificates and check that
125all signatures are valid and that the current time is within the
126limits of each certificate's first and last validity time.
127The final chain verification functions must return 0 on failure and 1
128on success.
129I<If no chain verification function is provided, the internal default
130function will be used instead.>
131
132X509_STORE_set_get_issuer() sets the function to get the issuer
133certificate that verifies the given certificate B<x>.
134When found, the issuer certificate must be assigned to B<*issuer>.
135This function must return 0 on failure and 1 on success.
136I<If no function to get the issuer is provided, the internal default
137function will be used instead.>
138
139X509_STORE_set_check_issued() sets the function to check that a given
140certificate B<x> is issued with the issuer certificate B<issuer>.
141This function must return 0 on failure (among others if B<x> hasn't
142been issued with B<issuer>) and 1 on success.
143I<If no function to get the issuer is provided, the internal default
144function will be used instead.>
145
146X509_STORE_set_check_revocation() sets the revocation checking
147function.
148Its purpose is to look through the final chain and check the
149revocation status for each certificate.
150It must return 0 on failure and 1 on success.
151I<If no function to get the issuer is provided, the internal default
152function will be used instead.>
153
154X509_STORE_set_get_crl() sets the function to get the crl for a given
155certificate B<x>.
156When found, the crl must be assigned to B<*crl>.
157This function must return 0 on failure and 1 on success.
158I<If no function to get the issuer is provided, the internal default
159function will be used instead.>
160
161X509_STORE_set_check_crl() sets the function to check the validity of
162the given B<crl>.
163This function must return 0 on failure and 1 on success.
164I<If no function to get the issuer is provided, the internal default
165function will be used instead.>
166
167X509_STORE_set_cert_crl() sets the function to check the revocation
168status of the given certificate B<x> against the given B<crl>.
169This function must return 0 on failure and 1 on success.
170I<If no function to get the issuer is provided, the internal default
171function will be used instead.>
172
173X509_STORE_set_check_policy() sets the function to check the policies
174of all the certificates in the final chain..
175This function must return 0 on failure and 1 on success.
176I<If no function to get the issuer is provided, the internal default
177function will be used instead.>
178
179X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the
180functions to look up all the certs or all the CRLs that match the
181given name B<nm>.
182These functions return NULL on failure and a pointer to a stack of
183certificates (B<X509>) or to a stack of CRLs (B<X509_CRL>) on
184success.
185I<If no function to get the issuer is provided, the internal default
186function will be used instead.>
187
188X509_STORE_set_cleanup() sets the final cleanup function, which is
189called when the context (B<X509_STORE_CTX>) is being torn down.
190This function doesn't return any value.
191I<If no function to get the issuer is provided, the internal default
192function will be used instead.>
193
194X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(),
195X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(),
196X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(),
197X509_STORE_get_check_crl(), X509_STORE_set_verify(),
198X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(),
199X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(),
200X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return
201the function pointer assigned with X509_STORE_set_check_issued(),
202X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(),
203X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(),
204X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(),
205X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if
206no assignment has been made.
207
208X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and
209X509_STORE_set_lookup_crls_cb() are aliases for
210X509_STORE_set_verify_cb(), X509_STORE_set_verify() and
211X509_STORE_set_lookup_crls, available as macros for backward
212compatibility.
213
214=head1 NOTES
215
216All the callbacks from a B<X509_STORE> are inherited by the
217corresponding B<X509_STORE_CTX> structure when it is initialized.
218See L<X509_STORE_CTX_set_verify_cb(3)> for further details.
219
220=head1 BUGS
221
222The macro version of this function was the only one available before
223OpenSSL 1.0.0.
224
225=head1 RETURN VALUES
226
227The X509_STORE_set_*() functions do not return a value.
228
229The X509_STORE_get_*() functions return a pointer of the appropriate
230function type.
231
232=head1 SEE ALSO
233
234L<X509_STORE_CTX_set_verify_cb(3)>, L<X509_STORE_CTX_get0_chain(3)>,
235L<X509_STORE_CTX_verify_cb(3)>, L<X509_STORE_CTX_verify_fn(3)>,
236L<CMS_verify(3)>
237
238=head1 HISTORY
239
240X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0.
241
242X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(),
243X509_STORE_set_verify(), X509_STORE_CTX_get_verify(),
244X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(),
245X509_STORE_set_check_issued(), X509_STORE_get_check_issued(),
246X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(),
247X509_STORE_set_get_crl(), X509_STORE_get_get_crl(),
248X509_STORE_set_check_crl(), X509_STORE_get_check_crl(),
249X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(),
250X509_STORE_set_check_policy(), X509_STORE_get_check_policy(),
251X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(),
252X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(),
253X509_STORE_set_cleanup() and X509_STORE_get_cleanup() were added in
254OpenSSL 1.1.0.
255
256=head1 COPYRIGHT
257
258Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
259
260Licensed under the OpenSSL license (the "License").  You may not use
261this file except in compliance with the License.  You can obtain a copy
262in the file LICENSE in the source distribution or at
263L<https://www.openssl.org/source/license.html>.
264
265=cut
266