blob: 348efe467dbbcbef2355fe75b20ea52b46e2ab5d [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 +010022IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
23 tlsv1_3_method,
24 ossl_statem_accept,
25 ossl_statem_connect, TLSv1_3_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050026#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050027IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010028 tlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010029 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030030 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050031#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050032#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050033IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010034 tlsv1_1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010035 ossl_statem_accept,
Fedor Indutnyccae4a12016-03-11 17:44:01 +030036 ossl_statem_connect, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050037#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050038#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050039IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010040 tlsv1_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020041 ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050042#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010043#ifndef OPENSSL_NO_SSL3_METHOD
Fedor Indutnyccae4a12016-03-11 17:44:01 +030044IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +010045#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020046/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010047 * TLS/SSLv3 server methods
48 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050049IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
50 TLS_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010051 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020052 ssl_undefined_function, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010053IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
54 tlsv1_3_server_method,
55 ossl_statem_accept,
56 ssl_undefined_function, TLSv1_3_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050057#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050058IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010059 tlsv1_2_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010060 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020061 ssl_undefined_function, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050062#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050063#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050064IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010065 tlsv1_1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010066 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020067 ssl_undefined_function, TLSv1_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050068#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050069#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050070IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010071 tlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +010072 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +020073 ssl_undefined_function, TLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050074#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +010075#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010076IMPLEMENT_ssl3_meth_func(sslv3_server_method,
Emilia Kaspera230b262016-08-05 19:03:17 +020077 ossl_statem_accept, ssl_undefined_function)
Matt Caswell8ba708e2015-09-11 10:48:59 +010078#endif
Emilia Kaspera230b262016-08-05 19:03:17 +020079/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +010080 * TLS/SSLv3 client methods
81 */
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050082IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
83 TLS_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010084 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +020085 ossl_statem_connect, TLSv1_2_enc_data)
Matt Caswell582a17d2016-10-21 17:39:33 +010086IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
87 tlsv1_3_client_method,
88 ssl_undefined_function,
89 ossl_statem_connect, TLSv1_3_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050090#ifndef OPENSSL_NO_TLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050091IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010092 tlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +010093 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +020094 ossl_statem_connect, TLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050095#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -050096#ifndef OPENSSL_NO_TLS1_1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -050097IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +010098 tlsv1_1_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_1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500101#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500102#ifndef OPENSSL_NO_TLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500103IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100104 tlsv1_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_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500107#endif
Matt Caswell8ba708e2015-09-11 10:48:59 +0100108#ifndef OPENSSL_NO_SSL3_METHOD
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100109IMPLEMENT_ssl3_meth_func(sslv3_client_method,
Emilia Kaspera230b262016-08-05 19:03:17 +0200110 ssl_undefined_function, ossl_statem_connect)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100111#endif
Emilia Kaspera230b262016-08-05 19:03:17 +0200112/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100113 * DTLS methods
114 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500115#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500116IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100117 dtlsv1_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100118 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200119 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500120#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500121#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500122IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100123 dtlsv1_2_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100124 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200125 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500126#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500127IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100128 DTLS_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100129 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200130 ossl_statem_connect, DTLSv1_2_enc_data)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100131
Emilia Kaspera230b262016-08-05 19:03:17 +0200132/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100133 * DTLS server methods
134 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500135#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500136IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100137 dtlsv1_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100138 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200139 ssl_undefined_function, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500140#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500141#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500142IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100143 dtlsv1_2_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_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500146#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500147IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100148 DTLS_server_method,
Matt Caswellfe3a3292015-10-05 10:39:54 +0100149 ossl_statem_accept,
Emilia Kaspera230b262016-08-05 19:03:17 +0200150 ssl_undefined_function, DTLSv1_2_enc_data)
Matt Caswell8ba708e2015-09-11 10:48:59 +0100151
Emilia Kaspera230b262016-08-05 19:03:17 +0200152/*-
Matt Caswell8ba708e2015-09-11 10:48:59 +0100153 * DTLS client methods
154 */
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500155#ifndef OPENSSL_NO_DTLS1_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500156IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100157 dtlsv1_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100158 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200159 ossl_statem_connect, DTLSv1_enc_data)
David Woodhouse032924c2016-07-25 18:03:27 +0100160IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
161 dtls_bad_ver_client_method,
162 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200163 ossl_statem_connect, DTLSv1_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500164#endif
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500165#ifndef OPENSSL_NO_DTLS1_2_METHOD
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500166IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100167 dtlsv1_2_client_method,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100168 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200169 ossl_statem_connect, DTLSv1_2_enc_data)
Viktor Dukhovni6b01bed2016-01-18 13:10:21 -0500170#endif
Viktor Dukhovni4fa52142015-12-29 03:24:17 -0500171IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
Matt Caswell8ba708e2015-09-11 10:48:59 +0100172 DTLS_client_method,
173 ssl_undefined_function,
Emilia Kaspera230b262016-08-05 19:03:17 +0200174 ossl_statem_connect, DTLSv1_2_enc_data)
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100175#if OPENSSL_API_COMPAT < 0x10100000L
Kurt Roeckx2b8fa1d2016-03-02 22:39:40 +0100176# ifndef OPENSSL_NO_TLS1_2_METHOD
177const SSL_METHOD *TLSv1_2_method(void)
178{
179 return tlsv1_2_method();
180}
181
182const SSL_METHOD *TLSv1_2_server_method(void)
183{
184 return tlsv1_2_server_method();
185}
186
187const SSL_METHOD *TLSv1_2_client_method(void)
188{
189 return tlsv1_2_client_method();
190}
191# endif
192
193# ifndef OPENSSL_NO_TLS1_1_METHOD
194const SSL_METHOD *TLSv1_1_method(void)
195{
196 return tlsv1_1_method();
197}
198
199const SSL_METHOD *TLSv1_1_server_method(void)
200{
201 return tlsv1_1_server_method();
202}
203
204const SSL_METHOD *TLSv1_1_client_method(void)
205{
206 return tlsv1_1_client_method();
207}
208# endif
209
210# ifndef OPENSSL_NO_TLS1_METHOD
211const SSL_METHOD *TLSv1_method(void)
212{
213 return tlsv1_method();
214}
215
216const SSL_METHOD *TLSv1_server_method(void)
217{
218 return tlsv1_server_method();
219}
220
221const SSL_METHOD *TLSv1_client_method(void)
222{
223 return tlsv1_client_method();
224}
225# endif
226
227# ifndef OPENSSL_NO_SSL3_METHOD
228const SSL_METHOD *SSLv3_method(void)
229{
230 return sslv3_method();
231}
232
233const SSL_METHOD *SSLv3_server_method(void)
234{
235 return sslv3_server_method();
236}
237
238const SSL_METHOD *SSLv3_client_method(void)
239{
240 return sslv3_client_method();
241}
242# endif
243
244# ifndef OPENSSL_NO_DTLS1_2_METHOD
245const SSL_METHOD *DTLSv1_2_method(void)
246{
247 return dtlsv1_2_method();
248}
249
250const SSL_METHOD *DTLSv1_2_server_method(void)
251{
252 return dtlsv1_2_server_method();
253}
254
255const SSL_METHOD *DTLSv1_2_client_method(void)
256{
257 return dtlsv1_2_client_method();
258}
259# endif
260
261# ifndef OPENSSL_NO_DTLS1_METHOD
262const SSL_METHOD *DTLSv1_method(void)
263{
264 return dtlsv1_method();
265}
266
267const SSL_METHOD *DTLSv1_server_method(void)
268{
269 return dtlsv1_server_method();
270}
271
272const SSL_METHOD *DTLSv1_client_method(void)
273{
274 return dtlsv1_client_method();
275}
276# endif
277
278#endif