blob: a70fa1a24c09dac58599de210f9612474c5d1461 [file] [log] [blame]
Richard Levitte848af5e2021-05-06 08:48:15 +02001# libcommon.a Contains common building blocks and other routines,
2# potentially needed by any of our providers.
Richard Levittedec95d72019-10-04 01:38:17 +02003#
Richard Levitte848af5e2021-05-06 08:48:15 +02004# 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.
Richard Levittedec95d72019-10-04 01:38:17 +02007#
Richard Levitte848af5e2021-05-06 08:48:15 +02008# 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.
Richard Levittedec95d72019-10-04 01:38:17 +020011#
Richard Levitte848af5e2021-05-06 08:48:15 +020012# libdefault.a Contains all algorithm implementations that should
13# into the default or base provider.
Richard Levittedec95d72019-10-04 01:38:17 +020014#
Richard Levitte848af5e2021-05-06 08:48:15 +020015# 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.
Richard Levittedec95d72019-10-04 01:38:17 +020018#
Richard Levitte848af5e2021-05-06 08:48:15 +020019# This is how a provider module should be linked:
Richard Levitte904f4252020-07-20 09:11:15 +020020#
Richard Levitte848af5e2021-05-06 08:48:15 +020021# -o {modulename}.so {object files...} lib{modulename}.a libcommon.a
Richard Levitte904f4252020-07-20 09:11:15 +020022#
Richard Levitte848af5e2021-05-06 08:48:15 +020023# 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
Richard Levitte904f4252020-07-20 09:11:15 +020029#
Richard Levitte848af5e2021-05-06 08:48:15 +020030# 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.
Richard Levittedec95d72019-10-04 01:38:17 +020033
Richard Levitte600703f2019-10-04 15:37:14 +020034SUBDIRS=common implementations
Matt Caswell9efa0ae2019-03-20 14:27:52 +000035
Matt Caswell16da72a2019-04-19 10:31:18 +010036INCLUDE[../libcrypto]=common/include
37
Richard Levittedec95d72019-10-04 01:38:17 +020038# Libraries we're dealing with
39$LIBCOMMON=libcommon.a
Richard Levittedec95d72019-10-04 01:38:17 +020040$LIBFIPS=libfips.a
Richard Levitte848af5e2021-05-06 08:48:15 +020041$LIBLEGACY=liblegacy.a
42$LIBDEFAULT=libdefault.a
43LIBS{noinst}=$LIBDEFAULT $LIBCOMMON
Richard Levittedec95d72019-10-04 01:38:17 +020044
45# Enough of our implementations include prov/ciphercommon.h (present in
Richard Levittecc731bc2019-12-19 13:33:35 +010046# providers/implementations/include), which includes crypto/*_platform.h
Richard Levittedec95d72019-10-04 01:38:17 +020047# (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.
Richard Levitte68a51d52019-12-03 19:41:05 +010049$COMMON_INCLUDES=../crypto ../include implementations/include common/include
Richard Levittedec95d72019-10-04 01:38:17 +020050
51INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES
Richard Levittedec95d72019-10-04 01:38:17 +020052INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES
Richard Levitte848af5e2021-05-06 08:48:15 +020053INCLUDE[$LIBLEGACY]=.. $COMMON_INCLUDES
54INCLUDE[$LIBDEFAULT]=.. $COMMON_INCLUDES
Richard Levittef844f9e2020-04-13 22:34:56 +020055DEFINE[$LIBFIPS]=FIPS_MODULE
Richard Levittedec95d72019-10-04 01:38:17 +020056
Richard Levitte848af5e2021-05-06 08:48:15 +020057# Weak dependencies to provide library order information. What is actually
58# used is determined by non-weak dependencies.
59DEPEND[$LIBCOMMON]{weak}=../libcrypto
Richard Levittedec95d72019-10-04 01:38:17 +020060
Richard Levitte848af5e2021-05-06 08:48:15 +020061# Strong dependencies. This ensures that any time an implementation library
Richard Levittedec95d72019-10-04 01:38:17 +020062# is used, libcommon gets included as well.
Richard Levitte848af5e2021-05-06 08:48:15 +020063# The $LIBFIPS dependency on $LIBCOMMON is extra strong, to mitigate for
64# linking problems because they are interdependent
65SOURCE[$LIBFIPS]=$LIBCOMMON
66DEPEND[$LIBLEGACY]=$LIBCOMMON
67DEPEND[$LIBDEFAULT]=$LIBCOMMON
Richard Levittedec95d72019-10-04 01:38:17 +020068
69#
70# Default provider stuff
71#
72# Because the default provider is built in, it means that libcrypto must
73# include all the object files that are needed (we do that indirectly,
74# by using the appropriate libraries as source). Note that for shared
Richard Levitte848af5e2021-05-06 08:48:15 +020075# libraries, SOURCEd libraries are considered as if they were specified
Richard Levittedec95d72019-10-04 01:38:17 +020076# with DEPEND.
77$DEFAULTGOAL=../libcrypto
Richard Levitte848af5e2021-05-06 08:48:15 +020078SOURCE[$DEFAULTGOAL]=$LIBDEFAULT defltprov.c
Richard Levitte68a51d52019-12-03 19:41:05 +010079INCLUDE[$DEFAULTGOAL]=implementations/include
Richard Levittedec95d72019-10-04 01:38:17 +020080
Richard Levittedec95d72019-10-04 01:38:17 +020081#
Paulidfc08572020-06-11 09:08:01 +100082# Base provider stuff
83#
Richard Levitte848af5e2021-05-06 08:48:15 +020084# Because the base provider is built in, it means that libcrypto must
85# include all of the object files that are needed, just like the default
86# provider.
Paulidfc08572020-06-11 09:08:01 +100087$BASEGOAL=../libcrypto
Richard Levitte848af5e2021-05-06 08:48:15 +020088SOURCE[$BASEGOAL]=$LIBDEFAULT baseprov.c
Paulidfc08572020-06-11 09:08:01 +100089INCLUDE[$BASEGOAL]=implementations/include
90
91#
Richard Levittedec95d72019-10-04 01:38:17 +020092# FIPS provider stuff
93#
94# We define it this way to ensure that configdata.pm will have all the
95# necessary information even if we don't build the module. This will allow
96# us to make all kinds of checks on the source, based on what we specify in
97# diverse build.info files. libfips.a, fips.so and their sources aren't
98# built unless the proper LIBS or MODULES statement has been seen, so we
99# have those and only those within a condition.
Richard Levittedec95d72019-10-04 01:38:17 +0200100IF[{- !$disabled{fips} -}]
Richard Levitte848af5e2021-05-06 08:48:15 +0200101 SUBDIRS=fips
102 $FIPSGOAL=fips
103
Richard Levittedec95d72019-10-04 01:38:17 +0200104 # This is the trigger to actually build the FIPS module. Without these
105 # statements, the final build file will not have a trace of it.
Richard Levitted3ed8082020-09-29 18:32:34 +0200106 MODULES{fips}=$FIPSGOAL
Richard Levittedec95d72019-10-04 01:38:17 +0200107 LIBS{noinst}=$LIBFIPS
Richard Levitte05869bb2021-02-25 17:46:36 +0100108
Richard Levitte848af5e2021-05-06 08:48:15 +0200109 DEPEND[$FIPSGOAL]=$LIBFIPS
110 INCLUDE[$FIPSGOAL]=../include
111 DEFINE[$FIPSGOAL]=FIPS_MODULE
112 IF[{- defined $target{shared_defflag} -}]
113 SOURCE[$FIPSGOAL]=fips.ld
114 GENERATE[fips.ld]=../util/providers.num
115 ENDIF
116
Richard Levittea2405c52021-05-24 14:06:00 +0200117 DEPEND[|build_modules_nodep|]=fipsmodule.cnf
118 GENERATE[fipsmodule.cnf]=../util/mk-fipsmodule-cnf.pl \
119 -module $(FIPSMODULE) -section_name fips_sect -key $(FIPSKEY)
120 DEPEND[fipsmodule.cnf]=$FIPSGOAL
Richard Levittedec95d72019-10-04 01:38:17 +0200121ENDIF
122
123#
124# Legacy provider stuff
125#
Matt Caswelld0308922019-04-05 10:47:05 +0100126IF[{- !$disabled{legacy} -}]
Richard Levittedec95d72019-10-04 01:38:17 +0200127 LIBS{noinst}=$LIBLEGACY
Richard Levittedec95d72019-10-04 01:38:17 +0200128
Richard Levitte318e0742019-08-19 08:55:53 +0200129 IF[{- $disabled{module} -}]
Richard Levittedec95d72019-10-04 01:38:17 +0200130 # Become built in
131 # In this case, we need to do the same thing a for the default provider,
132 # and make the liblegacy object files end up in libcrypto. We could also
133 # just say that for the built-in legacy, we put the source directly in
134 # libcrypto instead of going via liblegacy, but that makes writing the
135 # implementation specific build.info files harder to write, so we don't.
136 $LEGACYGOAL=../libcrypto
137 SOURCE[$LEGACYGOAL]=$LIBLEGACY
Richard Levittedec95d72019-10-04 01:38:17 +0200138 DEFINE[$LEGACYGOAL]=STATIC_LEGACY
Richard Levitte318e0742019-08-19 08:55:53 +0200139 ELSE
Richard Levittedec95d72019-10-04 01:38:17 +0200140 # Become a module
141 # In this case, we can work with dependencies
142 $LEGACYGOAL=legacy
143 MODULES=$LEGACYGOAL
Richard Levitte848af5e2021-05-06 08:48:15 +0200144 DEPEND[$LEGACYGOAL]=$LIBLEGACY ../libcrypto
Richard Levitte318e0742019-08-19 08:55:53 +0200145 IF[{- defined $target{shared_defflag} -}]
146 SOURCE[legacy]=legacy.ld
147 GENERATE[legacy.ld]=../util/providers.num
148 ENDIF
Richard Levitte848af5e2021-05-06 08:48:15 +0200149 SOURCE[$LIBLEGACY]=prov_running.c
Matt Caswelld0308922019-04-05 10:47:05 +0100150 ENDIF
Richard Levittedec95d72019-10-04 01:38:17 +0200151
152 # Common things that are valid no matter what form the Legacy provider
153 # takes.
Richard Levitte600703f2019-10-04 15:37:14 +0200154 SOURCE[$LEGACYGOAL]=legacyprov.c
Richard Levittefdaad3f2020-05-09 10:11:14 +0200155 INCLUDE[$LEGACYGOAL]=../include implementations/include common/include
Matt Caswelld0308922019-04-05 10:47:05 +0100156ENDIF
Pauli7b4344a2020-04-08 12:02:34 +1000157
158#
159# Null provider stuff
160#
161# Because the null provider is built in, it means that libcrypto must
162# include all the object files that are needed.
163$NULLGOAL=../libcrypto
Paulieab7b422020-09-07 11:58:03 +1000164SOURCE[$NULLGOAL]=nullprov.c prov_running.c