]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Move libcrypto init check into entropy.c.
authorDarren Tucker <dtucker@dtucker.net>
Thu, 13 Nov 2025 12:30:48 +0000 (23:30 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Thu, 13 Nov 2025 12:30:48 +0000 (23:30 +1100)
This prevents link errors with the openbsd-compat tests when the linker
tries to bring in all the logging bits.

entropy.c
openbsd-compat/openssl-compat.c
openbsd-compat/openssl-compat.h

index 842c66fd6d0f568b76a1cbffb9508befaf013c22..65ef922379a1d2121fb98f902bba779319ec200a 100644 (file)
--- 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()))
index ffbb4439dc23db10471c906f6ed3549c0e0a7e00..e0cd4720451e0c3ac30471dfedbfc37b35a02c8a 100644 (file)
@@ -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
index d07928b17b6dbb7e1bace08126917713f8e73895..42e2e283330150844f20938efd621602b50ae582 100644 (file)
@@ -31,7 +31,7 @@
 #include <openssl/dh.h>
 
 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