Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
adef139a
Unverified
Commit
adef139a
authored
Jul 12, 2023
by
Valentino Geron
Committed by
GitHub
Jul 12, 2023
Browse files
Remove support in deprecated TLS versions 1.0 and 1.1 (#1205)
parent
d543baba
Changes
1
Show whitespace changes
Inline
Side-by-side
ssl.c
View file @
adef139a
...
@@ -59,6 +59,8 @@
...
@@ -59,6 +59,8 @@
#include "async_private.h"
#include "async_private.h"
#include "hiredis_ssl.h"
#include "hiredis_ssl.h"
#define OPENSSL_1_1_0 0x10100000L
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
char
*
str
);
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
char
*
str
);
struct
redisSSLContext
{
struct
redisSSLContext
{
...
@@ -100,7 +102,7 @@ redisContextFuncs redisContextSSLFuncs;
...
@@ -100,7 +102,7 @@ redisContextFuncs redisContextSSLFuncs;
* Note that this is only required for OpenSSL < 1.1.0.
* Note that this is only required for OpenSSL < 1.1.0.
*/
*/
#if OPENSSL_VERSION_NUMBER <
0x10100000L
#if OPENSSL_VERSION_NUMBER <
OPENSSL_1_1_0
#define HIREDIS_USE_CRYPTO_LOCKS
#define HIREDIS_USE_CRYPTO_LOCKS
#endif
#endif
...
@@ -256,13 +258,25 @@ redisSSLContext *redisCreateSSLContextWithOptions(redisSSLOptions *options, redi
...
@@ -256,13 +258,25 @@ redisSSLContext *redisCreateSSLContextWithOptions(redisSSLOptions *options, redi
if
(
ctx
==
NULL
)
if
(
ctx
==
NULL
)
goto
error
;
goto
error
;
ctx
->
ssl_ctx
=
SSL_CTX_new
(
SSLv23_client_method
());
const
SSL_METHOD
*
ssl_method
;
#if OPENSSL_VERSION_NUMBER >= OPENSSL_1_1_0
ssl_method
=
TLS_client_method
();
#else
ssl_method
=
SSLv23_client_method
();
#endif
ctx
->
ssl_ctx
=
SSL_CTX_new
(
ssl_method
);
if
(
!
ctx
->
ssl_ctx
)
{
if
(
!
ctx
->
ssl_ctx
)
{
if
(
error
)
*
error
=
REDIS_SSL_CTX_CREATE_FAILED
;
if
(
error
)
*
error
=
REDIS_SSL_CTX_CREATE_FAILED
;
goto
error
;
goto
error
;
}
}
SSL_CTX_set_options
(
ctx
->
ssl_ctx
,
SSL_OP_NO_SSLv2
|
SSL_OP_NO_SSLv3
);
#if OPENSSL_VERSION_NUMBER >= OPENSSL_1_1_0
SSL_CTX_set_min_proto_version
(
ctx
->
ssl_ctx
,
TLS1_2_VERSION
);
#else
SSL_CTX_set_options
(
ctx
->
ssl_ctx
,
SSL_OP_NO_SSLv2
|
SSL_OP_NO_SSLv3
|
SSL_OP_NO_TLSv1
|
SSL_OP_NO_TLSv1_1
);
#endif
SSL_CTX_set_verify
(
ctx
->
ssl_ctx
,
options
->
verify_mode
,
NULL
);
SSL_CTX_set_verify
(
ctx
->
ssl_ctx
,
options
->
verify_mode
,
NULL
);
if
((
cert_filename
!=
NULL
&&
private_key_filename
==
NULL
)
||
if
((
cert_filename
!=
NULL
&&
private_key_filename
==
NULL
)
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment