2016-05-18 02:18:30 +08:00
|
|
|
/*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2015-09-11 17:48:59 +08:00
|
|
|
*
|
2018-12-06 20:08:51 +08:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 02:18:30 +08:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2015-09-11 17:48:59 +08:00
|
|
|
*/
|
2016-03-03 05:39:40 +08:00
|
|
|
|
2015-09-11 17:48:59 +08:00
|
|
|
#include <stdio.h>
|
2019-11-06 00:36:44 +08:00
|
|
|
#include <openssl/macros.h>
|
2015-09-11 17:48:59 +08:00
|
|
|
#include <openssl/objects.h>
|
2019-09-28 06:45:40 +08:00
|
|
|
#include "ssl_local.h"
|
2015-09-11 17:48:59 +08:00
|
|
|
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* TLS/SSLv3 methods
|
|
|
|
*/
|
|
|
|
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
|
|
|
TLS_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-03-11 22:44:01 +08:00
|
|
|
ossl_statem_connect, TLSv1_2_enc_data)
|
2016-10-22 00:39:33 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
|
|
|
|
tlsv1_3_method,
|
|
|
|
ossl_statem_accept,
|
|
|
|
ossl_statem_connect, TLSv1_3_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_2_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-03-11 22:44:01 +08:00
|
|
|
ossl_statem_connect, TLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_1_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-03-11 22:44:01 +08:00
|
|
|
ossl_statem_connect, TLSv1_1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_method,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_accept, ossl_statem_connect, TLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-09-11 17:48:59 +08:00
|
|
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
2016-03-11 22:44:01 +08:00
|
|
|
IMPLEMENT_ssl3_meth_func(sslv3_method, ossl_statem_accept, ossl_statem_connect)
|
2015-09-11 17:48:59 +08:00
|
|
|
#endif
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* TLS/SSLv3 server methods
|
|
|
|
*/
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
|
|
|
TLS_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, TLSv1_2_enc_data)
|
2016-10-22 00:39:33 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
|
|
|
|
tlsv1_3_server_method,
|
|
|
|
ossl_statem_accept,
|
|
|
|
ssl_undefined_function, TLSv1_3_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_2_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, TLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_1_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, TLSv1_1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, TLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-09-11 17:48:59 +08:00
|
|
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
2016-03-03 05:39:40 +08:00
|
|
|
IMPLEMENT_ssl3_meth_func(sslv3_server_method,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_accept, ssl_undefined_function)
|
2015-09-11 17:48:59 +08:00
|
|
|
#endif
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* TLS/SSLv3 client methods
|
|
|
|
*/
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, 0, 0,
|
|
|
|
TLS_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, TLSv1_2_enc_data)
|
2016-10-22 00:39:33 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_3_VERSION, 0, SSL_OP_NO_TLSv1_3,
|
|
|
|
tlsv1_3_client_method,
|
|
|
|
ssl_undefined_function,
|
|
|
|
ossl_statem_connect, TLSv1_3_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_TLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_2_VERSION, 0, SSL_OP_NO_TLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_2_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, TLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1_1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_1_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, TLSv1_1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_TLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_tls_meth_func(TLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_TLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
tlsv1_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, TLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-09-11 17:48:59 +08:00
|
|
|
#ifndef OPENSSL_NO_SSL3_METHOD
|
2016-03-03 05:39:40 +08:00
|
|
|
IMPLEMENT_ssl3_meth_func(sslv3_client_method,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, ossl_statem_connect)
|
2015-09-11 17:48:59 +08:00
|
|
|
#endif
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* DTLS methods
|
|
|
|
*/
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_2_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
2015-09-11 17:48:59 +08:00
|
|
|
DTLS_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
2015-09-11 17:48:59 +08:00
|
|
|
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* DTLS server methods
|
|
|
|
*/
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, DTLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_2_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, DTLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
2015-09-11 17:48:59 +08:00
|
|
|
DTLS_server_method,
|
2015-10-05 17:39:54 +08:00
|
|
|
ossl_statem_accept,
|
2016-08-06 01:03:17 +08:00
|
|
|
ssl_undefined_function, DTLSv1_2_enc_data)
|
2015-09-11 17:48:59 +08:00
|
|
|
|
2016-08-06 01:03:17 +08:00
|
|
|
/*-
|
2015-09-11 17:48:59 +08:00
|
|
|
* DTLS client methods
|
|
|
|
*/
|
2016-01-19 02:10:21 +08:00
|
|
|
#ifndef OPENSSL_NO_DTLS1_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_VERSION, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_enc_data)
|
2016-07-26 01:03:27 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_BAD_VER, SSL_METHOD_NO_SUITEB, SSL_OP_NO_DTLSv1,
|
|
|
|
dtls_bad_ver_client_method,
|
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_DTLS1_2_METHOD
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS1_2_VERSION, 0, SSL_OP_NO_DTLSv1_2,
|
2016-03-03 05:39:40 +08:00
|
|
|
dtlsv1_2_client_method,
|
2015-09-11 17:48:59 +08:00
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
2016-01-19 02:10:21 +08:00
|
|
|
#endif
|
2015-12-29 16:24:17 +08:00
|
|
|
IMPLEMENT_dtls1_meth_func(DTLS_ANY_VERSION, 0, 0,
|
2015-09-11 17:48:59 +08:00
|
|
|
DTLS_client_method,
|
|
|
|
ssl_undefined_function,
|
2016-08-06 01:03:17 +08:00
|
|
|
ossl_statem_connect, DTLSv1_2_enc_data)
|
2019-11-06 00:34:09 +08:00
|
|
|
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
2016-03-03 05:39:40 +08:00
|
|
|
# ifndef OPENSSL_NO_TLS1_2_METHOD
|
|
|
|
const SSL_METHOD *TLSv1_2_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_2_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_2_server_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_2_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_2_client_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_2_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_TLS1_1_METHOD
|
|
|
|
const SSL_METHOD *TLSv1_1_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_1_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_1_server_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_1_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_1_client_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_1_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_TLS1_METHOD
|
|
|
|
const SSL_METHOD *TLSv1_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_server_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *TLSv1_client_method(void)
|
|
|
|
{
|
|
|
|
return tlsv1_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_SSL3_METHOD
|
|
|
|
const SSL_METHOD *SSLv3_method(void)
|
|
|
|
{
|
|
|
|
return sslv3_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *SSLv3_server_method(void)
|
|
|
|
{
|
|
|
|
return sslv3_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *SSLv3_client_method(void)
|
|
|
|
{
|
|
|
|
return sslv3_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_DTLS1_2_METHOD
|
|
|
|
const SSL_METHOD *DTLSv1_2_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_2_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *DTLSv1_2_server_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_2_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *DTLSv1_2_client_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_2_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_DTLS1_METHOD
|
|
|
|
const SSL_METHOD *DTLSv1_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *DTLSv1_server_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_server_method();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SSL_METHOD *DTLSv1_client_method(void)
|
|
|
|
{
|
|
|
|
return dtlsv1_client_method();
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#endif
|