1*5bbf7eacStb /* $OpenBSD: verify.c,v 1.18 2023/11/21 17:56:19 tb Exp $ */
2dab3f910Sjsing /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3dab3f910Sjsing * All rights reserved.
4dab3f910Sjsing *
5dab3f910Sjsing * This package is an SSL implementation written
6dab3f910Sjsing * by Eric Young (eay@cryptsoft.com).
7dab3f910Sjsing * The implementation was written so as to conform with Netscapes SSL.
8dab3f910Sjsing *
9dab3f910Sjsing * This library is free for commercial and non-commercial use as long as
10dab3f910Sjsing * the following conditions are aheared to. The following conditions
11dab3f910Sjsing * apply to all code found in this distribution, be it the RC4, RSA,
12dab3f910Sjsing * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13dab3f910Sjsing * included with this distribution is covered by the same copyright terms
14dab3f910Sjsing * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15dab3f910Sjsing *
16dab3f910Sjsing * Copyright remains Eric Young's, and as such any Copyright notices in
17dab3f910Sjsing * the code are not to be removed.
18dab3f910Sjsing * If this package is used in a product, Eric Young should be given attribution
19dab3f910Sjsing * as the author of the parts of the library used.
20dab3f910Sjsing * This can be in the form of a textual message at program startup or
21dab3f910Sjsing * in documentation (online or textual) provided with the package.
22dab3f910Sjsing *
23dab3f910Sjsing * Redistribution and use in source and binary forms, with or without
24dab3f910Sjsing * modification, are permitted provided that the following conditions
25dab3f910Sjsing * are met:
26dab3f910Sjsing * 1. Redistributions of source code must retain the copyright
27dab3f910Sjsing * notice, this list of conditions and the following disclaimer.
28dab3f910Sjsing * 2. Redistributions in binary form must reproduce the above copyright
29dab3f910Sjsing * notice, this list of conditions and the following disclaimer in the
30dab3f910Sjsing * documentation and/or other materials provided with the distribution.
31dab3f910Sjsing * 3. All advertising materials mentioning features or use of this software
32dab3f910Sjsing * must display the following acknowledgement:
33dab3f910Sjsing * "This product includes cryptographic software written by
34dab3f910Sjsing * Eric Young (eay@cryptsoft.com)"
35dab3f910Sjsing * The word 'cryptographic' can be left out if the rouines from the library
36dab3f910Sjsing * being used are not cryptographic related :-).
37dab3f910Sjsing * 4. If you include any Windows specific code (or a derivative thereof) from
38dab3f910Sjsing * the apps directory (application code) you must include an acknowledgement:
39dab3f910Sjsing * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40dab3f910Sjsing *
41dab3f910Sjsing * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42dab3f910Sjsing * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43dab3f910Sjsing * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44dab3f910Sjsing * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45dab3f910Sjsing * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46dab3f910Sjsing * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47dab3f910Sjsing * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48dab3f910Sjsing * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49dab3f910Sjsing * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50dab3f910Sjsing * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51dab3f910Sjsing * SUCH DAMAGE.
52dab3f910Sjsing *
53dab3f910Sjsing * The licence and distribution terms for any publically available version or
54dab3f910Sjsing * derivative of this code cannot be changed. i.e. this code cannot simply be
55dab3f910Sjsing * copied and put under another distribution licence
56dab3f910Sjsing * [including the GNU Public Licence.]
57dab3f910Sjsing */
58dab3f910Sjsing
59dab3f910Sjsing #include <stdio.h>
60dab3f910Sjsing #include <stdlib.h>
61dab3f910Sjsing #include <string.h>
62dab3f910Sjsing
63dab3f910Sjsing #include "apps.h"
64dab3f910Sjsing
65dab3f910Sjsing #include <openssl/bio.h>
66dab3f910Sjsing #include <openssl/err.h>
67dab3f910Sjsing #include <openssl/pem.h>
68dab3f910Sjsing #include <openssl/x509.h>
69dab3f910Sjsing #include <openssl/x509v3.h>
70dab3f910Sjsing
71dab3f910Sjsing static int cb(int ok, X509_STORE_CTX *ctx);
72dab3f910Sjsing static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain,
735284dfeaSbcook STACK_OF(X509) *tchain, STACK_OF(X509_CRL) *crls);
74af806480Sjsing static int vflags = 0;
75af806480Sjsing
76af806480Sjsing static struct {
77af806480Sjsing char *CAfile;
78af806480Sjsing char *CApath;
79af806480Sjsing char *crlfile;
80af806480Sjsing char *trustfile;
81af806480Sjsing char *untfile;
82af806480Sjsing int verbose;
83af806480Sjsing X509_VERIFY_PARAM *vpm;
84e7718adaStb } cfg;
85af806480Sjsing
86af806480Sjsing static int
verify_opt_args(int argc,char ** argv,int * argsused)87af806480Sjsing verify_opt_args(int argc, char **argv, int *argsused)
88af806480Sjsing {
89af806480Sjsing int oargc = argc;
90af806480Sjsing int badarg = 0;
91af806480Sjsing
92e7718adaStb if (!args_verify(&argv, &argc, &badarg, bio_err, &cfg.vpm))
93af806480Sjsing return (1);
94af806480Sjsing if (badarg)
95af806480Sjsing return (1);
96af806480Sjsing
97af806480Sjsing *argsused = oargc - argc;
98af806480Sjsing
99af806480Sjsing return (0);
100af806480Sjsing }
101af806480Sjsing
102af806480Sjsing static const struct option verify_options[] = {
103af806480Sjsing {
104af806480Sjsing .name = "CAfile",
105af806480Sjsing .argname = "file",
106af806480Sjsing .desc = "Certificate Authority file",
107af806480Sjsing .type = OPTION_ARG,
108e7718adaStb .opt.arg = &cfg.CAfile,
109af806480Sjsing },
110af806480Sjsing {
111af806480Sjsing .name = "CApath",
112af806480Sjsing .argname = "path",
113af806480Sjsing .desc = "Certificate Authority path",
114af806480Sjsing .type = OPTION_ARG,
115e7718adaStb .opt.arg = &cfg.CApath,
116af806480Sjsing },
117af806480Sjsing {
118af806480Sjsing .name = "CRLfile",
119af806480Sjsing .argname = "file",
120af806480Sjsing .desc = "Certificate Revocation List file",
121af806480Sjsing .type = OPTION_ARG,
122e7718adaStb .opt.arg = &cfg.crlfile,
123af806480Sjsing },
124af806480Sjsing {
125af806480Sjsing .name = "trusted",
126af806480Sjsing .argname = "file",
127af806480Sjsing .desc = "Trusted certificates file",
128af806480Sjsing .type = OPTION_ARG,
129e7718adaStb .opt.arg = &cfg.trustfile,
130af806480Sjsing },
131af806480Sjsing {
132af806480Sjsing .name = "untrusted",
133af806480Sjsing .argname = "file",
134af806480Sjsing .desc = "Untrusted certificates file",
135af806480Sjsing .type = OPTION_ARG,
136e7718adaStb .opt.arg = &cfg.untfile,
137af806480Sjsing },
138af806480Sjsing {
139af806480Sjsing .name = "verbose",
140af806480Sjsing .desc = "Verbose",
141af806480Sjsing .type = OPTION_FLAG,
142e7718adaStb .opt.flag = &cfg.verbose,
143af806480Sjsing },
144af806480Sjsing {
145af806480Sjsing .name = NULL,
146af806480Sjsing .desc = "",
147af806480Sjsing .type = OPTION_ARGV_FUNC,
148af806480Sjsing .opt.argvfunc = verify_opt_args,
149af806480Sjsing },
150af806480Sjsing { NULL },
151af806480Sjsing };
152af806480Sjsing
153af806480Sjsing static const struct option verify_shared_options[] = {
154af806480Sjsing {
155af806480Sjsing .name = "attime",
156af806480Sjsing .argname = "epoch",
157af806480Sjsing .desc = "Use epoch as the verification time",
158af806480Sjsing },
159af806480Sjsing {
160af806480Sjsing .name = "check_ss_sig",
161af806480Sjsing .desc = "Check the root CA self-signed certificate signature",
162af806480Sjsing },
163af806480Sjsing {
164af806480Sjsing .name = "crl_check",
165af806480Sjsing .desc = "Enable CRL checking for the leaf certificate",
166af806480Sjsing },
167af806480Sjsing {
168af806480Sjsing .name = "crl_check_all",
169af806480Sjsing .desc = "Enable CRL checking for the entire certificate chain",
170af806480Sjsing },
171af806480Sjsing {
172af806480Sjsing .name = "explicit_policy",
173af806480Sjsing .desc = "Require explicit policy (per RFC 3280)",
174af806480Sjsing },
175af806480Sjsing {
176af806480Sjsing .name = "extended_crl",
177af806480Sjsing .desc = "Enable extended CRL support",
178af806480Sjsing },
179af806480Sjsing {
180af806480Sjsing .name = "ignore_critical",
181af806480Sjsing .desc = "Disable critical extension checking",
182af806480Sjsing },
183af806480Sjsing {
184af806480Sjsing .name = "inhibit_any",
185af806480Sjsing .desc = "Inhibit any policy (per RFC 3280)",
186af806480Sjsing },
187af806480Sjsing {
188af806480Sjsing .name = "inhibit_map",
189af806480Sjsing .desc = "Inhibit policy mapping (per RFC 3280)",
190af806480Sjsing },
191af806480Sjsing {
192af806480Sjsing .name = "issuer_checks",
193af806480Sjsing .desc = "Enable debugging of certificate issuer checks",
194af806480Sjsing },
195af806480Sjsing {
1966f2a58b6Stb .name = "legacy_verify",
1976f2a58b6Stb .desc = "Use legacy certificate chain verification",
1986f2a58b6Stb },
1996f2a58b6Stb {
200af806480Sjsing .name = "policy",
201af806480Sjsing .argname = "name",
202af806480Sjsing .desc = "Add given policy to the acceptable set",
203af806480Sjsing },
204af806480Sjsing {
205af806480Sjsing .name = "policy_check",
206af806480Sjsing .desc = "Enable certificate policy checking",
207af806480Sjsing },
208af806480Sjsing {
209af806480Sjsing .name = "policy_print",
210af806480Sjsing .desc = "Print policy",
211af806480Sjsing },
212af806480Sjsing {
213af806480Sjsing .name = "purpose",
214af806480Sjsing .argname = "name",
215af806480Sjsing .desc = "Verify for the given purpose",
216af806480Sjsing },
217af806480Sjsing {
218af806480Sjsing .name = "use_deltas",
219af806480Sjsing .desc = "Use delta CRLS (if present)",
220af806480Sjsing },
221af806480Sjsing {
222af806480Sjsing .name = "verify_depth",
223af806480Sjsing .argname = "num",
224af806480Sjsing .desc = "Limit verification to the given depth",
225af806480Sjsing },
226af806480Sjsing {
227af806480Sjsing .name = "x509_strict",
228af806480Sjsing .desc = "Use strict X.509 rules (disables workarounds)",
229af806480Sjsing },
230af806480Sjsing { NULL },
231af806480Sjsing };
232af806480Sjsing
233af806480Sjsing static void
verify_usage(void)234af806480Sjsing verify_usage(void)
235af806480Sjsing {
236af806480Sjsing int i;
237af806480Sjsing
238af806480Sjsing fprintf(stderr,
239af806480Sjsing "usage: verify [-CAfile file] [-CApath directory] [-check_ss_sig]\n"
240af806480Sjsing " [-CRLfile file] [-crl_check] [-crl_check_all]\n"
241af806480Sjsing " [-explicit_policy] [-extended_crl]\n"
242af806480Sjsing " [-ignore_critical] [-inhibit_any] [-inhibit_map]\n"
243af806480Sjsing " [-issuer_checks] [-policy_check] [-purpose purpose]\n"
244af806480Sjsing " [-trusted file] [-untrusted file] [-verbose]\n"
245af806480Sjsing " [-x509_strict] [certificates]\n\n");
246af806480Sjsing
247af806480Sjsing options_usage(verify_options);
248af806480Sjsing
249af806480Sjsing fprintf(stderr, "\nVerification options:\n\n");
250af806480Sjsing options_usage(verify_shared_options);
251af806480Sjsing
252af806480Sjsing fprintf(stderr, "\nValid purposes:\n\n");
253af806480Sjsing for (i = 0; i < X509_PURPOSE_get_count(); i++) {
254*5bbf7eacStb const X509_PURPOSE *ptmp = X509_PURPOSE_get0(i);
255af806480Sjsing fprintf(stderr, " %-18s%s\n", X509_PURPOSE_get0_sname(ptmp),
256af806480Sjsing X509_PURPOSE_get0_name(ptmp));
257af806480Sjsing }
258af806480Sjsing }
259dab3f910Sjsing
260dab3f910Sjsing int
verify_main(int argc,char ** argv)261dab3f910Sjsing verify_main(int argc, char **argv)
262dab3f910Sjsing {
263dab3f910Sjsing STACK_OF(X509) *untrusted = NULL, *trusted = NULL;
264dab3f910Sjsing STACK_OF(X509_CRL) *crls = NULL;
265dab3f910Sjsing X509_STORE *cert_ctx = NULL;
266dab3f910Sjsing X509_LOOKUP *lookup = NULL;
267af806480Sjsing char **cert_files = NULL;
268af806480Sjsing int argsused;
2695d679479Stb int ret = 1;
270dab3f910Sjsing
271e370f0eeSdoug if (pledge("stdio rpath", NULL) == -1) {
2729bc487adSdoug perror("pledge");
273e370f0eeSdoug exit(1);
274e370f0eeSdoug }
2759bc487adSdoug
276e7718adaStb memset(&cfg, 0, sizeof(cfg));
277af806480Sjsing
278af806480Sjsing if (options_parse(argc, argv, verify_options, NULL, &argsused) != 0) {
279af806480Sjsing verify_usage();
280af806480Sjsing goto end;
281af806480Sjsing }
282af806480Sjsing
283af806480Sjsing if (argsused < argc)
284af806480Sjsing cert_files = &argv[argsused];
285af806480Sjsing
286dab3f910Sjsing cert_ctx = X509_STORE_new();
287dab3f910Sjsing if (cert_ctx == NULL)
288dab3f910Sjsing goto end;
289dab3f910Sjsing X509_STORE_set_verify_cb(cert_ctx, cb);
290dab3f910Sjsing
291e7718adaStb if (cfg.vpm)
292e7718adaStb X509_STORE_set1_param(cert_ctx, cfg.vpm);
293dab3f910Sjsing
294dab3f910Sjsing lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
295dab3f910Sjsing if (lookup == NULL)
296af806480Sjsing abort(); /* XXX */
297e7718adaStb if (cfg.CAfile) {
298e7718adaStb if (!X509_LOOKUP_load_file(lookup, cfg.CAfile,
2995d679479Stb X509_FILETYPE_PEM)) {
3005d679479Stb BIO_printf(bio_err, "Error loading file %s\n",
301e7718adaStb cfg.CAfile);
302dab3f910Sjsing ERR_print_errors(bio_err);
303dab3f910Sjsing goto end;
304dab3f910Sjsing }
305dab3f910Sjsing } else
306dab3f910Sjsing X509_LOOKUP_load_file(lookup, NULL, X509_FILETYPE_DEFAULT);
307dab3f910Sjsing
308dab3f910Sjsing lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
309dab3f910Sjsing if (lookup == NULL)
310af806480Sjsing abort(); /* XXX */
311e7718adaStb if (cfg.CApath) {
312e7718adaStb if (!X509_LOOKUP_add_dir(lookup, cfg.CApath,
3135d679479Stb X509_FILETYPE_PEM)) {
3145d679479Stb BIO_printf(bio_err, "Error loading directory %s\n",
315e7718adaStb cfg.CApath);
316dab3f910Sjsing ERR_print_errors(bio_err);
317dab3f910Sjsing goto end;
318dab3f910Sjsing }
319dab3f910Sjsing } else
320dab3f910Sjsing X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
321dab3f910Sjsing
322dab3f910Sjsing ERR_clear_error();
323dab3f910Sjsing
324e7718adaStb if (cfg.untfile) {
325e7718adaStb untrusted = load_certs(bio_err, cfg.untfile,
326667ec7c6Stb FORMAT_PEM, NULL, "untrusted certificates");
327dab3f910Sjsing if (!untrusted)
328dab3f910Sjsing goto end;
329dab3f910Sjsing }
330e7718adaStb if (cfg.trustfile) {
331e7718adaStb trusted = load_certs(bio_err, cfg.trustfile,
332667ec7c6Stb FORMAT_PEM, NULL, "trusted certificates");
333dab3f910Sjsing if (!trusted)
334dab3f910Sjsing goto end;
335dab3f910Sjsing }
336e7718adaStb if (cfg.crlfile) {
337e7718adaStb crls = load_crls(bio_err, cfg.crlfile, FORMAT_PEM,
3385284dfeaSbcook NULL, "other CRLs");
339dab3f910Sjsing if (!crls)
340dab3f910Sjsing goto end;
341dab3f910Sjsing }
342dab3f910Sjsing ret = 0;
343af806480Sjsing if (cert_files == NULL) {
3445284dfeaSbcook if (1 != check(cert_ctx, NULL, untrusted, trusted, crls))
345dab3f910Sjsing ret = -1;
346dab3f910Sjsing } else {
347af806480Sjsing do {
348667ec7c6Stb if (1 != check(cert_ctx, *cert_files++, untrusted,
349667ec7c6Stb trusted, crls))
350dab3f910Sjsing ret = -1;
351af806480Sjsing } while (*cert_files != NULL);
352dab3f910Sjsing }
353dab3f910Sjsing
354dab3f910Sjsing end:
355e7718adaStb if (cfg.vpm)
356e7718adaStb X509_VERIFY_PARAM_free(cfg.vpm);
357dab3f910Sjsing if (cert_ctx != NULL)
358dab3f910Sjsing X509_STORE_free(cert_ctx);
359dab3f910Sjsing sk_X509_pop_free(untrusted, X509_free);
360dab3f910Sjsing sk_X509_pop_free(trusted, X509_free);
361dab3f910Sjsing sk_X509_CRL_pop_free(crls, X509_CRL_free);
362dab3f910Sjsing
363dab3f910Sjsing return (ret < 0 ? 2 : ret);
364dab3f910Sjsing }
365dab3f910Sjsing
366dab3f910Sjsing static int
check(X509_STORE * ctx,char * file,STACK_OF (X509)* uchain,STACK_OF (X509)* tchain,STACK_OF (X509_CRL)* crls)367dab3f910Sjsing check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain,
3685284dfeaSbcook STACK_OF(X509) *tchain, STACK_OF(X509_CRL) *crls)
369dab3f910Sjsing {
370dab3f910Sjsing X509 *x = NULL;
371ca843d9aStb X509_STORE_CTX *csc = NULL;
372ca843d9aStb const char *certfile = (file == NULL) ? "stdin" : file;
373ca843d9aStb int verify_err;
374dab3f910Sjsing int i = 0, ret = 0;
375dab3f910Sjsing
3765284dfeaSbcook x = load_cert(bio_err, file, FORMAT_PEM, NULL, "certificate file");
377dab3f910Sjsing if (x == NULL)
378dab3f910Sjsing goto end;
379dab3f910Sjsing
380ca843d9aStb if ((csc = X509_STORE_CTX_new()) == NULL)
381dab3f910Sjsing goto end;
382dab3f910Sjsing X509_STORE_set_flags(ctx, vflags);
383ca843d9aStb if (!X509_STORE_CTX_init(csc, ctx, x, uchain))
384dab3f910Sjsing goto end;
385dab3f910Sjsing if (tchain)
386dab3f910Sjsing X509_STORE_CTX_trusted_stack(csc, tchain);
387dab3f910Sjsing if (crls)
388dab3f910Sjsing X509_STORE_CTX_set0_crls(csc, crls);
389ca843d9aStb
390dab3f910Sjsing i = X509_verify_cert(csc);
391ca843d9aStb verify_err = X509_STORE_CTX_get_error(csc);
392dab3f910Sjsing
393ca843d9aStb if (i > 0 && verify_err == X509_V_OK) {
3943cade00eSjsing fprintf(stdout, "%s: OK\n", certfile);
395dab3f910Sjsing ret = 1;
396ca843d9aStb } else {
397ca843d9aStb fprintf(stdout, "%s: verification failed: %d (%s)\n", certfile,
398ca843d9aStb verify_err, X509_verify_cert_error_string(verify_err));
399ca843d9aStb }
400ca843d9aStb
401ca843d9aStb end:
402ca843d9aStb if (i <= 0)
403dab3f910Sjsing ERR_print_errors(bio_err);
404dab3f910Sjsing X509_free(x);
405ca843d9aStb X509_STORE_CTX_free(csc);
406dab3f910Sjsing
407dab3f910Sjsing return (ret);
408dab3f910Sjsing }
409dab3f910Sjsing
410dab3f910Sjsing static int
cb(int ok,X509_STORE_CTX * ctx)411dab3f910Sjsing cb(int ok, X509_STORE_CTX *ctx)
412dab3f910Sjsing {
413dab3f910Sjsing int cert_error = X509_STORE_CTX_get_error(ctx);
414dab3f910Sjsing X509 *current_cert = X509_STORE_CTX_get_current_cert(ctx);
415dab3f910Sjsing
416dab3f910Sjsing if (!ok) {
417dab3f910Sjsing if (current_cert) {
418dab3f910Sjsing X509_NAME_print_ex_fp(stdout,
419dab3f910Sjsing X509_get_subject_name(current_cert),
420dab3f910Sjsing 0, XN_FLAG_ONELINE);
421dab3f910Sjsing printf("\n");
422dab3f910Sjsing }
423dab3f910Sjsing printf("%serror %d at %d depth lookup:%s\n",
424dab3f910Sjsing X509_STORE_CTX_get0_parent_ctx(ctx) ? "[CRL path]" : "",
425dab3f910Sjsing cert_error,
426dab3f910Sjsing X509_STORE_CTX_get_error_depth(ctx),
427dab3f910Sjsing X509_verify_cert_error_string(cert_error));
428dab3f910Sjsing switch (cert_error) {
429dab3f910Sjsing case X509_V_ERR_NO_EXPLICIT_POLICY:
430dab3f910Sjsing case X509_V_ERR_CERT_HAS_EXPIRED:
431dab3f910Sjsing
432dab3f910Sjsing /*
433dab3f910Sjsing * since we are just checking the certificates, it is
434dab3f910Sjsing * ok if they are self signed. But we should still
435dab3f910Sjsing * warn the user.
436dab3f910Sjsing */
437dab3f910Sjsing
438dab3f910Sjsing case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
439dab3f910Sjsing /* Continue after extension errors too */
440dab3f910Sjsing case X509_V_ERR_INVALID_CA:
441dab3f910Sjsing case X509_V_ERR_INVALID_NON_CA:
442dab3f910Sjsing case X509_V_ERR_PATH_LENGTH_EXCEEDED:
443dab3f910Sjsing case X509_V_ERR_INVALID_PURPOSE:
444dab3f910Sjsing case X509_V_ERR_CRL_HAS_EXPIRED:
445dab3f910Sjsing case X509_V_ERR_CRL_NOT_YET_VALID:
446dab3f910Sjsing case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION:
447dab3f910Sjsing ok = 1;
448dab3f910Sjsing
449dab3f910Sjsing }
450dab3f910Sjsing
451dab3f910Sjsing return ok;
452dab3f910Sjsing
453dab3f910Sjsing }
454e7718adaStb if (!cfg.verbose)
455dab3f910Sjsing ERR_clear_error();
456dab3f910Sjsing return (ok);
457dab3f910Sjsing }
458