]> git.ozlabs.org Git - ppp.git/blob - pppd/tls.h
The use of <net/ppp_defs.h> isn't guranteed to exist on Linux (e.g. uclibc, buildroot...
[ppp.git] / pppd / tls.h
1 /*
2  * Copyright (c) 2021 Eivind Næss. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * 3. The name(s) of the authors of this software must not be used to
17  *    endorse or promote products derived from this software without
18  *    prior written permission.
19  *
20  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
21  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
23  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
25  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
26  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27  */
28
29 #ifndef PPP_TLS_H
30 #define PPP_TLS_H
31
32 #include "pppdconf.h"
33
34 /**
35  * Structure used in verifying the peer certificate
36  */
37 struct tls_info;
38
39 /**
40  * Initialize the SSL library
41  */
42 int tls_init();
43
44 /**
45  * Get the SSL_METHOD
46  */
47 const SSL_METHOD* tls_method();
48
49 /**
50  * Configure the SSL options
51  */
52 int tls_set_opts(SSL_CTX *ctx);
53
54 /**
55  * Configure the SSL context's max TLS version
56  */
57 int tls_set_version(SSL_CTX *ctx, const char *max_version);
58
59 /** 
60  * Configure the SSL context's verify callback
61  */
62 int tls_set_verify(SSL_CTX *ctx, int depth);
63
64 /**
65  * Configure the SSL verify information
66  */
67 int tls_set_verify_info(SSL *ssl, const char *peer_name, const char *peer_cert_file, 
68         bool client, struct tls_info **out);
69
70 /**
71  * Free the tls_info structure and it's members
72  */
73 void tls_free_verify_info(struct tls_info **in);
74
75 /**
76  * Configure the SSL context's CRL details
77  */
78 int tls_set_crl(SSL_CTX *ctx, const char *crl_dir, const char *crl_file);
79
80 /**
81  * Configure the SSL context's CA verify locations
82  */
83 int tls_set_ca(SSL_CTX *ctx, const char *ca_dir, const char *ca_file);
84
85 /**
86  * Log all errors from ssl library
87  */
88 void tls_log_sslerr( void );
89
90 #endif  /* PPP_TLS_H */