1 /* $OpenBSD: x509_verify.h,v 1.1 2020/09/13 15:06:17 beck Exp $ */
2 /*
3  * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 #ifndef HEADER_X509_VERIFY_H
18 #define HEADER_X509_VERIFY_H
19 
20 #ifdef LIBRESSL_INTERNAL
21 struct x509_verify_ctx;
22 typedef struct x509_verify_ctx X509_VERIFY_CTX;
23 
24 X509_VERIFY_CTX *x509_verify_ctx_new(STACK_OF(X509) *roots);
25 void x509_verify_ctx_free(struct x509_verify_ctx *ctx);
26 
27 int x509_verify_ctx_set_max_depth(X509_VERIFY_CTX *ctx, size_t max);
28 int x509_verify_ctx_set_max_chains(X509_VERIFY_CTX *ctx, size_t max);
29 int x509_verify_ctx_set_max_signatures(X509_VERIFY_CTX *ctx, size_t max);
30 int x509_verify_ctx_set_purpose(X509_VERIFY_CTX *ctx, int purpose_id);
31 int x509_verify_ctx_set_intermediates(X509_VERIFY_CTX *ctx,
32     STACK_OF(X509) *intermediates);
33 
34 const char *x509_verify_ctx_error_string(X509_VERIFY_CTX *ctx);
35 size_t x509_verify_ctx_error_depth(X509_VERIFY_CTX *ctx);
36 
37 STACK_OF(X509) *x509_verify_ctx_chain(X509_VERIFY_CTX *ctx, size_t chain);
38 
39 size_t x509_verify(X509_VERIFY_CTX *ctx, X509 *leaf, char *name);
40 #endif
41 
42 #endif
43