tls_none.c (3186B)
1 /*
2 * Copyright (c) 2022 Joris Vink <joris@coders.se>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /*
18 * An empty TLS backend that does nothing, useful if you do
19 * not require any TLS stuff in Kore.
20 */
21
22 #include <sys/types.h>
23
24 #include "kore.h"
25
26 struct kore_privsep keymgr_privsep;
27 char *kore_rand_file = NULL;
28 int kore_keymgr_active = 0;
29
30 int
31 kore_tls_supported(void)
32 {
33 return (KORE_RESULT_ERROR);
34 }
35
36 void
37 kore_keymgr_cleanup(int final)
38 {
39 }
40
41 void
42 kore_tls_init(void)
43 {
44 }
45
46 void
47 kore_tls_log_version(void)
48 {
49 kore_log(LOG_NOTICE, "No compiled in TLS backend");
50 }
51
52 void
53 kore_tls_cleanup(void)
54 {
55 }
56
57 void
58 kore_tls_dh_check(void)
59 {
60 }
61
62 void
63 kore_tls_keymgr_init(void)
64 {
65 }
66
67 void
68 kore_tls_connection_cleanup(struct connection *c)
69 {
70 }
71
72 void
73 kore_tls_domain_cleanup(struct kore_domain *dom)
74 {
75 }
76
77 void
78 kore_tls_seed(const void *data, size_t len)
79 {
80 }
81
82 void
83 kore_keymgr_run(void)
84 {
85 fatal("%s: not supported", __func__);
86 }
87
88 void
89 kore_tls_version_set(int version)
90 {
91 fatal("%s: not supported", __func__);
92 }
93
94 int
95 kore_tls_dh_load(const char *path)
96 {
97 fatal("%s: not supported", __func__);
98 }
99
100 int
101 kore_tls_ciphersuite_set(const char *list)
102 {
103 fatal("%s: not supported", __func__);
104 }
105
106 void
107 kore_tls_domain_setup(struct kore_domain *dom, int type,
108 const void *data, size_t datalen)
109 {
110 fatal("%s: not supported", __func__);
111 }
112
113 void
114 kore_tls_domain_crl(struct kore_domain *dom, const void *pem, size_t pemlen)
115 {
116 fatal("%s: not supported", __func__);
117 }
118
119 int
120 kore_tls_connection_accept(struct connection *c)
121 {
122 fatal("%s: not supported", __func__);
123 }
124
125 int
126 kore_tls_read(struct connection *c, size_t *bytes)
127 {
128 fatal("%s: not supported", __func__);
129 }
130
131 int
132 kore_tls_write(struct connection *c, size_t len, size_t *written)
133 {
134 fatal("%s: not supported", __func__);
135 }
136
137 KORE_PRIVATE_KEY *
138 kore_tls_rsakey_load(const char *path)
139 {
140 fatal("%s: not supported", __func__);
141 }
142
143 KORE_PRIVATE_KEY *
144 kore_tls_rsakey_generate(const char *path)
145 {
146 fatal("%s: not supported", __func__);
147 }
148
149 KORE_X509_NAMES *
150 kore_tls_x509_subject_name(struct connection *c)
151 {
152 fatal("%s: not supported", __func__);
153 }
154
155 KORE_X509_NAMES *
156 kore_tls_x509_issuer_name(struct connection *c)
157 {
158 fatal("%s: not supported", __func__);
159 }
160
161 int
162 kore_tls_x509name_foreach(KORE_X509_NAMES *name, int flags, void *udata,
163 int (*cb)(void *, int, int, const char *, const void *, size_t, int))
164 {
165 fatal("%s: not supported", __func__);
166 }
167
168 int
169 kore_tls_x509_data(struct connection *c, u_int8_t **ptr, size_t *olen)
170 {
171 fatal("%s: not supported", __func__);
172 }