summaryrefslogtreecommitdiff
path: root/crypto/build.info
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-03-11 17:38:46 +0100
committerRichard Levitte <levitte@openssl.org>2021-04-02 16:39:13 +0200
commitef83daf4dadf9380a3b94618fb7aee75fcd9a6b1 (patch)
tree400484b1395d5a606fda8e9382ee213134dcfc45 /crypto/build.info
parentbaf02793fc5b5095ad8929b8e2aae679e113f457 (diff)
downloadopenssl-new-ef83daf4dadf9380a3b94618fb7aee75fcd9a6b1.tar.gz
Refactor CPUID code
We were using CPUID coded in several modules, but it was unclear how it actually got there, and could fail randomly. To remedy that, this change separates the CPUID C code from the rest of cryptlib.c, and ensures the right modules get both that and the assembler sources explicitly. Fixes #11281 Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14755)
Diffstat (limited to 'crypto/build.info')
-rw-r--r--crypto/build.info44
1 files changed, 30 insertions, 14 deletions
diff --git a/crypto/build.info b/crypto/build.info
index dc180d0252..e6dce8ebc2 100644
--- a/crypto/build.info
+++ b/crypto/build.info
@@ -59,6 +59,31 @@ IF[{- !$disabled{asm} && $config{processor} ne '386' -}]
ENDIF
ENDIF
+# CPUID support. We need to add that explicitly in every shared library and
+# provider module that uses it. ctype.c is included here because the CPUID
+# uses functions from there to parse magic environment variables.
+$CPUID_COMMON=$CPUIDASM cpuid.c ctype.c
+INCLUDE[cpuid.o]=..
+
+SOURCE[../libcrypto]=$CPUID_COMMON
+DEFINE[../libcrypto]=$CPUIDDEF
+SOURCE[../providers/fips]=$CPUID_COMMON
+DEFINE[../providers/fips]=$CPUIDDEF
+# We only need to include the CPUID stuff in the legacy provider when it's a
+# separate module and it's dynamically linked with libcrypto. Otherwise, it
+# already gets everything that the static libcrypto.a has, and doesn't need it
+# added again.
+IF[{- !$disabled{module} && !$disabled{shared} -}]
+ SOURCE[../providers/liblegacy.a]=$CPUID_COMMON
+ DEFINE[../providers/liblegacy.a]=$CPUIDDEF
+ENDIF
+
+# Implementations are now spread across several libraries, so the CPUID define
+# need to be applied to all affected libraries and modules.
+DEFINE[../providers/libfips.a]=$CPUIDDEF
+DEFINE[../providers/libimplementations.a]=$CPUIDDEF
+DEFINE[../providers/libcommon.a]=$CPUIDDEF
+
# The Core
$CORE_COMMON=provider_core.c provider_predefined.c \
core_fetch.c core_algorithm.c core_namemap.c self_test_core.c
@@ -69,28 +94,19 @@ SOURCE[../providers/libfips.a]=$CORE_COMMON
# Central utilities
$UTIL_COMMON=\
cryptlib.c params.c params_from_text.c bsearch.c ex_data.c o_str.c \
- ctype.c threads_pthread.c threads_win.c threads_none.c initthread.c \
- context.c sparse_array.c asn1_dsa.c packet.c param_build.c $CPUIDASM \
+ threads_pthread.c threads_win.c threads_none.c initthread.c \
+ context.c sparse_array.c asn1_dsa.c packet.c param_build.c \
param_build_set.c der_writer.c passphrase.c threads_lib.c
-$UTIL_DEFINE=$CPUIDDEF
SOURCE[../libcrypto]=$UTIL_COMMON \
mem.c mem_sec.c \
cversion.c info.c cpt_err.c ebcdic.c uid.c o_time.c o_dir.c \
o_fopen.c getenv.c o_init.c init.c trace.c provider.c \
- punycode.c \
- $UPLINKSRC
+ punycode.c
SOURCE[../providers/libfips.a]=$UTIL_COMMON
-SOURCE[../providers/liblegacy.a]=cryptlib.c $CPUIDASM ctype.c
-# Implementations are now spread across several libraries, so the defines
-# need to be applied to all affected libraries and modules.
-DEFINE[../libcrypto]=$UTIL_DEFINE $UPLINKDEF
-DEFINE[../providers/libfips.a]=$UTIL_DEFINE
-DEFINE[../providers/fips]=$UTIL_DEFINE
-DEFINE[../providers/libimplementations.a]=$UTIL_DEFINE
-DEFINE[../providers/liblegacy.a]=$UTIL_DEFINE
-DEFINE[../providers/libcommon.a]=$UTIL_DEFINE
+SOURCE[../libcrypto]=$UPLINKSRC
+DEFINE[../libcrypto]=$UPLINKDEF
DEPEND[info.o]=buildinf.h
DEPEND[cversion.o]=buildinf.h