[openssh-commits] [openssh] branch master updated: Move libcrypto init check into entropy.c.

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Nov 13 23:33:26 AEDT 2025


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

The following commit(s) were added to refs/heads/master by this push:
     new e2b93e162 Move libcrypto init check into entropy.c.
e2b93e162 is described below

commit e2b93e16232834c61c9dcff5b20e4c55a26b324d
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Thu Nov 13 23:30:48 2025 +1100

    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.
---
 entropy.c                       | 3 ++-
 openbsd-compat/openssl-compat.c | 5 ++---
 openbsd-compat/openssl-compat.h | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

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 <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

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list