From eb750219f2ab7886f174a071f880b31cedeeb0a8 Mon Sep 17 00:00:00 2001 From: Tim Hudson Date: Tue, 2 Jun 2020 11:16:14 +1000 Subject: [PATCH] undeprecate EVP_PKEY_cmp and EVP_PKEY_cmp_parameters Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12013) --- crypto/evp/p_lib.c | 4 ---- doc/man3/EVP_PKEY_copy_parameters.pod | 17 +++++++++++------ include/openssl/evp.h | 4 ---- util/libcrypto.num | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 8fe702787d..e336d91286 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -275,12 +275,10 @@ static int evp_pkey_cmp_any(const EVP_PKEY *a, const EVP_PKEY *b, return evp_keymgmt_match(keymgmt1, keydata1, keydata2, selection); } -#ifndef OPENSSL_NO_DEPRECATED_3_0 int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) { return EVP_PKEY_parameters_eq(a, b); } -#endif int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b) { @@ -300,12 +298,10 @@ int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b) return -2; } -#ifndef OPENSSL_NO_DEPRECATED_3_0 int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) { return EVP_PKEY_eq(a, b); } -#endif int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b) { diff --git a/doc/man3/EVP_PKEY_copy_parameters.pod b/doc/man3/EVP_PKEY_copy_parameters.pod index a3879c4e01..742418cf10 100644 --- a/doc/man3/EVP_PKEY_copy_parameters.pod +++ b/doc/man3/EVP_PKEY_copy_parameters.pod @@ -46,6 +46,11 @@ Since OpenSSL private keys contain public key components too the function EVP_PKEY_eq() can also be used to determine if a private key matches a public key. +EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() differ in their return values +compared to other _cmp() functions. They are aliases for EVP_PKEY_eq() and +EVP_PKEY_parameters_eq() functions provided for backwards compatibility +with existing applications. + =head1 RETURN VALUES The function EVP_PKEY_missing_parameters() returns 1 if the public key @@ -55,7 +60,8 @@ doesn't use parameters. These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for failure. -The function EVP_PKEY_parameters_eq() and EVP_PKEY_eq() return 1 if their +The functions EVP_PKEY_cmp_parameters(), EVP_PKEY_parameters_eq(), +EVP_PKEY_cmp() and EVP_PKEY_eq() return 1 if their inputs match, 0 if they don't match, -1 if the key types are different and -2 if the operation is not supported. @@ -66,11 +72,10 @@ L =head1 HISTORY -The function EVP_PKEY_cmp was deprecated and renamed to B and -EVP_PKEY_cmp_parameters was deprecated and renamed to B -(without changing semantics) in OpenSSL 3.0. -This was done to avoid confusion on their return values with other _cmp() -functions that return 0 in case their arguments are equal. +EVP_PKEY_eq() and EVP_PKEY_parameters_eq() were added in OpenSSL 3.0 to +avoid confusion on the return values of EVP_PKEY_cmp() and +EVP_PKEY_cmp_parameters() which unlike other _cmp() +functions do not return 0 in case their arguments are equal. =head1 COPYRIGHT diff --git a/include/openssl/evp.h b/include/openssl/evp.h index 74f97fd3e2..4d0cc9d560 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -1281,14 +1281,10 @@ EVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in); int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); -#ifndef OPENSSL_NO_DEPRECATED_3_0 int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); -#endif int EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b); -#ifndef OPENSSL_NO_DEPRECATED_3_0 int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); -#endif int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b); int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, diff --git a/util/libcrypto.num b/util/libcrypto.num index 42bbb4bd04..6070b570a5 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -190,7 +190,7 @@ EVP_DigestInit 193 3_0_0 EXIST::FUNCTION: EVP_PKEY_meth_find 194 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0 X509_VERIFY_PARAM_get_count 195 3_0_0 EXIST::FUNCTION: ASN1_BIT_STRING_get_bit 196 3_0_0 EXIST::FUNCTION: -EVP_PKEY_cmp 197 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0 +EVP_PKEY_cmp 197 3_0_0 EXIST::FUNCTION: d2i_X509_ALGORS 198 3_0_0 EXIST::FUNCTION: EVP_PKEY2PKCS8 199 3_0_0 EXIST::FUNCTION: BN_nist_mod_256 200 3_0_0 EXIST::FUNCTION: @@ -3461,7 +3461,7 @@ ERR_print_errors_cb 3531 3_0_0 EXIST::FUNCTION: ENGINE_set_default_string 3532 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,ENGINE BIO_number_read 3533 3_0_0 EXIST::FUNCTION: CRYPTO_zalloc 3534 3_0_0 EXIST::FUNCTION: -EVP_PKEY_cmp_parameters 3535 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0 +EVP_PKEY_cmp_parameters 3535 3_0_0 EXIST::FUNCTION: EVP_PKEY_CTX_new_id 3537 3_0_0 EXIST::FUNCTION: TLS_FEATURE_free 3538 3_0_0 EXIST::FUNCTION: d2i_BASIC_CONSTRAINTS 3539 3_0_0 EXIST::FUNCTION: -- 2.34.1