Skip to content

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

@sergio-nsk

Description

@sergio-nsk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions