Fix EVP_PKEY_eq() to be possible to use with strictly private keys
authorRichard Levitte <levitte@openssl.org>
Wed, 29 Sep 2021 08:58:21 +0000 (10:58 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 13 Dec 2021 06:52:53 +0000 (07:52 +0100)
commitf3ba62653815b2f7991103cdbea1ac155c8c916a
treefea6968733a099c6bbbf99ec949c743ee665ecbe
parent23effeb81fbcdc436b1e871e7fff34456d6bfbaf
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)
crypto/evp/p_lib.c
doc/man3/EVP_PKEY_copy_parameters.pod