Avoid duplicating symbols in legacy.a with some build options
authorTomas Mraz <tomas@openssl.org>
Wed, 25 Jan 2023 15:32:02 +0000 (16:32 +0100)
committerPauli <pauli@openssl.org>
Tue, 31 Jan 2023 00:10:22 +0000 (11:10 +1100)
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 <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20137)

15 files changed:
crypto/bf/build.info
crypto/bn/build.info
crypto/cast/build.info
crypto/des/build.info
crypto/idea/build.info
crypto/md2/build.info
crypto/md4/build.info
crypto/md5/build.info
crypto/mdc2/build.info
crypto/rc2/build.info
crypto/rc4/build.info
crypto/rc5/build.info
crypto/ripemd/build.info
crypto/seed/build.info
crypto/whrlpool/build.info

index 0c32fedef8ef7db2a70d977c41e5eac237d8e78b..d24ab5ae573d7f21d3b8bae3083e2e555a51aa0e 100644 (file)
@@ -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
 
index 987a70ae263bed654b99f7dde226afb412f4ac39..cbf80ce6cae523b1555ab5421117c51c5d4bd664 100644 (file)
@@ -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
index 7653b221881a2c31ee39f84c9a1bdba42ac4635a..4395f0ac22a2be73b7b0c0d5579a0aa5b7b4bb5e 100644 (file)
@@ -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
 
index 4284272cfa80d4ec4a30053d51ec3fb7d4be2588..5a13e4f9bebc7f515b4ea7b2b2df4fdd3aa4fd72 100644 (file)
@@ -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
index 5441351b9cd76ae44db246604783a9f19b0eee88..7ac120918b911715af5c6450da82dde0ee04d242 100644 (file)
@@ -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
index a1bb42109457c214e2674b3e2fbb5701407faed6..541245331f1238995f605ead3e0e78a025093181 100644 (file)
@@ -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
index bed9c0bd40cade79702409f619c0c043e9d6baab..ccd93835f708a663cf1140b39bf65711703d7ce3 100644 (file)
@@ -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
index e8c547842a765087b257e4406c6aae435a20ec85..34f29faf766643344342b1d8b5a723a4f33f4977 100644 (file)
@@ -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
 
index 76aa0705e465a2d55767518f89aa8bff2af71211..f748357b1a484c7fd9c1ac0364ca241cccd8e4cf 100644 (file)
@@ -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
index b6d60d6ee3060de7c822b0d8a1c1ce16348b2e39..d1f0ff9c7b692ab1c32b92a94c02f7ba9193e97f 100644 (file)
@@ -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
index 14ec94f9f2a7583ffa559e4e32929822a47e6993..68b3c73f55b04feb339a4e137602f447372d10d7 100644 (file)
@@ -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
 
index 96ed42d2cbf702342d48e4be9db46226329f57b5..1b396252bb5cf61a7cbc7af4aa3b6439f32359f1 100644 (file)
@@ -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
 
index f050480de4e56060f293747e7374eb47f48de151..17acec0bedcfcf913e62b5a6fe62e33111e5f4c9 100644 (file)
@@ -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
index 5336f0399cd7ed1205ee73858995b074583f7f61..f513654ecb6781d811745682155d8801a1652ece 100644 (file)
@@ -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
index 137f6dc6c6744fc5d853f5742d81d20b3f4df3b4..c7dbecb4fd79b09b6d6a12793f4d9214bfc90211 100644 (file)
@@ -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