Include BN assembler alongside CPUID code
authorRichard Levitte <levitte@openssl.org>
Wed, 15 Apr 2020 10:54:23 +0000 (12:54 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 2 Apr 2021 14:39:13 +0000 (16:39 +0200)
It turns out that some CPUID code requires the presence of some BN
assembler code, so we make sure it's included in the same manner as
the CPUID code itself.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14755)

crypto/bn/build.info
crypto/build.info

index 237d5e90edf4f8efc6309a14d3c147d28a2baed3..89ff0044f25c94e34173fe509a70abb506524292 100644 (file)
@@ -107,17 +107,21 @@ $COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
         bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
         bn_intern.c bn_dh.c bn_rsa_fips186_4.c bn_const.c
 SOURCE[../../libcrypto]=$COMMON $BNASM bn_print.c bn_err.c bn_srp.c
+DEFINE[../../libcrypto]=$BNDEF
 IF[{- !$disabled{'deprecated-3.0'} -}]
   SOURCE[../../libcrypto]=bn_depr.c bn_x931p.c
 ENDIF
 SOURCE[../../providers/libfips.a]=$COMMON $BNASM
+DEFINE[../../providers/libfips.a]=$BNDEF
+# Because some CPUID implementations use some BN assembler (!!!), we
+# must include assembler code into the legacy provider under the same
+# conditions as CPUID code is included.  See ../build.info
 SOURCE[../../providers/liblegacy.a]=$BNASM
+DEFINE[../../providers/liblegacy.a]=$BNDEF
 # Implementations are now spread across several libraries, so the defines
 # need to be applied to all affected libraries and modules.
-DEFINE[../../libcrypto]=$BNDEF
-DEFINE[../../providers/libfips.a]=$BNDEF
-DEFINE[../../providers/liblegacy.a]=$BNDEF
 DEFINE[../../providers/libimplementations.a]=$BNDEF
+DEFINE[../../providers/libcommon.a]=$BNDEF
 
 INCLUDE[bn_exp.o]=..
 
index e6dce8ebc2c51bf15a2b36f8e0636f0872f49be8..560f872ee2cff5b38db0b97e91a981f88245bf14 100644 (file)
@@ -67,8 +67,8 @@ INCLUDE[cpuid.o]=..
 
 SOURCE[../libcrypto]=$CPUID_COMMON
 DEFINE[../libcrypto]=$CPUIDDEF
-SOURCE[../providers/fips]=$CPUID_COMMON
-DEFINE[../providers/fips]=$CPUIDDEF
+SOURCE[../providers/libfips.a]=$CPUID_COMMON
+DEFINE[../providers/libfips.a]=$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
@@ -80,7 +80,6 @@ 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