From: Darren Tucker Date: Thu, 13 Nov 2025 12:30:48 +0000 (+1100) Subject: Move libcrypto init check into entropy.c. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2b93e16232834c61c9dcff5b20e4c55a26b324d;p=thirdparty%2Fopenssh-portable.git Move libcrypto init check into entropy.c. This prevents link errors with the openbsd-compat tests when the linker tries to bring in all the logging bits. --- diff --git a/entropy.c b/entropy.c index 842c66fd6..65ef92237 100644 --- a/entropy.c +++ b/entropy.c @@ -64,7 +64,8 @@ seed_rng(void) unsigned char buf[RANDOM_SEED_SIZE]; /* Initialise libcrypto */ - ssh_libcrypto_init(); + if (ssh_libcrypto_init() != 1) + fatal("libcrypto failed to initialize."); if (!ssh_compatible_openssl(OPENSSL_VERSION_NUMBER, OpenSSL_version_num())) diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c index ffbb4439d..e0cd47204 100644 --- a/openbsd-compat/openssl-compat.c +++ b/openbsd-compat/openssl-compat.c @@ -69,7 +69,7 @@ ssh_compatible_openssl(long headerver, long libver) return 0; } -void +int ssh_libcrypto_init(void) { uint64_t opts = OPENSSL_INIT_ADD_ALL_CIPHERS | @@ -84,8 +84,7 @@ ssh_libcrypto_init(void) opts |= OPENSSL_INIT_LOAD_CONFIG; #endif /* USE_OPENSSL_ENGINE */ - if (OPENSSL_init_crypto(opts, NULL) != 1) - fatal("OPENSSL_init_crypto failed"); + return OPENSSL_init_crypto(opts, NULL); } #ifndef HAVE_EVP_DIGESTSIGN diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h index d07928b17..42e2e2833 100644 --- a/openbsd-compat/openssl-compat.h +++ b/openbsd-compat/openssl-compat.h @@ -31,7 +31,7 @@ #include int ssh_compatible_openssl(long, long); -void ssh_libcrypto_init(void); +int ssh_libcrypto_init(void); #if (OPENSSL_VERSION_NUMBER < 0x10100000L) # error OpenSSL 1.1.0 or greater is required