[ruby/openssl] pkey, ssl: use EVP_PKEY_eq() instead of EVP_PKEY_cmp()

OpenSSL 3.0 renamed EVP_PKEY_cmp() to EVP_PKEY_eq() because that was a
confusing name.

https://github.com/ruby/openssl/commit/d42bd7fcdb
This commit is contained in:
Kazuki Yamaguchi 2021-05-17 16:18:45 +09:00
parent ee7131614c
commit 1b5ccc8a0c
4 changed files with 8 additions and 3 deletions

View File

@ -178,6 +178,7 @@ have_func("SSL_CTX_load_verify_file")
have_func("BN_check_prime")
have_func("EVP_MD_CTX_get0_md")
have_func("EVP_MD_CTX_get_pkey_ctx")
have_func("EVP_PKEY_eq")
Logging::message "=== Checking done. ===\n"

View File

@ -231,4 +231,8 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
# endif
#endif
#ifndef HAVE_EVP_PKEY_EQ
# define EVP_PKEY_eq(a, b) EVP_PKEY_cmp(a, b)
#endif
#endif /* _OSSL_OPENSSL_MISSING_H_ */

View File

@ -769,14 +769,14 @@ ossl_pkey_compare(VALUE self, VALUE other)
if (EVP_PKEY_id(selfPKey) != EVP_PKEY_id(otherPKey))
ossl_raise(rb_eTypeError, "cannot match different PKey types");
ret = EVP_PKEY_cmp(selfPKey, otherPKey);
ret = EVP_PKEY_eq(selfPKey, otherPKey);
if (ret == 0)
return Qfalse;
else if (ret == 1)
return Qtrue;
else
ossl_raise(ePKeyError, "EVP_PKEY_cmp");
ossl_raise(ePKeyError, "EVP_PKEY_eq");
}
/*

View File

@ -1229,7 +1229,7 @@ ossl_sslctx_add_certificate(int argc, VALUE *argv, VALUE self)
EVP_PKEY_free(pub_pkey);
if (!pub_pkey)
rb_raise(rb_eArgError, "certificate does not contain public key");
if (EVP_PKEY_cmp(pub_pkey, pkey) != 1)
if (EVP_PKEY_eq(pub_pkey, pkey) != 1)
rb_raise(rb_eArgError, "public key mismatch");
if (argc >= 3)