Skip to content

Commit

Permalink
Fix PKCS#11 URI detection to be case insensitive
Browse files Browse the repository at this point in the history
The RFC 7512 defines the URI scheme "pkcs11". As defined in RFC 3986,
URI schemes are case-insensitive, although the canonical form must be
written in lowercase. The RFC 4395 requires URI schemes names to be
registered using lowecase letters.
  • Loading branch information
ansasaki committed Apr 6, 2018
1 parent 7c6f013 commit 3ca3e1c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/vtls/openssl.c
Expand Up @@ -538,7 +538,7 @@ static int ssl_ui_writer(UI *ui, UI_STRING *uis)
*/
static bool is_pkcs11_uri(const char *string)
{
if(!strncmp(string, "pkcs11:", 7)) {
if(strncasecompare(string, "pkcs11:", 7)) {
return TRUE;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/tool_getparam.c
Expand Up @@ -337,7 +337,7 @@ void parse_cert_parameter(const char *cert_parameter,
* looks like a RFC7512 PKCS#11 URI which can be used as-is.
* Also if cert_parameter contains no colon nor backslash, this
* means no passphrase was given and no characters escaped */
if(!strncmp(cert_parameter, "pkcs11:", 7) ||
if(!curl_strnequal(cert_parameter, "pkcs11:", 7) ||
!strpbrk(cert_parameter, ":\\")) {
*certname = strdup(cert_parameter);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/tool_operate.c
Expand Up @@ -118,7 +118,7 @@ static bool is_fatal_error(CURLcode code)
*/
static bool is_pkcs11_uri(const char *string)
{
if(!strncmp(string, "pkcs11:", 7)) {
if(curl_strnequal(string, "pkcs11:", 7)) {
return TRUE;
}
else {
Expand Down

0 comments on commit 3ca3e1c

Please sign in to comment.