When building of modules is disabled, build the legacy provider into libcrypto
authorRichard Levitte <levitte@openssl.org>
Mon, 19 Aug 2019 06:55:53 +0000 (08:55 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 26 Sep 2019 20:41:47 +0000 (22:41 +0200)
This makes the legacy provider available regardless of building conditions.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9637)

Configure
crypto/provider_predefined.c
providers/build.info
providers/legacy/build.info
providers/legacy/digests/build.info
providers/legacy/legacyprov.c

index 7e6091e633de1e75e095181f39950415f83fe5d5..3a29d903298c8853674546a81d17493361c71664 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -518,7 +518,7 @@ my @disable_cascades = (
     # or modules.
     "pic"               => [ "shared", "module" ],
 
-    "module"            => [ "fips", "legacy" ],
+    "module"            => [ "fips" ],
 
     "engine"            => [ grep /eng$/, @disablables ],
     "hw"                => [ "padlockeng" ],
index d1423b1c6ce6d0908ca5f8f43fe9380d9e820118..e65f4610085823aed1b3bcf3bfb386128f9dfa3c 100644 (file)
 
 OSSL_provider_init_fn ossl_default_provider_init;
 OSSL_provider_init_fn fips_intern_provider_init;
-
+#ifdef STATIC_LEGACY
+OSSL_provider_init_fn ossl_legacy_provider_init;
+#endif
 const struct predefined_providers_st predefined_providers[] = {
 #ifdef FIPS_MODE
     { "fips", fips_intern_provider_init, 1 },
 #else
     { "default", ossl_default_provider_init, 1 },
+# ifdef STATIC_LEGACY
+    { "legacy", ossl_legacy_provider_init, 0 },
+# endif
 #endif
     { NULL, NULL, 0 }
 };
index 192a5defccb1a80d98eb4992c6354eb7d12a4348..9642a3c1531f1fb8d5fe9811db1083e0b0480c03 100644 (file)
@@ -15,11 +15,16 @@ ENDIF
 
 IF[{- !$disabled{legacy} -}]
   SUBDIRS=legacy
-  MODULES=legacy
-  IF[{- defined $target{shared_defflag} -}]
-    SOURCE[legacy]=legacy.ld
-    GENERATE[legacy.ld]=../util/providers.num
+  IF[{- $disabled{module} -}]
+    LIBS=../libcrypto
+    DEFINE[../libcrypto]=STATIC_LEGACY
+  ELSE
+    MODULES=legacy
+    IF[{- defined $target{shared_defflag} -}]
+      SOURCE[legacy]=legacy.ld
+      GENERATE[legacy.ld]=../util/providers.num
+    ENDIF
+    DEPEND[legacy]=../libcrypto
+    INCLUDE[legacy]=.. ../include ../crypto/include common/include
   ENDIF
-  INCLUDE[legacy]=.. ../include ../crypto/include common/include
-  DEPEND[legacy]=../libcrypto
 ENDIF
index df7e9ac750758db2a7d98f34b90700e9301a8692..713c48dbe60035a19e72e6aa2d8e0d09adc28fcf 100644 (file)
@@ -1,4 +1,8 @@
 SUBDIRS=digests
+IF[{- $disabled{module} -}]
+  $GOAL=../../libcrypto
+ELSE
+  $GOAL=../legacy
+ENDIF
 
-SOURCE[../legacy]=\
-        legacyprov.c
+SOURCE[$GOAL]=legacyprov.c
index 538afd4c075bc86336c7117f9723d1fb490ec37e..2c85970ddec11d33a3f70504a3184e56d5449cfe 100644 (file)
@@ -1,24 +1,30 @@
+IF[{- $disabled{module} -}]
+  $GOAL=../../../libcrypto
+ELSE
+  $GOAL=../../legacy
+ENDIF
+
 IF[{- !$disabled{md2} -}]
-  SOURCE[../../legacy]=\
+  SOURCE[$GOAL]=\
           md2_prov.c
 ENDIF
 
 IF[{- !$disabled{md4} -}]
-  SOURCE[../../legacy]=\
+  SOURCE[$GOAL]=\
           md4_prov.c
 ENDIF
 
 IF[{- !$disabled{mdc2} -}]
-  SOURCE[../../legacy]=\
+  SOURCE[$GOAL]=\
           mdc2_prov.c
 ENDIF
 
 IF[{- !$disabled{whirlpool} -}]
-  SOURCE[../../legacy]=\
+  SOURCE[$GOAL]=\
           wp_prov.c
 ENDIF
 
 IF[{- !$disabled{rmd160} -}]
-  SOURCE[../../legacy]=\
+  SOURCE[$GOAL]=\
           ripemd_prov.c
 ENDIF
\ No newline at end of file
index 9b2df1e5e769e2e3fc7310a58818e73a07fd6ce5..89587d632c6235ee53f14d3bf70cd03917b17a46 100644 (file)
 #include <openssl/params.h>
 #include "internal/provider_algs.h"
 
+#ifdef STATIC_LEGACY
+OSSL_provider_init_fn ossl_legacy_provider_init;
+# define OSSL_provider_init ossl_legacy_provider_init
+#endif
+
 /* Functions provided by the core */
 static OSSL_core_gettable_params_fn *c_gettable_params = NULL;
 static OSSL_core_get_params_fn *c_get_params = NULL;