summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-05-25 13:17:51 +0200
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-05-27 14:36:13 +0200
commitc74aaa3920f116fe4c1003153838144c37d6e527 (patch)
tree47475bbd2b276e95dab977ff832d5405602ac2f8 /crypto
parent9e3c510bde91350c5a40b7ba4e9e0945895e9368 (diff)
Rename EVP_PKEY_cmp() to EVP_PKEY_eq() and EVP_PKEY_cmp_parameters() to EVP_PKEY_parameters_eq()
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11953)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/exchange.c4
-rw-r--r--crypto/evp/keymgmt_lib.c4
-rw-r--r--crypto/evp/p_lib.c16
-rw-r--r--crypto/x509/x509_cmp.c2
-rw-r--r--crypto/x509/x509_req.c2
-rw-r--r--crypto/x509/x_pubkey.c2
6 files changed, 22 insertions, 8 deletions
diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c
index 26d7e1ce95..514ecd4039 100644
--- a/crypto/evp/exchange.c
+++ b/crypto/evp/exchange.c
@@ -368,13 +368,13 @@ int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer)
/*
* For clarity. The error is if parameters in peer are
- * present (!missing) but don't match. EVP_PKEY_cmp_parameters may return
+ * present (!missing) but don't match. EVP_PKEY_parameters_eq may return
* 1 (match), 0 (don't match) and -2 (comparison is not defined). -1
* (different key types) is impossible here because it is checked earlier.
* -2 is OK for us here, as well as 1, so we can check for 0 only.
*/
if (!EVP_PKEY_missing_parameters(peer) &&
- !EVP_PKEY_cmp_parameters(ctx->pkey, peer)) {
+ !EVP_PKEY_parameters_eq(ctx->pkey, peer)) {
EVPerr(EVP_F_EVP_PKEY_DERIVE_SET_PEER, EVP_R_DIFFERENT_PARAMETERS);
return -1;
}
diff --git a/crypto/evp/keymgmt_lib.c b/crypto/evp/keymgmt_lib.c
index 54805d741d..a712233043 100644
--- a/crypto/evp/keymgmt_lib.c
+++ b/crypto/evp/keymgmt_lib.c
@@ -236,8 +236,8 @@ int evp_keymgmt_util_has(EVP_PKEY *pk, int selection)
* but also in the operation cache to see if there's any common keymgmt that
* supplies OP_keymgmt_match.
*
- * evp_keymgmt_util_match() adheres to the return values that EVP_PKEY_cmp()
- * and EVP_PKEY_cmp_parameters() return, i.e.:
+ * evp_keymgmt_util_match() adheres to the return values that EVP_PKEY_eq()
+ * and EVP_PKEY_parameters_eq() return, i.e.:
*
* 1 same key
* 0 not same key
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index d05f0f2cba..4670912588 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -156,7 +156,7 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
}
if (!EVP_PKEY_missing_parameters(to)) {
- if (EVP_PKEY_cmp_parameters(to, from) == 1)
+ if (EVP_PKEY_parameters_eq(to, from) == 1)
return 1;
EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_PARAMETERS);
return 0;
@@ -272,8 +272,15 @@ 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)
+{
/*
* TODO: clean up legacy stuff from this function when legacy support
* is gone.
@@ -290,8 +297,15 @@ int EVP_PKEY_cmp_parameters(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)
+{
/*
* TODO: clean up legacy stuff from this function when legacy support
* is gone.
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index 05615c1e19..25f72e057e 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -300,7 +300,7 @@ int X509_check_private_key(const X509 *x, const EVP_PKEY *k)
xk = X509_get0_pubkey(x);
if (xk)
- ret = EVP_PKEY_cmp(xk, k);
+ ret = EVP_PKEY_eq(xk, k);
else
ret = -2;
diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c
index 639e8e47db..fcc07b17dd 100644
--- a/crypto/x509/x509_req.c
+++ b/crypto/x509/x509_req.c
@@ -85,7 +85,7 @@ int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k)
int ok = 0;
xk = X509_REQ_get_pubkey(x);
- switch (EVP_PKEY_cmp(xk, k)) {
+ switch (EVP_PKEY_eq(xk, k)) {
case 1:
ok = 1;
break;
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c
index 14893adb2f..c73ea7a4ed 100644
--- a/crypto/x509/x_pubkey.c
+++ b/crypto/x509/x_pubkey.c
@@ -491,5 +491,5 @@ int X509_PUBKEY_eq(const X509_PUBKEY *a, const X509_PUBKEY *b)
if ((pA = X509_PUBKEY_get0(a)) == NULL
|| (pB = X509_PUBKEY_get0(b)) == NULL)
return -2;
- return EVP_PKEY_cmp(pA, pB);
+ return EVP_PKEY_eq(pA, pB);
}