2019-10-04 07:38:17 +08:00
|
|
|
# We place all implementations in static libraries, and then let the
|
|
|
|
# provider mains pilfer what they want through symbol resolution when
|
|
|
|
# linking.
|
|
|
|
#
|
|
|
|
# The non-legacy implementations (libimplementations) must be made FIPS
|
|
|
|
# agnostic as much as possible, as well as the common building blocks
|
|
|
|
# (libcommon). The legacy implementations (liblegacy) will never be
|
|
|
|
# part of the FIPS provider.
|
|
|
|
#
|
|
|
|
# If there is anything that isn't FIPS agnostic, it should be set aside
|
|
|
|
# in its own source file, which is then included directly into other
|
|
|
|
# static libraries geared for FIPS and non-FIPS providers, and built
|
|
|
|
# separately.
|
|
|
|
#
|
|
|
|
# libcommon.a Contains common building blocks, potentially
|
|
|
|
# needed both by non-legacy and legacy code.
|
|
|
|
#
|
|
|
|
# libimplementations.a Contains all non-legacy implementations.
|
2019-12-01 07:18:47 +08:00
|
|
|
# liblegacy.a Contains all legacy implementations.
|
2019-10-04 07:38:17 +08:00
|
|
|
#
|
|
|
|
# libfips.a Contains all things needed to support
|
|
|
|
# FIPS implementations, such as code from
|
|
|
|
# crypto/ and object files that contain
|
|
|
|
# FIPS-specific code. FIPS_MODE is defined
|
|
|
|
# for this library. The FIPS module uses
|
|
|
|
# this.
|
|
|
|
# libnonfips.a Corresponds to libfips.a, but built with
|
|
|
|
# FIPS_MODE undefined. The default and legacy
|
|
|
|
# providers use this.
|
|
|
|
|
2019-10-04 21:37:14 +08:00
|
|
|
SUBDIRS=common implementations
|
2019-03-20 22:27:52 +08:00
|
|
|
|
2019-04-19 17:31:18 +08:00
|
|
|
INCLUDE[../libcrypto]=common/include
|
|
|
|
|
2019-10-04 07:38:17 +08:00
|
|
|
# Libraries we're dealing with
|
|
|
|
$LIBCOMMON=libcommon.a
|
|
|
|
$LIBIMPLEMENTATIONS=libimplementations.a
|
|
|
|
$LIBLEGACY=liblegacy.a
|
|
|
|
$LIBNONFIPS=libnonfips.a
|
|
|
|
$LIBFIPS=libfips.a
|
|
|
|
|
|
|
|
# Enough of our implementations include prov/ciphercommon.h (present in
|
2019-12-19 20:33:35 +08:00
|
|
|
# providers/implementations/include), which includes crypto/*_platform.h
|
2019-10-04 07:38:17 +08:00
|
|
|
# (present in include), which in turn may include very internal header
|
|
|
|
# files in crypto/, so let's have a common include list for them all.
|
2019-12-04 02:41:05 +08:00
|
|
|
$COMMON_INCLUDES=../crypto ../include implementations/include common/include
|
2019-10-04 07:38:17 +08:00
|
|
|
|
|
|
|
INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES
|
2019-12-04 02:41:05 +08:00
|
|
|
INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES
|
2020-04-09 10:47:46 +08:00
|
|
|
INCLUDE[$LIBLEGACY]=.. $COMMON_INCLUDES
|
2019-10-04 07:38:17 +08:00
|
|
|
INCLUDE[$LIBNONFIPS]=$COMMON_INCLUDES
|
|
|
|
INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES
|
|
|
|
DEFINE[$LIBFIPS]=FIPS_MODE
|
|
|
|
|
|
|
|
# Weak dependencies to provide library order information.
|
|
|
|
# We make it weak so they aren't both used always; what is
|
|
|
|
# actually used is determined by non-weak dependencies.
|
|
|
|
DEPEND[$LIBIMPLEMENTATIONS]{weak}=$LIBFIPS $LIBNONFIPS
|
|
|
|
DEPEND[$LIBCOMMON]{weak}=$LIBFIPS
|
|
|
|
|
|
|
|
# Strong dependencies. This ensures that any time libimplementations
|
|
|
|
# is used, libcommon gets included as well.
|
|
|
|
DEPEND[$LIBIMPLEMENTATIONS]=$LIBCOMMON
|
|
|
|
DEPEND[$LIBNONFIPS]=../libcrypto
|
|
|
|
# It's tempting to make libcommon depend on ../libcrypto. However,
|
|
|
|
# since the FIPS provider module must NOT depend on ../libcrypto, we
|
|
|
|
# need to set that dependency up specifically for the final products
|
|
|
|
# that use $LIBCOMMON or anything that depends on it.
|
|
|
|
|
|
|
|
# Libraries common to all providers, must be built regardless
|
|
|
|
LIBS{noinst}=$LIBCOMMON
|
|
|
|
# Libraries that are common for all non-FIPS providers, must be built regardless
|
|
|
|
LIBS{noinst}=$LIBNONFIPS $LIBIMPLEMENTATIONS
|
|
|
|
|
|
|
|
#
|
|
|
|
# Default provider stuff
|
|
|
|
#
|
|
|
|
# Because the default provider is built in, it means that libcrypto must
|
|
|
|
# include all the object files that are needed (we do that indirectly,
|
|
|
|
# by using the appropriate libraries as source). Note that for shared
|
|
|
|
# libraries, SOURCEd libraries are considered as if the where specified
|
|
|
|
# with DEPEND.
|
|
|
|
$DEFAULTGOAL=../libcrypto
|
|
|
|
SOURCE[$DEFAULTGOAL]=$LIBIMPLEMENTATIONS $LIBNONFIPS
|
2019-10-04 21:37:14 +08:00
|
|
|
SOURCE[$DEFAULTGOAL]=defltprov.c
|
2019-10-04 18:30:33 +08:00
|
|
|
# Some legacy implementations depend on provider header files
|
2019-12-04 02:41:05 +08:00
|
|
|
INCLUDE[$DEFAULTGOAL]=implementations/include
|
2019-10-04 07:38:17 +08:00
|
|
|
|
|
|
|
LIBS=$DEFAULTGOAL
|
|
|
|
|
|
|
|
#
|
|
|
|
# FIPS provider stuff
|
|
|
|
#
|
|
|
|
# We define it this way to ensure that configdata.pm will have all the
|
|
|
|
# necessary information even if we don't build the module. This will allow
|
|
|
|
# us to make all kinds of checks on the source, based on what we specify in
|
|
|
|
# diverse build.info files. libfips.a, fips.so and their sources aren't
|
|
|
|
# built unless the proper LIBS or MODULES statement has been seen, so we
|
|
|
|
# have those and only those within a condition.
|
|
|
|
SUBDIRS=fips
|
|
|
|
$FIPSGOAL=fips
|
|
|
|
DEPEND[$FIPSGOAL]=$LIBIMPLEMENTATIONS $LIBFIPS
|
|
|
|
INCLUDE[$FIPSGOAL]=../include
|
2020-02-14 01:17:43 +08:00
|
|
|
DEFINE[$FIPSGOAL]=FIPS_MODE
|
2019-10-04 07:38:17 +08:00
|
|
|
IF[{- defined $target{shared_defflag} -}]
|
|
|
|
SOURCE[$FIPSGOAL]=fips.ld
|
|
|
|
GENERATE[fips.ld]=../util/providers.num
|
|
|
|
ENDIF
|
|
|
|
|
2019-03-20 22:27:52 +08:00
|
|
|
IF[{- !$disabled{fips} -}]
|
2019-10-04 07:38:17 +08:00
|
|
|
# This is the trigger to actually build the FIPS module. Without these
|
|
|
|
# statements, the final build file will not have a trace of it.
|
|
|
|
MODULES=$FIPSGOAL
|
|
|
|
LIBS{noinst}=$LIBFIPS
|
2019-03-20 22:27:52 +08:00
|
|
|
ENDIF
|
2019-04-05 17:47:05 +08:00
|
|
|
|
2019-10-04 07:38:17 +08:00
|
|
|
#
|
|
|
|
# Legacy provider stuff
|
|
|
|
#
|
2019-04-05 17:47:05 +08:00
|
|
|
IF[{- !$disabled{legacy} -}]
|
2019-10-04 07:38:17 +08:00
|
|
|
# The legacy implementation library
|
|
|
|
LIBS{noinst}=$LIBLEGACY
|
|
|
|
DEPEND[$LIBLEGACY]=$LIBCOMMON $LIBNONFIPS
|
|
|
|
|
|
|
|
# The Legacy provider
|
2019-08-19 14:55:53 +08:00
|
|
|
IF[{- $disabled{module} -}]
|
2019-10-04 07:38:17 +08:00
|
|
|
# Become built in
|
|
|
|
# In this case, we need to do the same thing a for the default provider,
|
|
|
|
# and make the liblegacy object files end up in libcrypto. We could also
|
|
|
|
# just say that for the built-in legacy, we put the source directly in
|
|
|
|
# libcrypto instead of going via liblegacy, but that makes writing the
|
|
|
|
# implementation specific build.info files harder to write, so we don't.
|
|
|
|
$LEGACYGOAL=../libcrypto
|
|
|
|
SOURCE[$LEGACYGOAL]=$LIBLEGACY
|
|
|
|
DEFINE[$LIBLEGACY]=STATIC_LEGACY
|
|
|
|
DEFINE[$LEGACYGOAL]=STATIC_LEGACY
|
2019-08-19 14:55:53 +08:00
|
|
|
ELSE
|
2019-10-04 07:38:17 +08:00
|
|
|
# Become a module
|
|
|
|
# In this case, we can work with dependencies
|
|
|
|
$LEGACYGOAL=legacy
|
|
|
|
MODULES=$LEGACYGOAL
|
|
|
|
DEPEND[$LEGACYGOAL]=$LIBLEGACY
|
2019-08-19 14:55:53 +08:00
|
|
|
IF[{- defined $target{shared_defflag} -}]
|
|
|
|
SOURCE[legacy]=legacy.ld
|
|
|
|
GENERATE[legacy.ld]=../util/providers.num
|
|
|
|
ENDIF
|
2019-04-05 17:47:05 +08:00
|
|
|
ENDIF
|
2019-10-04 07:38:17 +08:00
|
|
|
|
|
|
|
# Common things that are valid no matter what form the Legacy provider
|
|
|
|
# takes.
|
2019-10-04 21:37:14 +08:00
|
|
|
SOURCE[$LEGACYGOAL]=legacyprov.c
|
|
|
|
INCLUDE[$LEGACYGOAL]=../include implementations/include
|
2019-04-05 17:47:05 +08:00
|
|
|
ENDIF
|
2020-04-08 10:02:34 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Null provider stuff
|
|
|
|
#
|
|
|
|
# Because the null provider is built in, it means that libcrypto must
|
|
|
|
# include all the object files that are needed.
|
|
|
|
$NULLGOAL=../libcrypto
|
|
|
|
SOURCE[$NULLGOAL]=nullprov.c
|
|
|
|
|
|
|
|
|