summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-09-29 10:58:21 +0200
committerRichard Levitte <levitte@openssl.org>2021-12-13 07:52:53 +0100
commitf3ba62653815b2f7991103cdbea1ac155c8c916a (patch)
treefea6968733a099c6bbbf99ec949c743ee665ecbe /crypto/evp
parent23effeb81fbcdc436b1e871e7fff34456d6bfbaf (diff)
Fix EVP_PKEY_eq() to be possible to use with strictly private keys
EVP_PKEY_eq() assumed that an EVP_PKEY always has the public key component if it has a private key component. However, this assumption no longer strictly holds true, at least for provider backed keys. EVP_PKEY_eq() therefore needs to be modified to specify that the private key should be checked too (at the discretion of what's reasonable for the implementation doing the actual comparison). Fixes #16267 Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16765)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/p_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 2552dd702a..27138af564 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -343,7 +343,7 @@ int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b)
if (a->keymgmt != NULL || b->keymgmt != NULL)
return evp_pkey_cmp_any(a, b, (SELECT_PARAMETERS
- | OSSL_KEYMGMT_SELECT_PUBLIC_KEY));
+ | OSSL_KEYMGMT_SELECT_KEYPAIR));
/* All legacy keys */
if (a->type != b->type)