-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
prchander/openssl
#3Labels
branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)resolved: fixedThis issue has been fixedThis issue has been fixedtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug
Description
Create a EVP_PKEY and compare it to itself. EVP_PKEY_cmp() returns 0, which means a mismatch.
See code fragment below.
int rv = 0;
EVP_PKEY *mac_key = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, NULL,
(const unsigned char *)("0123456789"),
strlen("0123456789"));
rv = EVP_PKEY_cmp(mac_key, mac_key);
if (rv != 1) {
printf("key compare failed. rv = %d\n", rv);
return 0;
}
printf("key compare passed\n");
Possible fix ...
@ -130,8 +130,14 @@ int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
return ret;
}
if (a->ameth->pub_cmp)
return a->ameth->pub_cmp(a, b);
if (a->ameth->pub_cmp) {
ret = a->ameth->pub_cmp(a, b);
if (ret == 0) {
return 1;
} else {
return 0;
}
}
}
The issue is present in the latest 1.1.1 stable branch. And appears to be on Master (3.0) as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)Applies to OpenSSL_1_1_1-stable branch (EOL)resolved: fixedThis issue has been fixedThis issue has been fixedtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug