Skip to content

Commit e153d6a

Browse files
committed
engine: remove mention of LibreSSL from OpenSSL::Engine
These paths are only reachable when it is compiled against OpenSSL. LibreSSL 3.9 does not support ENGINE and defines OPENSSL_NO_ENGINE.
1 parent 1328415 commit e153d6a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ext/openssl/extconf.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def find_openssl_library
123123
checking_for("LibreSSL version >= 3.9.0") {
124124
try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") }
125125
else
126+
is_openssl = true
126127
checking_for("OpenSSL version >= 1.0.2") {
127128
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") }
128129
end
@@ -143,11 +144,13 @@ def find_openssl_library
143144

144145
# compile options
145146
have_func("RAND_egd()", "openssl/rand.h")
146-
engines = %w{dynamic 4758cca aep atalla chil
147-
cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
148-
engines.each { |name|
149-
have_func("ENGINE_load_#{name}()", "openssl/engine.h")
150-
}
147+
if is_openssl
148+
engines = %w{dynamic 4758cca aep atalla chil
149+
cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
150+
engines.each { |name|
151+
have_func("ENGINE_load_#{name}()", "openssl/engine.h")
152+
}
153+
end
151154

152155
# added in 1.1.0
153156
if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl

ext/openssl/ossl_engine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static VALUE eEngineError;
4747
/*
4848
* Private
4949
*/
50-
#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000
50+
#if OSSL_OPENSSL_PREREQ(1, 1, 0)
5151
#define OSSL_ENGINE_LOAD_IF_MATCH(engine_name, x) \
5252
do{\
5353
if(!strcmp(#engine_name, RSTRING_PTR(name))){\
@@ -163,7 +163,7 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
163163
static VALUE
164164
ossl_engine_s_cleanup(VALUE self)
165165
{
166-
#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000
166+
#if !OSSL_OPENSSL_PREREQ(1, 1, 0)
167167
ENGINE_cleanup();
168168
#endif
169169
return Qnil;

0 commit comments

Comments
 (0)