blob: 525f59e91231c7b4c2004d7b6d71e98e09698eba [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 *
Richard Levitte2c18d162018-12-06 13:08:51 +01004 * Licensed under the Apache License 2.0 (the "License"). You may not use
Rich Salz846e33c2016-05-17 14:18:30 -04005 * 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>
Richard Levitte285a0db2019-11-05 17:36:44 +010011#include <openssl/macros.h>
Matt Caswell8ba708e2015-09-11 10:48:59 +010012#include <openssl/objects.h>
Dr. Matthias St. Pierre706457b2019-09-28 00:45:40 +020013#include "ssl_local.h"
Matt Caswell8ba708e2015-09-11 10:48:59 +010014
Emilia Kaspera230b262016-08-05 19:03:17 +020015/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010016 * TLS/SSLv3 methods
17 */
18
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050019IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
20 TLS_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010021 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030022 ossl_statem_connect, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010023IMPLEMENT_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)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050027#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050028IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010029 tlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010030 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030031 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050032#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050033#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050034IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010035 tlsv1_1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010036 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030037 ossl_statem_connect, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050038#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050039#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050040IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010041 tlsv1_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020042 ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050043#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010044#ifndef OPENSSL_NO_SSL3_METHOD
Fedor Indutnyccae4a12016-03-11 17:44:01 +030045IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +010046#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020047/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010048 * TLS/SSLv3 server methods
49 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050050IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
51 TLS_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010052 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020053 ssl_undefined_function, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010054IMPLEMENT_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)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050058#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050059IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010060 tlsv1_2_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010061 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020062 ssl_undefined_function, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050063#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050064#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050065IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010066 tlsv1_1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010067 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020068 ssl_undefined_function, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050069#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050070#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050071IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010072 tlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010073 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020074 ssl_undefined_function, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050075#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010076#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010077IMPLEMENT_ssl3_meth_func(sslv3_server_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020078 ossl_statem_accept, ssl_undefined_function)
Matt Caswell8ba708e2015-09-11 10:48:59 +010079#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020080/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010081 * TLS/SSLv3 client methods
82 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050083IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
84 TLS_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010085 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +020086 ossl_statem_connect, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010087IMPLEMENT_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)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050091#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050092IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010093 tlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010094 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +020095 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050096#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050097#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050098IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010099 tlsv1_1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100100 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200101 ossl_statem_connect, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500102#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500103#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500104IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100105 tlsv1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100106 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200107 ossl_statem_connect, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500108#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +0100109#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100110IMPLEMENT_ssl3_meth_func(sslv3_client_method,
Emilia Kaspera230b262016-08-05 19:03:17 +0200111 ssl_undefined_function, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100112#endif
Emilia Kaspera230b262016-08-05 19:03:17 +0200113/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100114 * DTLS methods
115 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500116#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500117IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100118 dtlsv1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100119 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200120 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500121#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500122#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500123IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100124 dtlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100125 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200126 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500127#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500128IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100129 DTLS_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)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100132
Emilia Kaspera230b262016-08-05 19:03:17 +0200133/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100134 * DTLS server methods
135 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500136#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500137IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100138 dtlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100139 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200140 ssl_undefined_function, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500141#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500142#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500143IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100144 dtlsv1_2_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100145 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200146 ssl_undefined_function, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500147#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500148IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100149 DTLS_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)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100152
Emilia Kaspera230b262016-08-05 19:03:17 +0200153/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100154 * DTLS client methods
155 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500156#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500157IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100158 dtlsv1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100159 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200160 ossl_statem_connect, DTLSv1_enc_data)
David Woodhouse032924c2016-07-25 18:03:27 +0100161IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
162 dtls_bad_ver_client_method,
163 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200164 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500165#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500166#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500167IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100168 dtlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100169 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200170 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500171#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500172IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100173 DTLS_client_method,
174 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200175 ossl_statem_connect, DTLSv1_2_enc_data)
Richard Levitte00db8c62019-11-05 17:34:09 +0100176#ifndef OPENSSL_NO_DEPRECATED_1_1_0
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100177# ifndef OPENSSL_NO_TLS1_2_METHOD
178const SSL_METHOD *TLSv1_2_method(void)
179{
180 return tlsv1_2_method();
181}
182
183const SSL_METHOD *TLSv1_2_server_method(void)
184{
185 return tlsv1_2_server_method();
186}
187
188const 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
195const SSL_METHOD *TLSv1_1_method(void)
196{
197 return tlsv1_1_method();
198}
199
200const SSL_METHOD *TLSv1_1_server_method(void)
201{
202 return tlsv1_1_server_method();
203}
204
205const SSL_METHOD *TLSv1_1_client_method(void)
206{
207 return tlsv1_1_client_method();
208}
209# endif
210
211# ifndef OPENSSL_NO_TLS1_METHOD
212const SSL_METHOD *TLSv1_method(void)
213{
214 return tlsv1_method();
215}
216
217const SSL_METHOD *TLSv1_server_method(void)
218{
219 return tlsv1_server_method();
220}
221
222const SSL_METHOD *TLSv1_client_method(void)
223{
224 return tlsv1_client_method();
225}
226# endif
227
228# ifndef OPENSSL_NO_SSL3_METHOD
229const SSL_METHOD *SSLv3_method(void)
230{
231 return sslv3_method();
232}
233
234const SSL_METHOD *SSLv3_server_method(void)
235{
236 return sslv3_server_method();
237}
238
239const SSL_METHOD *SSLv3_client_method(void)
240{
241 return sslv3_client_method();
242}
243# endif
244
245# ifndef OPENSSL_NO_DTLS1_2_METHOD
246const SSL_METHOD *DTLSv1_2_method(void)
247{
248 return dtlsv1_2_method();
249}
250
251const SSL_METHOD *DTLSv1_2_server_method(void)
252{
253 return dtlsv1_2_server_method();
254}
255
256const SSL_METHOD *DTLSv1_2_client_method(void)
257{
258 return dtlsv1_2_client_method();
259}
260# endif
261
262# ifndef OPENSSL_NO_DTLS1_METHOD
263const SSL_METHOD *DTLSv1_method(void)
264{
265 return dtlsv1_method();
266}
267
268const SSL_METHOD *DTLSv1_server_method(void)
269{
270 return dtlsv1_server_method();
271}
272
273const SSL_METHOD *DTLSv1_client_method(void)
274{
275 return dtlsv1_client_method();
276}
277# endif
278
279#endif