]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
global: call lc_init at startup
authorDaiki Ueno <ueno@gnu.org>
Wed, 19 Mar 2025 09:29:55 +0000 (18:29 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 24 Mar 2025 13:39:51 +0000 (22:39 +0900)
When leancrypto is statically linked, their constructor will not be
called and which prevents some low-level algorithms being
functional. This adds a manual initialization with lc_init() at the
startup of the GnuTLS library.

Suggested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
lib/global.c

index 42d90ee9d59ff5ec6909bb3d347c70a43e2c8f8f..dc80e6302d42e9db2a4a635a8598cd8d8cefec3b 100644 (file)
@@ -42,6 +42,9 @@
 #include "str.h"
 #include "global.h"
 #include "liboqs/liboqs.h"
+#ifdef HAVE_LEANCRYPTO
+#include <leancrypto.h>
+#endif
 
 /* Minimum library versions we accept. */
 #define GNUTLS_MIN_LIBTASN1_VERSION "0.3.4"
@@ -366,6 +369,9 @@ static int _gnutls_global_init(unsigned constructor)
        _gnutls_register_accel_crypto();
        _gnutls_cryptodev_init();
        _gnutls_afalg_init();
+#ifdef HAVE_LEANCRYPTO
+       lc_init(0);
+#endif
 
 #ifdef ENABLE_FIPS140
        /* These self tests are performed on the overridden algorithms