summaryrefslogtreecommitdiff
path: root/ext/openssl/openssl_missing.h
diff options
context:
space:
mode:
authorKazuki Yamaguchi <[email protected]>2021-04-22 13:57:47 +0900
committerKazuki Yamaguchi <[email protected]>2021-10-25 00:40:45 +0900
commit040387d265e405c769867dbedd47c723185bc944 (patch)
tree1b3ca31419ad548040d7afce17559404d792196c /ext/openssl/openssl_missing.h
parentcfa4fa636efefddd70df82f1b0bf0d1c96bf1cf7 (diff)
[ruby/openssl] digest: use EVP_MD_CTX_get0_md() instead of EVP_MD_CTX_md() if exists
The function was renamed in OpenSSL 3.0 due to the change of the lifetime of EVP_MD objects. They are no longer necessarily statically allocated and can be reference-counted -- when an EVP_MD_CTX is free'd, the associated EVP_MD can also become inaccessible. Currently Ruby/OpenSSL only handles builtin algorithms, so no special handling is needed except for adapting to the rename. https://github.com/ruby/openssl/commit/0a253027e6
Diffstat (limited to 'ext/openssl/openssl_missing.h')
-rw-r--r--ext/openssl/openssl_missing.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h
index 1b1a54a824..64212349c9 100644
--- a/ext/openssl/openssl_missing.h
+++ b/ext/openssl/openssl_missing.h
@@ -219,4 +219,8 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
# define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
#endif
+#ifndef HAVE_EVP_MD_CTX_GET0_MD
+# define EVP_MD_CTX_get0_md(ctx) EVP_MD_CTX_md(ctx)
+#endif
+
#endif /* _OSSL_OPENSSL_MISSING_H_ */