summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-10-12 18:19:55 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-10-16 18:34:35 +0900
commitc6c2190c4c546743981944c9ff258a94a6ea7a09 (patch)
treed96285f55f4f5014ca6323bfc801c6441c9a7ad8 /ext/openssl
parentf88401f38e918c0bdc4d7c6b22f25e0a7eef04bb (diff)
[ruby/openssl] digest: load digest library using Kernel#require
The digest library is a default gem now, too. Therefore we can't simply use rb_require() to load it, but we should use Kernel#require instead. This change is based on the suggestion by David Rodríguez in https://github.com/ruby/digest/commit/16172612d56ac42f57e5788465791329303ac5d0#commitcomment-57778397 https://github.com/ruby/openssl/commit/157f80794b
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_digest.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index d327f718e2..b2506de7f7 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -313,8 +313,6 @@ ossl_digest_block_length(VALUE self)
void
Init_ossl_digest(void)
{
- rb_require("digest");
-
#if 0
mOSSL = rb_define_module("OpenSSL");
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
@@ -398,6 +396,12 @@ Init_ossl_digest(void)
* digest2 = sha256.digest(data2)
*
*/
+
+ /*
+ * Digest::Class is defined by the digest library. rb_require() cannot be
+ * used here because it bypasses RubyGems.
+ */
+ rb_funcall(Qnil, rb_intern_const("require"), 1, rb_str_new_cstr("digest"));
cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
/* Document-class: OpenSSL::Digest::DigestError
*