[ruby/openssl] 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.

https://github.com/ruby/openssl/commit/e153d6ab47
This commit is contained in:
Kazuki Yamaguchi 2025-01-08 23:15:21 +09:00 committed by git
parent 731d3ec301
commit 318519caaa
2 changed files with 10 additions and 7 deletions

View File

@ -123,6 +123,7 @@ version_ok = if have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h")
checking_for("LibreSSL version >= 3.9.0") { checking_for("LibreSSL version >= 3.9.0") {
try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") } try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") }
else else
is_openssl = true
checking_for("OpenSSL version >= 1.0.2") { checking_for("OpenSSL version >= 1.0.2") {
try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") } try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") }
end end
@ -143,11 +144,13 @@ ssl_h = "openssl/ssl.h".freeze
# compile options # compile options
have_func("RAND_egd()", "openssl/rand.h") have_func("RAND_egd()", "openssl/rand.h")
engines = %w{dynamic 4758cca aep atalla chil if is_openssl
cswift nuron sureware ubsec padlock capi gmp gost cryptodev} engines = %w{dynamic 4758cca aep atalla chil
engines.each { |name| cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
have_func("ENGINE_load_#{name}()", "openssl/engine.h") engines.each { |name|
} have_func("ENGINE_load_#{name}()", "openssl/engine.h")
}
end
# added in 1.1.0 # added in 1.1.0
if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl

View File

@ -47,7 +47,7 @@ static VALUE eEngineError;
/* /*
* Private * 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) \ #define OSSL_ENGINE_LOAD_IF_MATCH(engine_name, x) \
do{\ do{\
if(!strcmp(#engine_name, RSTRING_PTR(name))){\ if(!strcmp(#engine_name, RSTRING_PTR(name))){\
@ -163,7 +163,7 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
static VALUE static VALUE
ossl_engine_s_cleanup(VALUE self) ossl_engine_s_cleanup(VALUE self)
{ {
#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000 #if !OSSL_OPENSSL_PREREQ(1, 1, 0)
ENGINE_cleanup(); ENGINE_cleanup();
#endif #endif
return Qnil; return Qnil;