Since
9d8998c99408e1adf, the setopt code changes input DEFAULT to an
actual more specific TLS version (1.2) for the backends to use and check
for.
This means that the default value (0L) cannot and should not actually be
used when the TLS backends run. This change adds asserts to verify that
and removes code that accepts the DEFAULT value as a valid version with
the TLS version functions' logic.
Applications can still set a specific lower version if they want (1, 1.0
or 1.1).
Closes #20453
long ssl_version = conn_config->version;
long ssl_version_max = conn_config->version_max;
- if((ssl_version == CURL_SSLVERSION_DEFAULT) ||
- (ssl_version == CURL_SSLVERSION_TLSv1))
+ DEBUGASSERT(ssl_version != CURL_SSLVERSION_DEFAULT);
+ if(ssl_version <= CURL_SSLVERSION_TLSv1)
ssl_version = CURL_SSLVERSION_TLSv1_0;
if((ssl_version_max == CURL_SSLVERSION_MAX_NONE) ||
(ssl_version_max == CURL_SSLVERSION_MAX_DEFAULT))
#endif
;
+ DEBUGASSERT(conn_config->version != CURL_SSLVERSION_DEFAULT);
switch(conn_config->version) {
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1:
*pmethod = NULL;
*pssl_version_min = conn_config->version;
+ DEBUGASSERT(conn_config->version != CURL_SSLVERSION_DEFAULT);
switch(peer->transport) {
case TRNSPRT_TCP:
/* check to see if we have been told to use an explicit SSL/TLS version */
switch(*pssl_version_min) {
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1:
if(!ssl_config->enable_beast)
ctx_options &= ~(ctx_option_t)SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
+ DEBUGASSERT(ssl_version_min != CURL_SSLVERSION_DEFAULT);
switch(ssl_version_min) {
case CURL_SSLVERSION_SSLv2:
case CURL_SSLVERSION_SSLv3:
return CURLE_NOT_BUILT_IN;
/* "--tlsv<x.y>" options mean TLS >= version <x.y> */
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1: /* TLS >= version 1.0 */
case CURL_SSLVERSION_TLSv1_0: /* TLS >= version 1.0 */
case CURL_SSLVERSION_TLSv1_1: /* TLS >= version 1.1 */
CURLcode result = CURLE_OK;
rustls_result rr;
+ DEBUGASSERT(conn_config->version != CURL_SSLVERSION_DEFAULT);
switch(conn_config->version) {
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1:
else
infof(data, "schannel: enabled automatic use of client certificate");
+ DEBUGASSERT(conn_config->version != CURL_SSLVERSION_DEFAULT);
switch(conn_config->version) {
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1:
{
int res;
*min_version = *max_version = 0;
+ DEBUGASSERT(conn_config->version != CURL_SSLVERSION_DEFAULT);
+
switch(conn_config->version) {
- case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
*min_version = TLS1_VERSION;