blob: f0926b7ce0ba54e812b8a1ec15a60efdec8083be [file] [log] [blame]
Rich Salz846e33c2016-05-17 14:18:30 -04001/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
Matt Caswell8ba708e2015-09-11 10:48:59 +01003 *
Rich Salz846e33c2016-05-17 14:18:30 -04004 * Licensed under the OpenSSL license (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
Matt Caswell8ba708e2015-09-11 10:48:59 +01008 */
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +01009
Matt Caswell8ba708e2015-09-11 10:48:59 +010010#include <stdio.h>
11#include <openssl/objects.h>
12#include "ssl_locl.h"
13
Emilia Kaspera230b262016-08-05 19:03:17 +020014/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010015 * TLS/SSLv3 methods
16 */
17
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050018IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
19 TLS_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010020 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030021 ossl_statem_connect, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010022#ifndef OPENSSL_NO_TLS1_3_METHOD
23IMPLEMENT_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#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050028#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050029IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010030 tlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010031 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030032 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050033#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050034#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050035IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010036 tlsv1_1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010037 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030038 ossl_statem_connect, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050039#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050040#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050041IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010042 tlsv1_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020043 ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050044#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010045#ifndef OPENSSL_NO_SSL3_METHOD
Fedor Indutnyccae4a12016-03-11 17:44:01 +030046IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +010047#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020048/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010049 * TLS/SSLv3 server methods
50 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050051IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
52 TLS_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010053 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020054 ssl_undefined_function, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010055#ifndef OPENSSL_NO_TLS1_3_METHOD
56IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
57 tlsv1_3_server_method,
58 ossl_statem_accept,
59 ssl_undefined_function, TLSv1_3_enc_data)
60#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050061#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050062IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010063 tlsv1_2_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010064 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020065 ssl_undefined_function, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050066#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050067#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050068IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010069 tlsv1_1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010070 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020071 ssl_undefined_function, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050072#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050073#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050074IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010075 tlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010076 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020077 ssl_undefined_function, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050078#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010079#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010080IMPLEMENT_ssl3_meth_func(sslv3_server_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020081 ossl_statem_accept, ssl_undefined_function)
Matt Caswell8ba708e2015-09-11 10:48:59 +010082#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020083/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010084 * TLS/SSLv3 client methods
85 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050086IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
87 TLS_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010088 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +020089 ossl_statem_connect, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010090#ifndef OPENSSL_NO_TLS1_3_METHOD
91IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
92 tlsv1_3_client_method,
93 ssl_undefined_function,
94 ossl_statem_connect, TLSv1_3_enc_data)
95#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050096#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050097IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010098 tlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010099 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200100 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500101#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500102#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500103IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100104 tlsv1_1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100105 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200106 ossl_statem_connect, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500107#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500108#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500109IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100110 tlsv1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100111 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200112 ossl_statem_connect, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500113#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +0100114#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100115IMPLEMENT_ssl3_meth_func(sslv3_client_method,
Emilia Kaspera230b262016-08-05 19:03:17 +0200116 ssl_undefined_function, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100117#endif
Emilia Kaspera230b262016-08-05 19:03:17 +0200118/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100119 * DTLS methods
120 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500121#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500122IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100123 dtlsv1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100124 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200125 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500126#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500127#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500128IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100129 dtlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100130 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200131 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500132#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500133IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100134 DTLS_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100135 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200136 ossl_statem_connect, DTLSv1_2_enc_data)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100137
Emilia Kaspera230b262016-08-05 19:03:17 +0200138/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100139 * DTLS server methods
140 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500141#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500142IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100143 dtlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100144 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200145 ssl_undefined_function, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500146#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500147#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500148IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100149 dtlsv1_2_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100150 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200151 ssl_undefined_function, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500152#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500153IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100154 DTLS_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100155 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200156 ssl_undefined_function, DTLSv1_2_enc_data)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100157
Emilia Kaspera230b262016-08-05 19:03:17 +0200158/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100159 * DTLS client methods
160 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500161#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500162IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100163 dtlsv1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100164 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200165 ossl_statem_connect, DTLSv1_enc_data)
David Woodhouse032924c2016-07-25 18:03:27 +0100166IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
167 dtls_bad_ver_client_method,
168 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200169 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500170#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500171#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500172IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100173 dtlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100174 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200175 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500176#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500177IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100178 DTLS_client_method,
179 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200180 ossl_statem_connect, DTLSv1_2_enc_data)
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100181#if OPENSSL_API_COMPAT < 0x10100000L
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100182# ifndef OPENSSL_NO_TLS1_2_METHOD
183const SSL_METHOD *TLSv1_2_method(void)
184{
185 return tlsv1_2_method();
186}
187
188const SSL_METHOD *TLSv1_2_server_method(void)
189{
190 return tlsv1_2_server_method();
191}
192
193const SSL_METHOD *TLSv1_2_client_method(void)
194{
195 return tlsv1_2_client_method();
196}
197# endif
198
199# ifndef OPENSSL_NO_TLS1_1_METHOD
200const SSL_METHOD *TLSv1_1_method(void)
201{
202 return tlsv1_1_method();
203}
204
205const SSL_METHOD *TLSv1_1_server_method(void)
206{
207 return tlsv1_1_server_method();
208}
209
210const SSL_METHOD *TLSv1_1_client_method(void)
211{
212 return tlsv1_1_client_method();
213}
214# endif
215
216# ifndef OPENSSL_NO_TLS1_METHOD
217const SSL_METHOD *TLSv1_method(void)
218{
219 return tlsv1_method();
220}
221
222const SSL_METHOD *TLSv1_server_method(void)
223{
224 return tlsv1_server_method();
225}
226
227const SSL_METHOD *TLSv1_client_method(void)
228{
229 return tlsv1_client_method();
230}
231# endif
232
233# ifndef OPENSSL_NO_SSL3_METHOD
234const SSL_METHOD *SSLv3_method(void)
235{
236 return sslv3_method();
237}
238
239const SSL_METHOD *SSLv3_server_method(void)
240{
241 return sslv3_server_method();
242}
243
244const SSL_METHOD *SSLv3_client_method(void)
245{
246 return sslv3_client_method();
247}
248# endif
249
250# ifndef OPENSSL_NO_DTLS1_2_METHOD
251const SSL_METHOD *DTLSv1_2_method(void)
252{
253 return dtlsv1_2_method();
254}
255
256const SSL_METHOD *DTLSv1_2_server_method(void)
257{
258 return dtlsv1_2_server_method();
259}
260
261const SSL_METHOD *DTLSv1_2_client_method(void)
262{
263 return dtlsv1_2_client_method();
264}
265# endif
266
267# ifndef OPENSSL_NO_DTLS1_METHOD
268const SSL_METHOD *DTLSv1_method(void)
269{
270 return dtlsv1_method();
271}
272
273const SSL_METHOD *DTLSv1_server_method(void)
274{
275 return dtlsv1_server_method();
276}
277
278const SSL_METHOD *DTLSv1_client_method(void)
279{
280 return dtlsv1_client_method();
281}
282# endif
283
284#endif