diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 48a1680e8d..bcce422842 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -123,6 +123,7 @@ version_ok = if have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h") checking_for("LibreSSL version >= 3.9.0") { try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") } else + is_openssl = true checking_for("OpenSSL version >= 1.0.2") { try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") } end @@ -143,11 +144,13 @@ ssl_h = "openssl/ssl.h".freeze # compile options have_func("RAND_egd()", "openssl/rand.h") -engines = %w{dynamic 4758cca aep atalla chil - cswift nuron sureware ubsec padlock capi gmp gost cryptodev} -engines.each { |name| - have_func("ENGINE_load_#{name}()", "openssl/engine.h") -} +if is_openssl + engines = %w{dynamic 4758cca aep atalla chil + cswift nuron sureware ubsec padlock capi gmp gost cryptodev} + engines.each { |name| + have_func("ENGINE_load_#{name}()", "openssl/engine.h") + } +end # added in 1.1.0 if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c index f19be7f495..bf9b50c4c8 100644 --- a/ext/openssl/ossl_engine.c +++ b/ext/openssl/ossl_engine.c @@ -47,7 +47,7 @@ static VALUE eEngineError; /* * Private */ -#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000 +#if OSSL_OPENSSL_PREREQ(1, 1, 0) #define OSSL_ENGINE_LOAD_IF_MATCH(engine_name, x) \ do{\ if(!strcmp(#engine_name, RSTRING_PTR(name))){\ @@ -163,7 +163,7 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass) static VALUE ossl_engine_s_cleanup(VALUE self) { -#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000 +#if !OSSL_OPENSSL_PREREQ(1, 1, 0) ENGINE_cleanup(); #endif return Qnil;