Problem setting option CURLOPT_SSLVERSION to a range #2225

Closed
cmfrolick opened this Issue Jan 9, 2018 · 2 comments

Comments

Projects
None yet
2 participants

I am trying to use curl_easy_setopt to specify TLS 1.1 or higher. If I do the following (from the documentation):
result = curl_easy_setopt( curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT );

I always get CURLE_BAD_FUNCTION_ARGUMENT. Even if I try any of the other max values.

Looking at setopt, I see the validation is using:
if((arg < CURL_SSLVERSION_DEFAULT) || (arg > CURL_SSLVERSION_TLSv1_3))

The problem with that is, the max values are shifted 16bits, so they are always greater than CURL_SSLVERSION_TLSv1_3.

curl/libcurl version

curl 7.57.0 (i386-pc-win32) libcurl/7.57.0 OpenSSL/1.0.2n WinIDN
Release-Date: 2017-11-29
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL HTTPS-proxy

operating system

Windows 10 Pro x64 version 1709

jay added a commit to jay/curl that referenced this issue Jan 10, 2018

jay added a commit to jay/curl that referenced this issue Jan 10, 2018

Owner

jay commented Jan 10, 2018

I've submitted #2227 to address the issue you reported. Can you test it please?

The way those MAX values are used needs to be better documented to explain that only one MAX and one regular value can be OR'd together (if I understand it right). Otherwise in my opinion it can lead to user error.

/cc @jkralik

That change works for me.

Thank you.

@cmfrolick cmfrolick closed this Jan 10, 2018

jay added a commit to jay/curl that referenced this issue Jan 12, 2018

jay added a commit that referenced this issue Jan 13, 2018

setopt: fix SSLVERSION to allow CURL_SSLVERSION_MAX_ values
Broken since f121575 (precedes 7.56.1).

Bug: #2225
Reported-by: cmfrolick@users.noreply.github.com

Closes #2227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment