summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorHongren Zheng <i@zenithal.me>2024-05-16 16:41:25 +0800
committerTomas Mraz <tomas@openssl.org>2024-05-20 10:14:39 +0200
commita192b2439c0207ce1b04ba6137329b68f9e23680 (patch)
treeaba044e9c3ad53366fc1f3a5db40898ef6bc8956 /providers
parent4dbd4925dfc61d93df678df607504f62b0ac3dcc (diff)
fips provider: explicitly setup cpuid when initializing
Fixes: #23979 Previously fips module relied on OPENSSL_cpuid_setup being used as constructor by the linker to correctly setup the capability vector, either via .section .init (for x86_64) or via __attribute__((constructor)). This would make ld.so call OPENSSL_cpuid_setup before the init function for fips module. However, this early constructing behavior has several disadvantages: 1. Not all platform/toolchain supports such behavior 2. Initialisation sequence is not well defined, and some function might not be initialized when cpuid_setup is called 3. Implicit path is hard to maintain and debug Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24419)
Diffstat (limited to 'providers')
-rw-r--r--providers/fips/fipsprov.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
index 1f36ce6393..0174c6b33b 100644
--- a/providers/fips/fipsprov.c
+++ b/providers/fips/fipsprov.c
@@ -695,6 +695,8 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
}
}
+ OPENSSL_cpuid_setup();
+
/* Create a context. */
if ((*provctx = ossl_prov_ctx_new()) == NULL
|| (libctx = OSSL_LIB_CTX_new()) == NULL)