commit 181b87b

Michael Forney  ·  2026-05-05 17:37:49 +0000 UTC
parent dbc38b8
libressl: Avoid constructor attribute if it's not needed
2 files changed,  +42, -1
+41, -0
 1@@ -0,0 +1,41 @@
 2+From 6d05b8b7d632a5ee054afb29ba995d2c7aee68c4 Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Tue, 5 May 2026 10:14:11 -0700
 5+Subject: [PATCH] Only register constructor when it's needed
 6+
 7+---
 8+ crypto/crypto_init.c | 9 ++-------
 9+ 1 file changed, 2 insertions(+), 7 deletions(-)
10+
11+diff --git a/crypto/crypto_init.c b/crypto/crypto_init.c
12+index ae4914e35..2c8c6e81c 100644
13+--- a/crypto/crypto_init.c
14++++ b/crypto/crypto_init.c
15+@@ -37,15 +37,9 @@ static pthread_once_t crypto_init_once = PTHREAD_ONCE_INIT;
16+ static pthread_t crypto_init_thread;
17+ static int crypto_init_cleaned_up;
18+ 
19++#ifdef HAVE_CRYPTO_CPU_CAPS_INIT
20+ void openssl_init_crypto_constructor(void)  __attribute__((constructor));
21+ 
22+-#ifndef HAVE_CRYPTO_CPU_CAPS_INIT
23+-void
24+-crypto_cpu_caps_init(void)
25+-{
26+-}
27+-#endif
28+-
29+ /*
30+  * This function is invoked as a constructor when the library is loaded. The
31+  * code run from here must not allocate memory or trigger signals. The only
32+@@ -56,6 +50,7 @@ openssl_init_crypto_constructor(void)
33+ {
34+ 	crypto_cpu_caps_init();
35+ }
36++#endif
37+ 
38+ /*
39+  * This is used by various configure scripts to check availability of libcrypto,
40+-- 
41+2.49.0
42+
+1, -1
1@@ -1 +1 @@
2-4.3.1 r0
3+4.3.1 r1