| 1 |
# libcommon.a Contains common building blocks and other routines, |
| 2 |
# potentially needed by any of our providers. |
| 3 |
# |
| 4 |
# libfips.a Contains all algorithm implementations that should |
| 5 |
# go in the FIPS provider. The compilations for this |
| 6 |
# library are all done with FIPS_MODULE defined. |
| 7 |
# |
| 8 |
# liblegacy.a Contains all algorithm implementations that should |
| 9 |
# go into the legacy provider. The compilations for |
| 10 |
# this library are all done with STATIC_LEGACY defined. |
| 11 |
# |
| 12 |
# libdefault.a Contains all algorithm implementations that should |
| 13 |
# into the default or base provider. |
| 14 |
# |
| 15 |
# To be noted is that the FIPS provider shares source code with libcrypto, |
| 16 |
# which means that select source files from crypto/ are compiled for |
| 17 |
# libfips.a the sources from providers/implementations. |
| 18 |
# |
| 19 |
# This is how a provider module should be linked: |
| 20 |
# |
| 21 |
# -o {modulename}.so {object files...} lib{modulename}.a libcommon.a |
| 22 |
# |
| 23 |
# It is crucial that code that checks the FIPS_MODULE macro ends up in |
| 24 |
# libfips.a. |
| 25 |
# It is crucial that code that checks the STATIC_LEGACY macro ends up in |
| 26 |
# liblegacy.a. |
| 27 |
# It is recommended that code that is written for libcommon.a doesn't end |
| 28 |
# up depending on libfips.a, liblegacy.a or libdefault.a |
| 29 |
# |
| 30 |
# Code in providers/implementations/ should be written in such a way that |
| 31 |
# the OSSL_DISPATCH arrays (and preferably the majority of the actual code) |
| 32 |
# end up in either libfips.a, liblegacy.a or libdefault.a. |
| 33 |
|
| 34 |
SUBDIRS=common implementations |
| 35 |
|
| 36 |
INCLUDE[../libcrypto]=common/include |
| 37 |
|
| 38 |
# Libraries we're dealing with |
| 39 |
$LIBCOMMON=libcommon.a |
| 40 |
$LIBFIPS=libfips.a |
| 41 |
$LIBLEGACY=liblegacy.a |
| 42 |
$LIBDEFAULT=libdefault.a |
| 43 |
LIBS{noinst}=$LIBDEFAULT $LIBCOMMON |
| 44 |
|
| 45 |
# Enough of our implementations include prov/ciphercommon.h (present in |
| 46 |
# providers/implementations/include), which includes crypto/*_platform.h |
| 47 |
# (present in include), which in turn may include very internal header |
| 48 |
# files in crypto/, so let's have a common include list for them all. |
| 49 |
$COMMON_INCLUDES=../crypto ../include implementations/include common/include \ |
| 50 |
fips/include |
| 51 |
|
| 52 |
INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES |
| 53 |
INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES |
| 54 |
INCLUDE[$LIBLEGACY]=.. $COMMON_INCLUDES |
| 55 |
INCLUDE[$LIBDEFAULT]=.. $COMMON_INCLUDES |
| 56 |
DEFINE[$LIBFIPS]=FIPS_MODULE |
| 57 |
|
| 58 |
# Weak dependencies to provide library order information. What is actually |
| 59 |
# used is determined by non-weak dependencies. |
| 60 |
DEPEND[$LIBCOMMON]{weak}=../libcrypto |
| 61 |
|
| 62 |
# Strong dependencies. This ensures that any time an implementation library |
| 63 |
# is used, libcommon gets included as well. |
| 64 |
# The $LIBFIPS dependency on $LIBCOMMON is extra strong, to mitigate for |
| 65 |
# linking problems because they are interdependent |
| 66 |
SOURCE[$LIBFIPS]=$LIBCOMMON |
| 67 |
DEPEND[$LIBLEGACY]=$LIBCOMMON |
| 68 |
DEPEND[$LIBDEFAULT]=$LIBCOMMON |
| 69 |
|
| 70 |
# |
| 71 |
# Default provider stuff |
| 72 |
# |
| 73 |
# Because the default provider is built in, it means that libcrypto must |
| 74 |
# include all the object files that are needed (we do that indirectly, |
| 75 |
# by using the appropriate libraries as source). Note that for shared |
| 76 |
# libraries, SOURCEd libraries are considered as if they were specified |
| 77 |
# with DEPEND. |
| 78 |
$DEFAULTGOAL=../libcrypto |
| 79 |
SOURCE[$DEFAULTGOAL]=$LIBDEFAULT defltprov.c |
| 80 |
INCLUDE[$DEFAULTGOAL]=implementations/include |
| 81 |
|
| 82 |
# |
| 83 |
# Base provider stuff |
| 84 |
# |
| 85 |
# Because the base provider is built in, it means that libcrypto must |
| 86 |
# include all of the object files that are needed, just like the default |
| 87 |
# provider. |
| 88 |
$BASEGOAL=../libcrypto |
| 89 |
SOURCE[$BASEGOAL]=$LIBDEFAULT baseprov.c |
| 90 |
INCLUDE[$BASEGOAL]=implementations/include |
| 91 |
|
| 92 |
# |
| 93 |
# FIPS provider stuff |
| 94 |
# |
| 95 |
# We define it this way to ensure that configdata.pm will have all the |
| 96 |
# necessary information even if we don't build the module. This will allow |
| 97 |
# us to make all kinds of checks on the source, based on what we specify in |
| 98 |
# diverse build.info files. libfips.a, fips.so and their sources aren't |
| 99 |
# built unless the proper LIBS or MODULES statement has been seen, so we |
| 100 |
# have those and only those within a condition. |
| 101 |
IF[{- !$disabled{fips} -}] |
| 102 |
SUBDIRS=fips |
| 103 |
$FIPSGOAL=fips |
| 104 |
|
| 105 |
# This is the trigger to actually build the FIPS module. Without these |
| 106 |
# statements, the final build file will not have a trace of it. |
| 107 |
MODULES{fips}=$FIPSGOAL |
| 108 |
LIBS{noinst}=$LIBFIPS |
| 109 |
|
| 110 |
DEPEND[$FIPSGOAL]=$LIBFIPS |
| 111 |
INCLUDE[$FIPSGOAL]=../include |
| 112 |
DEFINE[$FIPSGOAL]=FIPS_MODULE |
| 113 |
IF[{- defined $target{shared_defflag} -}] |
| 114 |
SOURCE[$FIPSGOAL]=fips.ld |
| 115 |
GENERATE[fips.ld]=../util/providers.num |
| 116 |
ENDIF |
| 117 |
|
| 118 |
DEPEND[|build_modules_nodep|]=fipsmodule.cnf |
| 119 |
GENERATE[fipsmodule.cnf]=../util/mk-fipsmodule-cnf.pl \ |
| 120 |
-module $(FIPSMODULE) -section_name fips_sect -key $(FIPSKEY) |
| 121 |
DEPEND[fipsmodule.cnf]=$FIPSGOAL |
| 122 |
|
| 123 |
# Add VERSIONINFO resource for windows |
| 124 |
IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}] |
| 125 |
GENERATE[fips.rc]=../util/mkrc.pl fips |
| 126 |
SOURCE[$FIPSGOAL]=fips.rc |
| 127 |
ENDIF |
| 128 |
ENDIF |
| 129 |
|
| 130 |
# |
| 131 |
# Legacy provider stuff |
| 132 |
# |
| 133 |
IF[{- !$disabled{legacy} -}] |
| 134 |
LIBS{noinst}=$LIBLEGACY |
| 135 |
|
| 136 |
IF[{- $disabled{module} -}] |
| 137 |
# Become built in |
| 138 |
# In this case, we need to do the same thing a for the default provider, |
| 139 |
# and make the liblegacy object files end up in libcrypto. We could also |
| 140 |
# just say that for the built-in legacy, we put the source directly in |
| 141 |
# libcrypto instead of going via liblegacy, but that makes writing the |
| 142 |
# implementation specific build.info files harder to write, so we don't. |
| 143 |
$LEGACYGOAL=../libcrypto |
| 144 |
SOURCE[$LEGACYGOAL]=$LIBLEGACY |
| 145 |
DEFINE[$LEGACYGOAL]=STATIC_LEGACY |
| 146 |
ELSE |
| 147 |
# Become a module |
| 148 |
# In this case, we can work with dependencies |
| 149 |
$LEGACYGOAL=legacy |
| 150 |
MODULES=$LEGACYGOAL |
| 151 |
DEPEND[$LEGACYGOAL]=$LIBLEGACY ../libcrypto |
| 152 |
IF[{- defined $target{shared_defflag} -}] |
| 153 |
SOURCE[legacy]=legacy.ld |
| 154 |
GENERATE[legacy.ld]=../util/providers.num |
| 155 |
ENDIF |
| 156 |
|
| 157 |
# Add VERSIONINFO resource for windows |
| 158 |
IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}] |
| 159 |
GENERATE[legacy.rc]=../util/mkrc.pl legacy |
| 160 |
SOURCE[$LEGACYGOAL]=legacy.rc |
| 161 |
ENDIF |
| 162 |
|
| 163 |
SOURCE[$LIBLEGACY]=prov_running.c |
| 164 |
ENDIF |
| 165 |
|
| 166 |
# Common things that are valid no matter what form the Legacy provider |
| 167 |
# takes. |
| 168 |
SOURCE[$LEGACYGOAL]=legacyprov.c |
| 169 |
INCLUDE[$LEGACYGOAL]=../include implementations/include common/include |
| 170 |
ENDIF |
| 171 |
|
| 172 |
# |
| 173 |
# Null provider stuff |
| 174 |
# |
| 175 |
# Because the null provider is built in, it means that libcrypto must |
| 176 |
# include all the object files that are needed. |
| 177 |
$NULLGOAL=../libcrypto |
| 178 |
SOURCE[$NULLGOAL]=nullprov.c prov_running.c |
| 179 |
|
| 180 |
# template library, not used anywhere. It's merely here to ensure that the object files build |
| 181 |
LIBS{noinst}=libtemplate.a |
| 182 |
INCLUDE[libtemplate.a]=$COMMON_INCLUDES |