summaryrefslogtreecommitdiff
path: root/ext/openssl/openssl_missing.h
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-06-22 18:50:17 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-10-25 00:40:46 +0900
commit16272d9ae98dfa8296d477a8e255d35f4a3d29e9 (patch)
tree48415f6d62591d28e6d3c897a81ad19510ecf514 /ext/openssl/openssl_missing.h
parent040387d265e405c769867dbedd47c723185bc944 (diff)
[ruby/openssl] hmac: use EVP_MD_CTX_get_pkey_ctx() instead of EVP_MD_CTX_pkey_ctx()
OpenSSL 3.0 renamed EVP_MD_CTX_pkey_ctx() to include "get" in the function name. Adjust compatibility macro so that we can use the new function name for all OpenSSL 1.0.2-3.0. https://github.com/ruby/openssl/commit/c106d888c6
Diffstat (limited to 'ext/openssl/openssl_missing.h')
-rw-r--r--ext/openssl/openssl_missing.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index 64212349c9..55c4f378f1 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -21,10 +21,6 @@
# define EVP_MD_CTX_free EVP_MD_CTX_destroy
#endif
-#if !defined(HAVE_EVP_MD_CTX_PKEY_CTX)
-# define EVP_MD_CTX_pkey_ctx(x) (x)->pctx
-#endif
-
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
# define X509_STORE_get_ex_data(x, idx) \
CRYPTO_get_ex_data(&(x)->ex_data, (idx))
@@ -223,4 +219,16 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
# define EVP_MD_CTX_get0_md(ctx) EVP_MD_CTX_md(ctx)
#endif
+/*
+ * OpenSSL 1.1.0 added EVP_MD_CTX_pkey_ctx(), and then it was renamed to
+ * EVP_MD_CTX_get_pkey_ctx(x) in OpenSSL 3.0.
+ */
+#ifndef HAVE_EVP_MD_CTX_GET_PKEY_CTX
+# ifdef HAVE_EVP_MD_CTX_PKEY_CTX
+# define EVP_MD_CTX_get_pkey_ctx(x) EVP_MD_CTX_pkey_ctx(x)
+# else
+# define EVP_MD_CTX_get_pkey_ctx(x) (x)->pctx
+# endif
+#endif
+
#endif /* _OSSL_OPENSSL_MISSING_H_ */