1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Refact: move SSL_CTX_set_ssl_version to NewSSLCtx

This commit is contained in:
Takuho NAKANO 2020-05-05 19:02:51 +09:00 committed by Davide Beatrici
parent a2d15615f3
commit d0b3cde485

View File

@ -5737,8 +5737,6 @@ SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_pee
{ {
if (server_mode) if (server_mode)
{ {
SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_server_method());
#ifdef SSL_OP_NO_SSLv3 #ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3); SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3);
#endif // SSL_OP_NO_SSLv3 #endif // SSL_OP_NO_SSLv3
@ -5754,10 +5752,6 @@ SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_pee
SSL_CTX_set_tmp_dh(ssl_ctx, dh->dh); SSL_CTX_set_tmp_dh(ssl_ctx, dh->dh);
} }
} }
else
{
SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_client_method());
}
if (verify_peer) if (verify_peer)
{ {
@ -12120,8 +12114,6 @@ bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname)
{ {
if (sock->ServerMode) if (sock->ServerMode)
{ {
SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_server_method());
#ifdef SSL_OP_NO_SSLv3 #ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3); SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3);
#endif // SSL_OP_NO_SSLv3 #endif // SSL_OP_NO_SSLv3
@ -12160,8 +12152,6 @@ bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname)
} }
else else
{ {
SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_client_method());
#ifdef SSL_OP_NO_SSLv3 #ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3); SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3);
#endif // SSL_OP_NO_SSLv3 #endif // SSL_OP_NO_SSLv3
@ -16836,6 +16826,15 @@ struct ssl_ctx_st *NewSSLCtx(bool server_mode)
SSL_CTX_set_ecdh_auto(ctx, 1); SSL_CTX_set_ecdh_auto(ctx, 1);
#endif // SSL_CTX_set_ecdh_auto #endif // SSL_CTX_set_ecdh_auto
if (server_mode)
{
SSL_CTX_set_ssl_version(ctx, SSLv23_server_method());
}
else
{
SSL_CTX_set_ssl_version(ctx, SSLv23_client_method());
}
return ctx; return ctx;
} }
@ -16966,8 +16965,6 @@ TOKEN_LIST *GetCipherList()
return ciphers; return ciphers;
} }
SSL_CTX_set_ssl_version(ctx, SSLv23_server_method());
#ifdef SSL_OP_NO_SSLv3 #ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3); SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3);
#endif #endif