Refact: move SSL_CTX_set_ssl_version to NewSSLCtx
@@ -5737,8 +5737,6 @@ SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_pee
{
if (server_mode)
{
- SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_server_method());
-
#ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, 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);
}
}
- else
- {
- SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_client_method());
- }
if (verify_peer)
{
@@ -12120,8 +12114,6 @@ bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname)
{
if (sock->ServerMode)
{
- SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_server_method());
-
#ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, 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
{
- SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_client_method());
-
#ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ssl_ctx, 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);
#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;
}
@@ -16966,8 +16965,6 @@ TOKEN_LIST *GetCipherList()
return ciphers;
}
- SSL_CTX_set_ssl_version(ctx, SSLv23_server_method());
-
#ifdef SSL_OP_NO_SSLv3
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3);
#endif
