Skip to content

Commit

Permalink
When building of modules is disabled, build the legacy provider into …
Browse files Browse the repository at this point in the history
…libcrypto

This makes the legacy provider available regardless of building conditions.

Reviewed-by: Matt Caswell <[email protected]>
(Merged from openssl#9637)
  • Loading branch information
levitte committed Sep 26, 2019
1 parent 03f30c5 commit 318e074
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Configure
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ my @disable_cascades = (
# or modules.
"pic" => [ "shared", "module" ],

"module" => [ "fips", "legacy" ],
"module" => [ "fips" ],

"engine" => [ grep /eng$/, @disablables ],
"hw" => [ "padlockeng" ],
Expand Down
7 changes: 6 additions & 1 deletion crypto/provider_predefined.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@

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 }
};
17 changes: 11 additions & 6 deletions providers/build.info
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions providers/legacy/build.info
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
SUBDIRS=digests
IF[{- $disabled{module} -}]
$GOAL=../../libcrypto
ELSE
$GOAL=../legacy
ENDIF

SOURCE[../legacy]=\
legacyprov.c
SOURCE[$GOAL]=legacyprov.c
16 changes: 11 additions & 5 deletions providers/legacy/digests/build.info
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions providers/legacy/legacyprov.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
#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;
Expand Down

0 comments on commit 318e074

Please sign in to comment.