]> git.ipfire.org Git - thirdparty/openssl.git/blob - ssl/methods.c
Raise an error on syscall failure in tls_retry_write_records
[thirdparty/openssl.git] / ssl / methods.c
1 /*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10 #include <stdio.h>
11 #include <openssl/macros.h>
12 #include <openssl/objects.h>
13 #include "ssl_local.h"
14
15 /*-
16 * TLS/SSLv3 methods
17 */
18
19 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
20 TLS_method,
21 ossl_statem_accept,
22 ossl_statem_connect, TLSv1_2_enc_data)
23 IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
24 tlsv1_3_method,
25 ossl_statem_accept,
26 ossl_statem_connect, TLSv1_3_enc_data)
27 #ifndef OPENSSL_NO_TLS1_2_METHOD
28 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
29 tlsv1_2_method,
30 ossl_statem_accept,
31 ossl_statem_connect, TLSv1_2_enc_data)
32 #endif
33 #ifndef OPENSSL_NO_TLS1_1_METHOD
34 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
35 tlsv1_1_method,
36 ossl_statem_accept,
37 ossl_statem_connect, TLSv1_1_enc_data)
38 #endif
39 #ifndef OPENSSL_NO_TLS1_METHOD
40 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
41 tlsv1_method,
42 ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
43 #endif
44 #ifndef OPENSSL_NO_SSL3_METHOD
45 IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
46 #endif
47 /*-
48 * TLS/SSLv3 server methods
49 */
50 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
51 TLS_server_method,
52 ossl_statem_accept,
53 ssl_undefined_function, TLSv1_2_enc_data)
54 IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
55 tlsv1_3_server_method,
56 ossl_statem_accept,
57 ssl_undefined_function, TLSv1_3_enc_data)
58 #ifndef OPENSSL_NO_TLS1_2_METHOD
59 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
60 tlsv1_2_server_method,
61 ossl_statem_accept,
62 ssl_undefined_function, TLSv1_2_enc_data)
63 #endif
64 #ifndef OPENSSL_NO_TLS1_1_METHOD
65 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
66 tlsv1_1_server_method,
67 ossl_statem_accept,
68 ssl_undefined_function, TLSv1_1_enc_data)
69 #endif
70 #ifndef OPENSSL_NO_TLS1_METHOD
71 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
72 tlsv1_server_method,
73 ossl_statem_accept,
74 ssl_undefined_function, TLSv1_enc_data)
75 #endif
76 #ifndef OPENSSL_NO_SSL3_METHOD
77 IMPLEMENT_ssl3_meth_func(sslv3_server_method,
78 ossl_statem_accept, ssl_undefined_function)
79 #endif
80 /*-
81 * TLS/SSLv3 client methods
82 */
83 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
84 TLS_client_method,
85 ssl_undefined_function,
86 ossl_statem_connect, TLSv1_2_enc_data)
87 IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
88 tlsv1_3_client_method,
89 ssl_undefined_function,
90 ossl_statem_connect, TLSv1_3_enc_data)
91 #ifndef OPENSSL_NO_TLS1_2_METHOD
92 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
93 tlsv1_2_client_method,
94 ssl_undefined_function,
95 ossl_statem_connect, TLSv1_2_enc_data)
96 #endif
97 #ifndef OPENSSL_NO_TLS1_1_METHOD
98 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
99 tlsv1_1_client_method,
100 ssl_undefined_function,
101 ossl_statem_connect, TLSv1_1_enc_data)
102 #endif
103 #ifndef OPENSSL_NO_TLS1_METHOD
104 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
105 tlsv1_client_method,
106 ssl_undefined_function,
107 ossl_statem_connect, TLSv1_enc_data)
108 #endif
109 #ifndef OPENSSL_NO_SSL3_METHOD
110 IMPLEMENT_ssl3_meth_func(sslv3_client_method,
111 ssl_undefined_function, ossl_statem_connect)
112 #endif
113 /*-
114 * DTLS methods
115 */
116 #ifndef OPENSSL_NO_DTLS1_METHOD
117 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
118 dtlsv1_method,
119 ossl_statem_accept,
120 ossl_statem_connect, DTLSv1_enc_data)
121 #endif
122 #ifndef OPENSSL_NO_DTLS1_2_METHOD
123 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
124 dtlsv1_2_method,
125 ossl_statem_accept,
126 ossl_statem_connect, DTLSv1_2_enc_data)
127 #endif
128 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
129 DTLS_method,
130 ossl_statem_accept,
131 ossl_statem_connect, DTLSv1_2_enc_data)
132
133 /*-
134 * DTLS server methods
135 */
136 #ifndef OPENSSL_NO_DTLS1_METHOD
137 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
138 dtlsv1_server_method,
139 ossl_statem_accept,
140 ssl_undefined_function, DTLSv1_enc_data)
141 #endif
142 #ifndef OPENSSL_NO_DTLS1_2_METHOD
143 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
144 dtlsv1_2_server_method,
145 ossl_statem_accept,
146 ssl_undefined_function, DTLSv1_2_enc_data)
147 #endif
148 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
149 DTLS_server_method,
150 ossl_statem_accept,
151 ssl_undefined_function, DTLSv1_2_enc_data)
152
153 /*-
154 * DTLS client methods
155 */
156 #ifndef OPENSSL_NO_DTLS1_METHOD
157 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
158 dtlsv1_client_method,
159 ssl_undefined_function,
160 ossl_statem_connect, DTLSv1_enc_data)
161 IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
162 dtls_bad_ver_client_method,
163 ssl_undefined_function,
164 ossl_statem_connect, DTLSv1_enc_data)
165 #endif
166 #ifndef OPENSSL_NO_DTLS1_2_METHOD
167 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
168 dtlsv1_2_client_method,
169 ssl_undefined_function,
170 ossl_statem_connect, DTLSv1_2_enc_data)
171 #endif
172 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
173 DTLS_client_method,
174 ssl_undefined_function,
175 ossl_statem_connect, DTLSv1_2_enc_data)
176 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
177 # ifndef OPENSSL_NO_TLS1_2_METHOD
178 const SSL_METHOD *TLSv1_2_method(void)
179 {
180 return tlsv1_2_method();
181 }
182
183 const SSL_METHOD *TLSv1_2_server_method(void)
184 {
185 return tlsv1_2_server_method();
186 }
187
188 const SSL_METHOD *TLSv1_2_client_method(void)
189 {
190 return tlsv1_2_client_method();
191 }
192 # endif
193
194 # ifndef OPENSSL_NO_TLS1_1_METHOD
195 const SSL_METHOD *TLSv1_1_method(void)
196 {
197 return tlsv1_1_method();
198 }
199
200 const SSL_METHOD *TLSv1_1_server_method(void)
201 {
202 return tlsv1_1_server_method();
203 }
204
205 const SSL_METHOD *TLSv1_1_client_method(void)
206 {
207 return tlsv1_1_client_method();
208 }
209 # endif
210
211 # ifndef OPENSSL_NO_TLS1_METHOD
212 const SSL_METHOD *TLSv1_method(void)
213 {
214 return tlsv1_method();
215 }
216
217 const SSL_METHOD *TLSv1_server_method(void)
218 {
219 return tlsv1_server_method();
220 }
221
222 const SSL_METHOD *TLSv1_client_method(void)
223 {
224 return tlsv1_client_method();
225 }
226 # endif
227
228 # ifndef OPENSSL_NO_SSL3_METHOD
229 const SSL_METHOD *SSLv3_method(void)
230 {
231 return sslv3_method();
232 }
233
234 const SSL_METHOD *SSLv3_server_method(void)
235 {
236 return sslv3_server_method();
237 }
238
239 const SSL_METHOD *SSLv3_client_method(void)
240 {
241 return sslv3_client_method();
242 }
243 # endif
244
245 # ifndef OPENSSL_NO_DTLS1_2_METHOD
246 const SSL_METHOD *DTLSv1_2_method(void)
247 {
248 return dtlsv1_2_method();
249 }
250
251 const SSL_METHOD *DTLSv1_2_server_method(void)
252 {
253 return dtlsv1_2_server_method();
254 }
255
256 const SSL_METHOD *DTLSv1_2_client_method(void)
257 {
258 return dtlsv1_2_client_method();
259 }
260 # endif
261
262 # ifndef OPENSSL_NO_DTLS1_METHOD
263 const SSL_METHOD *DTLSv1_method(void)
264 {
265 return dtlsv1_method();
266 }
267
268 const SSL_METHOD *DTLSv1_server_method(void)
269 {
270 return dtlsv1_server_method();
271 }
272
273 const SSL_METHOD *DTLSv1_client_method(void)
274 {
275 return dtlsv1_client_method();
276 }
277 # endif
278
279 #endif