summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-20 16:39:00 +0200
committerTomas Mraz <tomas@openssl.org>2021-04-23 10:48:20 +0200
commit5af6e154d0a4cd5b1d3a46bcfab444e714364d67 (patch)
tree3563e1526dc84ad14d04a4dd4048890df66687ae /crypto/evp
parentRemove obsolete comment (diff)
downloadopenssl-5af6e154d0a4cd5b1d3a46bcfab444e714364d67.tar.xz
openssl-5af6e154d0a4cd5b1d3a46bcfab444e714364d67.zip
Trivial shortcuts for EVP_PKEY_eq()
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14942)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/p_lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index db334fb1ef..a0dfff9195 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -327,6 +327,12 @@ int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b)
* is gone.
*/
+ /* Trivial shortcuts */
+ if (a == b)
+ return 1;
+ if (a == NULL || b == NULL)
+ return 0;
+
if (a->keymgmt != NULL || b->keymgmt != NULL)
return evp_pkey_cmp_any(a, b, (SELECT_PARAMETERS
| OSSL_KEYMGMT_SELECT_PUBLIC_KEY));