From 58e8162e73d9061bd056f041bf07a1573d202d7a Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 25 Jan 2023 16:32:02 +0100 Subject: Avoid duplicating symbols in legacy.a with some build options If no-module or no-shared is used, the symbols from libcrypto should not be duplicated in legacy.a Also the BIGNUM functions are currently not needed in legacy.a at all. Fixes #20124 Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/20137) (cherry picked from commit f6a6f7b6aa84dab44384780cb77050d15c5f575e) --- crypto/bf/build.info | 2 +- crypto/bn/build.info | 5 ----- crypto/cast/build.info | 2 +- crypto/des/build.info | 5 +++-- crypto/idea/build.info | 2 +- crypto/md2/build.info | 2 +- crypto/md4/build.info | 2 +- crypto/md5/build.info | 2 +- crypto/mdc2/build.info | 2 +- crypto/rc2/build.info | 2 +- crypto/rc4/build.info | 2 +- crypto/rc5/build.info | 2 +- crypto/ripemd/build.info | 2 +- crypto/seed/build.info | 2 +- crypto/whrlpool/build.info | 2 +- 15 files changed, 16 insertions(+), 20 deletions(-) (limited to 'crypto') diff --git a/crypto/bf/build.info b/crypto/bf/build.info index 0c32fedef8..d24ab5ae57 100644 --- a/crypto/bf/build.info +++ b/crypto/bf/build.info @@ -17,7 +17,7 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # blowfish functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/bn/build.info b/crypto/bn/build.info index 987a70ae26..cbf80ce6ca 100644 --- a/crypto/bn/build.info +++ b/crypto/bn/build.info @@ -116,11 +116,6 @@ IF[{- !$disabled{'deprecated-3.0'} -}] 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[../../providers/libcommon.a]=$BNDEF diff --git a/crypto/cast/build.info b/crypto/cast/build.info index 7653b22188..4395f0ac22 100644 --- a/crypto/cast/build.info +++ b/crypto/cast/build.info @@ -18,7 +18,7 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # cast functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/des/build.info b/crypto/des/build.info index 4284272cfa..5a13e4f9be 100644 --- a/crypto/des/build.info +++ b/crypto/des/build.info @@ -23,11 +23,12 @@ $ALL=$COMMON\ SOURCE[../../libcrypto]=$ALL $DESASM SOURCE[../../providers/libfips.a]=$COMMON $DESASM -SOURCE[../../providers/liblegacy.a]=$DESASM +IF[{- !$disabled{module} && !$disabled{shared} -}] + SOURCE[../../providers/liblegacy.a]=$DESASM +ENDIF DEFINE[../../libcrypto]=$DESDEF DEFINE[../../providers/libfips.a]=$DESDEF -DEFINE[../../providers/liblegacy.a]=$DESDEF # When all deprecated symbols are removed, libcrypto doesn't export the # DES functions, so we must include them directly in liblegacy.a diff --git a/crypto/idea/build.info b/crypto/idea/build.info index 5441351b9c..7ac120918b 100644 --- a/crypto/idea/build.info +++ b/crypto/idea/build.info @@ -5,6 +5,6 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # idea functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/md2/build.info b/crypto/md2/build.info index a1bb421094..541245331f 100644 --- a/crypto/md2/build.info +++ b/crypto/md2/build.info @@ -4,6 +4,6 @@ SOURCE[../../libcrypto]=md2_dgst.c md2_one.c # When all deprecated symbols are removed, libcrypto doesn't export the # MD2 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=md2_dgst.c md2_one.c ENDIF diff --git a/crypto/md4/build.info b/crypto/md4/build.info index bed9c0bd40..ccd93835f7 100644 --- a/crypto/md4/build.info +++ b/crypto/md4/build.info @@ -4,6 +4,6 @@ SOURCE[../../libcrypto]=md4_dgst.c md4_one.c # When all deprecated symbols are removed, libcrypto doesn't export the # MD4 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=md4_dgst.c md4_one.c ENDIF diff --git a/crypto/md5/build.info b/crypto/md5/build.info index e8c547842a..34f29faf76 100644 --- a/crypto/md5/build.info +++ b/crypto/md5/build.info @@ -24,7 +24,7 @@ SOURCE[../../libcrypto]=$COMMON # default provider. A no-deprecated build removes the external definition from # libcrypto and this means that the code needs to be in liblegacy. However, # when building without 'dso', liblegacy is included in libcrypto. -IF[{- !$disabled{dso} -}] +IF[{- !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$COMMON ENDIF diff --git a/crypto/mdc2/build.info b/crypto/mdc2/build.info index 76aa0705e4..f748357b1a 100644 --- a/crypto/mdc2/build.info +++ b/crypto/mdc2/build.info @@ -4,6 +4,6 @@ SOURCE[../../libcrypto]=mdc2dgst.c mdc2_one.c # When all deprecated symbols are removed, libcrypto doesn't export the # MDC2 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=mdc2dgst.c mdc2_one.c ENDIF diff --git a/crypto/rc2/build.info b/crypto/rc2/build.info index b6d60d6ee3..d1f0ff9c7b 100644 --- a/crypto/rc2/build.info +++ b/crypto/rc2/build.info @@ -6,6 +6,6 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # rc2 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/rc4/build.info b/crypto/rc4/build.info index 14ec94f9f2..68b3c73f55 100644 --- a/crypto/rc4/build.info +++ b/crypto/rc4/build.info @@ -21,7 +21,7 @@ SOURCE[../../libcrypto]=$RC4ASM # When all deprecated symbols are removed, libcrypto doesn't export the # rc4 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$RC4ASM ENDIF diff --git a/crypto/rc5/build.info b/crypto/rc5/build.info index 96ed42d2cb..1b396252bb 100644 --- a/crypto/rc5/build.info +++ b/crypto/rc5/build.info @@ -18,7 +18,7 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # rc5 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/ripemd/build.info b/crypto/ripemd/build.info index f050480de4..17acec0bed 100644 --- a/crypto/ripemd/build.info +++ b/crypto/ripemd/build.info @@ -20,7 +20,7 @@ DEFINE[../../libcrypto]=$RMD160DEF # When all deprecated symbols are removed, libcrypto doesn't export the # RIPEMD160 functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} && !$disabled{'module'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=rmd_dgst.c rmd_one.c $RMD160ASM DEFINE[../../providers/liblegacy.a]=$RMD160DEF ENDIF diff --git a/crypto/seed/build.info b/crypto/seed/build.info index 5336f0399c..f513654ecb 100644 --- a/crypto/seed/build.info +++ b/crypto/seed/build.info @@ -5,6 +5,6 @@ SOURCE[../../libcrypto]=$ALL # When all deprecated symbols are removed, libcrypto doesn't export the # seed functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=$ALL ENDIF diff --git a/crypto/whrlpool/build.info b/crypto/whrlpool/build.info index 137f6dc6c6..c7dbecb4fd 100644 --- a/crypto/whrlpool/build.info +++ b/crypto/whrlpool/build.info @@ -22,7 +22,7 @@ DEFINE[../../libcrypto]=$WPDEF # When all deprecated symbols are removed, libcrypto doesn't export the # WHIRLPOOL functions, so we must include them directly in liblegacy.a -IF[{- $disabled{'deprecated-3.0'} -}] +IF[{- $disabled{'deprecated-3.0'} && !$disabled{module} && !$disabled{shared} -}] SOURCE[../../providers/liblegacy.a]=wp_dgst.c $WPASM DEFINE[../../providers/liblegacy.a]=$WPDEF ENDIF -- cgit v1.2.3