Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 1 | # libcommon.a Contains common building blocks and other routines, |
| 2 | # potentially needed by any of our providers. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 3 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 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. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 7 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 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. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 11 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 12 | # libdefault.a Contains all algorithm implementations that should |
| 13 | # into the default or base provider. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 14 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 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. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 18 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 19 | # This is how a provider module should be linked: |
Richard Levitte | 904f425 | 2020-07-20 09:11:15 +0200 | [diff] [blame] | 20 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 21 | # -o {modulename}.so {object files...} lib{modulename}.a libcommon.a |
Richard Levitte | 904f425 | 2020-07-20 09:11:15 +0200 | [diff] [blame] | 22 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 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 |
Richard Levitte | 904f425 | 2020-07-20 09:11:15 +0200 | [diff] [blame] | 29 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 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. |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 33 | |
Richard Levitte | 600703f | 2019-10-04 15:37:14 +0200 | [diff] [blame] | 34 | SUBDIRS=common implementations |
Matt Caswell | 9efa0ae | 2019-03-20 14:27:52 +0000 | [diff] [blame] | 35 | |
Matt Caswell | 16da72a | 2019-04-19 10:31:18 +0100 | [diff] [blame] | 36 | INCLUDE[../libcrypto]=common/include |
| 37 | |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 38 | # Libraries we're dealing with |
| 39 | $LIBCOMMON=libcommon.a |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 40 | $LIBFIPS=libfips.a |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 41 | $LIBLEGACY=liblegacy.a |
| 42 | $LIBDEFAULT=libdefault.a |
| 43 | LIBS{noinst}=$LIBDEFAULT $LIBCOMMON |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 44 | |
| 45 | # Enough of our implementations include prov/ciphercommon.h (present in |
Richard Levitte | cc731bc | 2019-12-19 13:33:35 +0100 | [diff] [blame] | 46 | # providers/implementations/include), which includes crypto/*_platform.h |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 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. |
Richard Levitte | 68a51d5 | 2019-12-03 19:41:05 +0100 | [diff] [blame] | 49 | $COMMON_INCLUDES=../crypto ../include implementations/include common/include |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 50 | |
| 51 | INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 52 | INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 53 | INCLUDE[$LIBLEGACY]=.. $COMMON_INCLUDES |
| 54 | INCLUDE[$LIBDEFAULT]=.. $COMMON_INCLUDES |
Richard Levitte | f844f9e | 2020-04-13 22:34:56 +0200 | [diff] [blame] | 55 | DEFINE[$LIBFIPS]=FIPS_MODULE |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 56 | |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 57 | # Weak dependencies to provide library order information. What is actually |
| 58 | # used is determined by non-weak dependencies. |
| 59 | DEPEND[$LIBCOMMON]{weak}=../libcrypto |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 60 | |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 61 | # Strong dependencies. This ensures that any time an implementation library |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 62 | # is used, libcommon gets included as well. |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 63 | # The $LIBFIPS dependency on $LIBCOMMON is extra strong, to mitigate for |
| 64 | # linking problems because they are interdependent |
| 65 | SOURCE[$LIBFIPS]=$LIBCOMMON |
| 66 | DEPEND[$LIBLEGACY]=$LIBCOMMON |
| 67 | DEPEND[$LIBDEFAULT]=$LIBCOMMON |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 68 | |
| 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 Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 75 | # libraries, SOURCEd libraries are considered as if they were specified |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 76 | # with DEPEND. |
| 77 | $DEFAULTGOAL=../libcrypto |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 78 | SOURCE[$DEFAULTGOAL]=$LIBDEFAULT defltprov.c |
Richard Levitte | 68a51d5 | 2019-12-03 19:41:05 +0100 | [diff] [blame] | 79 | INCLUDE[$DEFAULTGOAL]=implementations/include |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 80 | |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 81 | # |
Pauli | dfc0857 | 2020-06-11 09:08:01 +1000 | [diff] [blame] | 82 | # Base provider stuff |
| 83 | # |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 84 | # 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. |
Pauli | dfc0857 | 2020-06-11 09:08:01 +1000 | [diff] [blame] | 87 | $BASEGOAL=../libcrypto |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 88 | SOURCE[$BASEGOAL]=$LIBDEFAULT baseprov.c |
Pauli | dfc0857 | 2020-06-11 09:08:01 +1000 | [diff] [blame] | 89 | INCLUDE[$BASEGOAL]=implementations/include |
| 90 | |
| 91 | # |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 92 | # 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 Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 100 | IF[{- !$disabled{fips} -}] |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 101 | SUBDIRS=fips |
| 102 | $FIPSGOAL=fips |
| 103 | |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 104 | # 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 Levitte | d3ed808 | 2020-09-29 18:32:34 +0200 | [diff] [blame] | 106 | MODULES{fips}=$FIPSGOAL |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 107 | LIBS{noinst}=$LIBFIPS |
Richard Levitte | 05869bb | 2021-02-25 17:46:36 +0100 | [diff] [blame] | 108 | |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 109 | 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 Levitte | a2405c5 | 2021-05-24 14:06:00 +0200 | [diff] [blame] | 117 | 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 Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 121 | ENDIF |
| 122 | |
| 123 | # |
| 124 | # Legacy provider stuff |
| 125 | # |
Matt Caswell | d030892 | 2019-04-05 10:47:05 +0100 | [diff] [blame] | 126 | IF[{- !$disabled{legacy} -}] |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 127 | LIBS{noinst}=$LIBLEGACY |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 128 | |
Richard Levitte | 318e074 | 2019-08-19 08:55:53 +0200 | [diff] [blame] | 129 | IF[{- $disabled{module} -}] |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 130 | # 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 Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 138 | DEFINE[$LEGACYGOAL]=STATIC_LEGACY |
Richard Levitte | 318e074 | 2019-08-19 08:55:53 +0200 | [diff] [blame] | 139 | ELSE |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 140 | # Become a module |
| 141 | # In this case, we can work with dependencies |
| 142 | $LEGACYGOAL=legacy |
| 143 | MODULES=$LEGACYGOAL |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 144 | DEPEND[$LEGACYGOAL]=$LIBLEGACY ../libcrypto |
Richard Levitte | 318e074 | 2019-08-19 08:55:53 +0200 | [diff] [blame] | 145 | IF[{- defined $target{shared_defflag} -}] |
| 146 | SOURCE[legacy]=legacy.ld |
| 147 | GENERATE[legacy.ld]=../util/providers.num |
| 148 | ENDIF |
Richard Levitte | 848af5e | 2021-05-06 08:48:15 +0200 | [diff] [blame] | 149 | SOURCE[$LIBLEGACY]=prov_running.c |
Matt Caswell | d030892 | 2019-04-05 10:47:05 +0100 | [diff] [blame] | 150 | ENDIF |
Richard Levitte | dec95d7 | 2019-10-04 01:38:17 +0200 | [diff] [blame] | 151 | |
| 152 | # Common things that are valid no matter what form the Legacy provider |
| 153 | # takes. |
Richard Levitte | 600703f | 2019-10-04 15:37:14 +0200 | [diff] [blame] | 154 | SOURCE[$LEGACYGOAL]=legacyprov.c |
Richard Levitte | fdaad3f | 2020-05-09 10:11:14 +0200 | [diff] [blame] | 155 | INCLUDE[$LEGACYGOAL]=../include implementations/include common/include |
Matt Caswell | d030892 | 2019-04-05 10:47:05 +0100 | [diff] [blame] | 156 | ENDIF |
Pauli | 7b4344a | 2020-04-08 12:02:34 +1000 | [diff] [blame] | 157 | |
| 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 |
Pauli | eab7b42 | 2020-09-07 11:58:03 +1000 | [diff] [blame] | 164 | SOURCE[$NULLGOAL]=nullprov.c prov_running.c |