Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl + NSS fails with CURLE_SSL_CIPHER if a cipher strings are separated by colons. #7110

Closed
sergio-nsk opened this issue May 20, 2021 · 3 comments
Labels

Comments

@sergio-nsk
Copy link
Contributor

sergio-nsk commented May 20, 2021

I did this

Enable only specific NSS ciphers using curl_easy_setopt(easy, CURLOPT_SSL_CIPHER_LIST, cipher_list);

I expected the following

The manual:

The list must be syntactically correct, it consists of one or more cipher strings separated by colons. Commas or spaces are also acceptable separators but colons are normally used.

const char* cipher_list = "rsa_rc4_128_md5:rsa_aes_128_sha"; must be valid. In fact I get the error code CURLE_SSL_CIPHER "couldn't use specified cipher". I assume the error is here: https://github.com/curl/curl/blob/a3268eca792f1c2ff8754de3c4094ee9762b2a87/lib/vtls/nss.c#L340:L343

cipher_list = strchr(cipher, ',');
if(cipher_list) {
  *cipher_list++ = '\0';
}

I would update this to

cipher_list = strpbrk(cipher, ":, ");
if(cipher_list) {
  *cipher_list++ = '\0';
}

If I got it correctly, NSS is the only crypto engine whose cipher list is parsed by curl.

curl/libcurl version

curl master branch and the tag curl-7_76_1.

operating system

Ubuntu 16.
Linux ubuntu 4.4.0-211-generic #243-Ubuntu SMP Thu Apr 29 09:14:13 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@bagder bagder added the TLS label May 20, 2021
@bagder
Copy link
Member

bagder commented May 20, 2021

@kdudka any thoughts on this suggestion?

@sergio-nsk you up to writing a pull request for this?

@sergio-nsk
Copy link
Contributor Author

@bagder Ok. On the weekend.

@kdudka
Copy link
Contributor

kdudka commented May 21, 2021

It makes sense to me and I believe it will be backward-compatible. Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants