1 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
4 * This package is an SSL implementation written
5 * by Eric Young (eay@cryptsoft.com).
6 * The implementation was written so as to conform with Netscapes SSL.
8 * This library is free for commercial and non-commercial use as long as
9 * the following conditions are aheared to. The following conditions
10 * apply to all code found in this distribution, be it the RC4, RSA,
11 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12 * included with this distribution is covered by the same copyright terms
13 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * Copyright remains Eric Young's, and as such any Copyright notices in
16 * the code are not to be removed.
17 * If this package is used in a product, Eric Young should be given attribution
18 * as the author of the parts of the library used.
19 * This can be in the form of a textual message at program startup or
20 * in documentation (online or textual) provided with the package.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
25 * 1. Redistributions of source code must retain the copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. All advertising materials mentioning features or use of this software
31 * must display the following acknowledgement:
32 * "This product includes cryptographic software written by
33 * Eric Young (eay@cryptsoft.com)"
34 * The word 'cryptographic' can be left out if the rouines from the library
35 * being used are not cryptographic related :-).
36 * 4. If you include any Windows specific code (or a derivative thereof) from
37 * the apps directory (application code) you must include an acknowledgement:
38 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * The licence and distribution terms for any publically available version or
53 * derivative of this code cannot be changed. i.e. this code cannot simply be
54 * copied and put under another distribution licence
55 * [including the GNU Public Licence.]
57 /* ====================================================================
58 * Copyright (c) 1998-2015 The OpenSSL Project. All rights reserved.
60 * Redistribution and use in source and binary forms, with or without
61 * modification, are permitted provided that the following conditions
64 * 1. Redistributions of source code must retain the above copyright
65 * notice, this list of conditions and the following disclaimer.
67 * 2. Redistributions in binary form must reproduce the above copyright
68 * notice, this list of conditions and the following disclaimer in
69 * the documentation and/or other materials provided with the
72 * 3. All advertising materials mentioning features or use of this
73 * software must display the following acknowledgment:
74 * "This product includes software developed by the OpenSSL Project
75 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
78 * endorse or promote products derived from this software without
79 * prior written permission. For written permission, please contact
80 * openssl-core@openssl.org.
82 * 5. Products derived from this software may not be called "OpenSSL"
83 * nor may "OpenSSL" appear in their names without prior written
84 * permission of the OpenSSL Project.
86 * 6. Redistributions of any form whatsoever must retain the following
88 * "This product includes software developed by the OpenSSL Project
89 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
92 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
95 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
96 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
97 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
98 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
99 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
100 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
102 * OF THE POSSIBILITY OF SUCH DAMAGE.
103 * ====================================================================
105 * This product includes cryptographic software written by Eric Young
106 * (eay@cryptsoft.com). This product includes software written by Tim
107 * Hudson (tjh@cryptsoft.com).
112 #include <openssl/objects.h>
113 #include "ssl_locl.h"
119 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
122 ossl_statem_connect, TLSv1_2_enc_data)
124 #ifndef OPENSSL_NO_TLS1_2_METHOD
125 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
128 ossl_statem_connect, TLSv1_2_enc_data)
131 #ifndef OPENSSL_NO_TLS1_1_METHOD
132 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
135 ossl_statem_connect, TLSv1_1_enc_data)
138 #ifndef OPENSSL_NO_TLS1_METHOD
139 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
142 ossl_statem_connect, TLSv1_enc_data)
145 #ifndef OPENSSL_NO_SSL3_METHOD
146 IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
151 * TLS/SSLv3 server methods
154 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
157 ssl_undefined_function,
160 #ifndef OPENSSL_NO_TLS1_2_METHOD
161 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
162 tlsv1_2_server_method,
164 ssl_undefined_function,
168 #ifndef OPENSSL_NO_TLS1_1_METHOD
169 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
170 tlsv1_1_server_method,
172 ssl_undefined_function,
176 #ifndef OPENSSL_NO_TLS1_METHOD
177 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
180 ssl_undefined_function,
184 #ifndef OPENSSL_NO_SSL3_METHOD
185 IMPLEMENT_ssl3_meth_func(sslv3_server_method,
187 ssl_undefined_function)
192 * TLS/SSLv3 client methods
195 IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
197 ssl_undefined_function,
201 #ifndef OPENSSL_NO_TLS1_2_METHOD
202 IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
203 tlsv1_2_client_method,
204 ssl_undefined_function,
209 #ifndef OPENSSL_NO_TLS1_1_METHOD
210 IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
211 tlsv1_1_client_method,
212 ssl_undefined_function,
217 #ifndef OPENSSL_NO_TLS1_METHOD
218 IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
220 ssl_undefined_function,
225 #ifndef OPENSSL_NO_SSL3_METHOD
226 IMPLEMENT_ssl3_meth_func(sslv3_client_method,
227 ssl_undefined_function,
236 #ifndef OPENSSL_NO_DTLS1_METHOD
237 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
244 #ifndef OPENSSL_NO_DTLS1_2_METHOD
245 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
252 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
259 * DTLS server methods
262 #ifndef OPENSSL_NO_DTLS1_METHOD
263 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
264 dtlsv1_server_method,
266 ssl_undefined_function,
270 #ifndef OPENSSL_NO_DTLS1_2_METHOD
271 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
272 dtlsv1_2_server_method,
274 ssl_undefined_function,
278 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
281 ssl_undefined_function,
286 * DTLS client methods
289 #ifndef OPENSSL_NO_DTLS1_METHOD
290 IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
291 dtlsv1_client_method,
292 ssl_undefined_function,
297 #ifndef OPENSSL_NO_DTLS1_2_METHOD
298 IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
299 dtlsv1_2_client_method,
300 ssl_undefined_function,
305 IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
307 ssl_undefined_function,
311 #if OPENSSL_API_COMPAT < 0x10100000L
313 # ifndef OPENSSL_NO_TLS1_2_METHOD
314 const SSL_METHOD *TLSv1_2_method(void)
316 return tlsv1_2_method();
319 const SSL_METHOD *TLSv1_2_server_method(void)
321 return tlsv1_2_server_method();
324 const SSL_METHOD *TLSv1_2_client_method(void)
326 return tlsv1_2_client_method();
330 # ifndef OPENSSL_NO_TLS1_1_METHOD
331 const SSL_METHOD *TLSv1_1_method(void)
333 return tlsv1_1_method();
336 const SSL_METHOD *TLSv1_1_server_method(void)
338 return tlsv1_1_server_method();
341 const SSL_METHOD *TLSv1_1_client_method(void)
343 return tlsv1_1_client_method();
347 # ifndef OPENSSL_NO_TLS1_METHOD
348 const SSL_METHOD *TLSv1_method(void)
350 return tlsv1_method();
353 const SSL_METHOD *TLSv1_server_method(void)
355 return tlsv1_server_method();
358 const SSL_METHOD *TLSv1_client_method(void)
360 return tlsv1_client_method();
364 # ifndef OPENSSL_NO_SSL3_METHOD
365 const SSL_METHOD *SSLv3_method(void)
367 return sslv3_method();
370 const SSL_METHOD *SSLv3_server_method(void)
372 return sslv3_server_method();
375 const SSL_METHOD *SSLv3_client_method(void)
377 return sslv3_client_method();
381 # ifndef OPENSSL_NO_DTLS1_2_METHOD
382 const SSL_METHOD *DTLSv1_2_method(void)
384 return dtlsv1_2_method();
387 const SSL_METHOD *DTLSv1_2_server_method(void)
389 return dtlsv1_2_server_method();
392 const SSL_METHOD *DTLSv1_2_client_method(void)
394 return dtlsv1_2_client_method();
398 # ifndef OPENSSL_NO_DTLS1_METHOD
399 const SSL_METHOD *DTLSv1_method(void)
401 return dtlsv1_method();
404 const SSL_METHOD *DTLSv1_server_method(void)
406 return dtlsv1_server_method();
409 const SSL_METHOD *DTLSv1_client_method(void)
411 return dtlsv1_client_method();