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