|
|
fd1438 |
diff -up stunnel-5.61/src/ctx.c.default-tls-version stunnel-5.61/src/ctx.c
|
|
|
fd1438 |
--- stunnel-5.61/src/ctx.c.default-tls-version 2021-12-13 09:43:22.000000000 +0100
|
|
|
fd1438 |
+++ stunnel-5.61/src/ctx.c 2022-01-10 19:27:49.913243127 +0100
|
|
|
fd1438 |
@@ -149,18 +149,28 @@ int context_init(SERVICE_OPTIONS *sectio
|
|
|
fd1438 |
section->ctx=SSL_CTX_new(section->option.client ?
|
|
|
fd1438 |
TLS_client_method() : TLS_server_method());
|
|
|
fd1438 |
#endif /* OPENSSL_VERSION_NUMBER>=0x30000000L */
|
|
|
fd1438 |
- if(!SSL_CTX_set_min_proto_version(section->ctx,
|
|
|
fd1438 |
- section->min_proto_version)) {
|
|
|
fd1438 |
- s_log(LOG_ERR, "Failed to set the minimum protocol version 0x%X",
|
|
|
fd1438 |
- section->min_proto_version);
|
|
|
fd1438 |
- return 1; /* FAILED */
|
|
|
fd1438 |
- }
|
|
|
fd1438 |
- if(!SSL_CTX_set_max_proto_version(section->ctx,
|
|
|
fd1438 |
- section->max_proto_version)) {
|
|
|
fd1438 |
- s_log(LOG_ERR, "Failed to set the maximum protocol version 0x%X",
|
|
|
fd1438 |
- section->max_proto_version);
|
|
|
fd1438 |
- return 1; /* FAILED */
|
|
|
fd1438 |
+ if (section->min_proto_version == USE_DEFAULT_TLS_VERSION) {
|
|
|
fd1438 |
+ s_log(LOG_INFO, "Using the default TLS version as specified in "
|
|
|
fd1438 |
+ "OpenSSL crypto policies. Not setting explicitly.");
|
|
|
fd1438 |
+ } else {
|
|
|
fd1438 |
+ if(!SSL_CTX_set_min_proto_version(section->ctx,
|
|
|
fd1438 |
+ section->min_proto_version)) {
|
|
|
fd1438 |
+ s_log(LOG_ERR, "Failed to set the minimum protocol version 0x%X",
|
|
|
fd1438 |
+ section->min_proto_version);
|
|
|
fd1438 |
+ return 1; /* FAILED */
|
|
|
fd1438 |
+ }
|
|
|
fd1438 |
}
|
|
|
fd1438 |
+ if (section->max_proto_version == USE_DEFAULT_TLS_VERSION) {
|
|
|
fd1438 |
+ s_log(LOG_INFO, "Using the default TLS version as specified in "
|
|
|
fd1438 |
+ "OpenSSL crypto policies. Not setting explicitly");
|
|
|
fd1438 |
+ } else {
|
|
|
fd1438 |
+ if(!SSL_CTX_set_max_proto_version(section->ctx,
|
|
|
fd1438 |
+ section->max_proto_version)) {
|
|
|
fd1438 |
+ s_log(LOG_ERR, "Failed to set the maximum protocol version 0x%X",
|
|
|
fd1438 |
+ section->max_proto_version);
|
|
|
fd1438 |
+ return 1; /* FAILED */
|
|
|
fd1438 |
+ }
|
|
|
fd1438 |
+ }
|
|
|
fd1438 |
#else /* OPENSSL_VERSION_NUMBER<0x10100000L */
|
|
|
fd1438 |
if(section->option.client)
|
|
|
fd1438 |
section->ctx=SSL_CTX_new(section->client_method);
|
|
|
fd1438 |
diff -up stunnel-5.61/src/options.c.default-tls-version stunnel-5.61/src/options.c
|
|
|
fd1438 |
--- stunnel-5.61/src/options.c.default-tls-version 2022-01-10 19:23:15.096254067 +0100
|
|
|
fd1438 |
+++ stunnel-5.61/src/options.c 2022-01-10 19:23:15.098254103 +0100
|
|
|
fd1438 |
@@ -3297,8 +3297,9 @@ NOEXPORT char *parse_service_option(CMD
|
|
|
fd1438 |
return "Invalid protocol version";
|
|
|
fd1438 |
return NULL; /* OK */
|
|
|
fd1438 |
case CMD_INITIALIZE:
|
|
|
fd1438 |
- if(section->max_proto_version && section->min_proto_version &&
|
|
|
fd1438 |
- section->max_proto_version<section->min_proto_version)
|
|
|
fd1438 |
+ if(section->max_proto_version != USE_DEFAULT_TLS_VERSION
|
|
|
fd1438 |
+ && section->min_proto_version != USE_DEFAULT_TLS_VERSION
|
|
|
fd1438 |
+ && section->max_proto_version<section->min_proto_version)
|
|
|
fd1438 |
return "Invalid protocol version range";
|
|
|
fd1438 |
break;
|
|
|
fd1438 |
case CMD_PRINT_DEFAULTS:
|
|
|
fd1438 |
@@ -3316,7 +3317,10 @@ NOEXPORT char *parse_service_option(CMD
|
|
|
fd1438 |
/* sslVersionMax */
|
|
|
fd1438 |
switch(cmd) {
|
|
|
fd1438 |
case CMD_SET_DEFAULTS:
|
|
|
fd1438 |
- section->max_proto_version=0; /* highest supported */
|
|
|
fd1438 |
+ section->max_proto_version=USE_DEFAULT_TLS_VERSION; /* use defaults in
|
|
|
fd1438 |
+ OpenSSL crypto
|
|
|
fd1438 |
+ policies.Do not
|
|
|
fd1438 |
+ override it */
|
|
|
fd1438 |
break;
|
|
|
fd1438 |
case CMD_SET_COPY:
|
|
|
fd1438 |
section->max_proto_version=new_service_options.max_proto_version;
|
|
|
fd1438 |
@@ -3347,7 +3351,10 @@ NOEXPORT char *parse_service_option(CMD
|
|
|
fd1438 |
/* sslVersionMin */
|
|
|
fd1438 |
switch(cmd) {
|
|
|
fd1438 |
case CMD_SET_DEFAULTS:
|
|
|
fd1438 |
- section->min_proto_version=TLS1_VERSION;
|
|
|
fd1438 |
+ section->min_proto_version=USE_DEFAULT_TLS_VERSION; /* use defaults in
|
|
|
fd1438 |
+ OpenSSL crypto
|
|
|
fd1438 |
+ policies. Do not
|
|
|
fd1438 |
+ override it */
|
|
|
fd1438 |
break;
|
|
|
fd1438 |
case CMD_SET_COPY:
|
|
|
fd1438 |
section->min_proto_version=new_service_options.min_proto_version;
|
|
|
fd1438 |
diff -up stunnel-5.61/src/prototypes.h.default-tls-version stunnel-5.61/src/prototypes.h
|
|
|
fd1438 |
--- stunnel-5.61/src/prototypes.h.default-tls-version 2021-12-13 09:43:22.000000000 +0100
|
|
|
fd1438 |
+++ stunnel-5.61/src/prototypes.h 2022-01-10 19:23:15.099254121 +0100
|
|
|
fd1438 |
@@ -932,6 +932,9 @@ ICON_IMAGE load_icon_default(ICON_TYPE);
|
|
|
fd1438 |
ICON_IMAGE load_icon_file(const char *);
|
|
|
fd1438 |
#endif
|
|
|
fd1438 |
|
|
|
fd1438 |
+#define USE_DEFAULT_TLS_VERSION ((int)-2) /* Use defaults in OpenSSL
|
|
|
fd1438 |
+ crypto policies */
|
|
|
fd1438 |
+
|
|
|
fd1438 |
#endif /* defined PROTOTYPES_H */
|
|
|
fd1438 |
|
|
|
fd1438 |
/* end of prototypes.h */
|