build.info 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. # We place all implementations in static libraries, and then let the
  2. # provider mains pilfer what they want through symbol resolution when
  3. # linking.
  4. #
  5. # The non-legacy implementations (libimplementations) must be made FIPS
  6. # agnostic as much as possible, as well as the common building blocks
  7. # (libcommon). The legacy implementations (liblegacy) will never be
  8. # part of the FIPS provider.
  9. #
  10. # If there is anything that isn't FIPS agnostic, it should be set aside
  11. # in its own source file, which is then included directly into other
  12. # static libraries geared for FIPS and non-FIPS providers, and built
  13. # separately.
  14. #
  15. # libcommon.a Contains common building blocks, potentially
  16. # needed both by non-legacy and legacy code.
  17. #
  18. # libimplementations.a Contains all non-legacy implementations.
  19. # liblegacy.a Contains all legacy implementations.
  20. #
  21. # libfips.a Contains all things needed to support
  22. # FIPS implementations, such as code from
  23. # crypto/ and object files that contain
  24. # FIPS-specific code. FIPS_MODULE is defined
  25. # for this library. The FIPS module uses
  26. # this.
  27. # libnonfips.a Corresponds to libfips.a, but built with
  28. # FIPS_MODULE undefined. The default and legacy
  29. # providers use this.
  30. #
  31. # This is how different provider modules should be linked:
  32. #
  33. # FIPS:
  34. # -o fips.so {object files...} libimplementations.a libcommon.a libfips.a
  35. # Non-FIPS:
  36. # -o module.so {object files...} libimplementations.a libcommon.a libnonfips.a
  37. #
  38. # It is crucial that code that checks for the FIPS_MODULE macro end up in
  39. # libfips.a and libnonfips.a, never in libcommon.a.
  40. # It is crucial that such code is written so libfips.a and libnonfips.a doesn't
  41. # end up depending on libimplementations.a or libcommon.a.
  42. # It is crucial that such code is written so libcommon.a doesn't end up
  43. # depending on libimplementations.a.
  44. #
  45. # Code in providers/implementations/ should be written in such a way that the
  46. # OSSL_DISPATCH arrays (and preferably the majority of the actual code) ends
  47. # up in either libimplementations.a or liblegacy.a.
  48. # If need be, write an abstraction layer in separate source files and make them
  49. # libfips.a / libnonfips.a sources.
  50. SUBDIRS=common implementations
  51. INCLUDE[../libcrypto]=common/include
  52. # Libraries we're dealing with
  53. $LIBCOMMON=libcommon.a
  54. $LIBIMPLEMENTATIONS=libimplementations.a
  55. $LIBLEGACY=liblegacy.a
  56. $LIBNONFIPS=libnonfips.a
  57. $LIBFIPS=libfips.a
  58. # Enough of our implementations include prov/ciphercommon.h (present in
  59. # providers/implementations/include), which includes crypto/*_platform.h
  60. # (present in include), which in turn may include very internal header
  61. # files in crypto/, so let's have a common include list for them all.
  62. $COMMON_INCLUDES=../crypto ../include implementations/include common/include
  63. INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES
  64. INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES
  65. INCLUDE[$LIBLEGACY]=.. $COMMON_INCLUDES
  66. INCLUDE[$LIBNONFIPS]=.. $COMMON_INCLUDES
  67. INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES
  68. DEFINE[$LIBFIPS]=FIPS_MODULE
  69. # Weak dependencies to provide library order information.
  70. # We make it weak so they aren't both used always; what is
  71. # actually used is determined by non-weak dependencies.
  72. DEPEND[$LIBIMPLEMENTATIONS]{weak}=$LIBFIPS $LIBNONFIPS
  73. DEPEND[$LIBCOMMON]{weak}=$LIBFIPS
  74. # Strong dependencies. This ensures that any time libimplementations
  75. # is used, libcommon gets included as well.
  76. DEPEND[$LIBIMPLEMENTATIONS]=$LIBCOMMON
  77. DEPEND[$LIBNONFIPS]=../libcrypto
  78. # It's tempting to make libcommon depend on ../libcrypto. However,
  79. # since the FIPS provider module must NOT depend on ../libcrypto, we
  80. # need to set that dependency up specifically for the final products
  81. # that use $LIBCOMMON or anything that depends on it.
  82. # Libraries common to all providers, must be built regardless
  83. LIBS{noinst}=$LIBCOMMON
  84. # Libraries that are common for all non-FIPS providers, must be built regardless
  85. LIBS{noinst}=$LIBNONFIPS $LIBIMPLEMENTATIONS
  86. #
  87. # Default provider stuff
  88. #
  89. # Because the default provider is built in, it means that libcrypto must
  90. # include all the object files that are needed (we do that indirectly,
  91. # by using the appropriate libraries as source). Note that for shared
  92. # libraries, SOURCEd libraries are considered as if the where specified
  93. # with DEPEND.
  94. $DEFAULTGOAL=../libcrypto
  95. SOURCE[$DEFAULTGOAL]=$LIBIMPLEMENTATIONS $LIBNONFIPS
  96. SOURCE[$DEFAULTGOAL]=defltprov.c
  97. # Some legacy implementations depend on provider header files
  98. INCLUDE[$DEFAULTGOAL]=implementations/include
  99. LIBS=$DEFAULTGOAL
  100. #
  101. # Base provider stuff
  102. #
  103. # Because the base provider is built in, it means that libcrypto
  104. # must include all of the object files that are needed.
  105. $BASEGOAL=../libcrypto
  106. SOURCE[$BASEGOAL]=$LIBIMPLEMENTATIONS $LIBNONFIPS
  107. SOURCE[$BASEGOAL]=baseprov.c
  108. INCLUDE[$BASEGOAL]=implementations/include
  109. #
  110. # FIPS provider stuff
  111. #
  112. # We define it this way to ensure that configdata.pm will have all the
  113. # necessary information even if we don't build the module. This will allow
  114. # us to make all kinds of checks on the source, based on what we specify in
  115. # diverse build.info files. libfips.a, fips.so and their sources aren't
  116. # built unless the proper LIBS or MODULES statement has been seen, so we
  117. # have those and only those within a condition.
  118. SUBDIRS=fips
  119. $FIPSGOAL=fips
  120. DEPEND[$FIPSGOAL]=$LIBIMPLEMENTATIONS $LIBFIPS
  121. INCLUDE[$FIPSGOAL]=../include
  122. DEFINE[$FIPSGOAL]=FIPS_MODULE
  123. IF[{- defined $target{shared_defflag} -}]
  124. SOURCE[$FIPSGOAL]=fips.ld
  125. GENERATE[fips.ld]=../util/providers.num
  126. ENDIF
  127. IF[{- !$disabled{fips} -}]
  128. # This is the trigger to actually build the FIPS module. Without these
  129. # statements, the final build file will not have a trace of it.
  130. MODULES{fips}=$FIPSGOAL
  131. LIBS{noinst}=$LIBFIPS
  132. ENDIF
  133. #
  134. # Legacy provider stuff
  135. #
  136. IF[{- !$disabled{legacy} -}]
  137. # The legacy implementation library
  138. LIBS{noinst}=$LIBLEGACY
  139. DEPEND[$LIBLEGACY]=$LIBCOMMON $LIBNONFIPS
  140. # The Legacy provider
  141. IF[{- $disabled{module} -}]
  142. # Become built in
  143. # In this case, we need to do the same thing a for the default provider,
  144. # and make the liblegacy object files end up in libcrypto. We could also
  145. # just say that for the built-in legacy, we put the source directly in
  146. # libcrypto instead of going via liblegacy, but that makes writing the
  147. # implementation specific build.info files harder to write, so we don't.
  148. $LEGACYGOAL=../libcrypto
  149. SOURCE[$LEGACYGOAL]=$LIBLEGACY
  150. DEFINE[$LIBLEGACY]=STATIC_LEGACY
  151. DEFINE[$LEGACYGOAL]=STATIC_LEGACY
  152. ELSE
  153. # Become a module
  154. # In this case, we can work with dependencies
  155. $LEGACYGOAL=legacy
  156. MODULES=$LEGACYGOAL
  157. DEPEND[$LEGACYGOAL]=$LIBLEGACY
  158. IF[{- defined $target{shared_defflag} -}]
  159. SOURCE[legacy]=legacy.ld
  160. GENERATE[legacy.ld]=../util/providers.num
  161. ENDIF
  162. ENDIF
  163. # Common things that are valid no matter what form the Legacy provider
  164. # takes.
  165. SOURCE[$LEGACYGOAL]=legacyprov.c
  166. INCLUDE[$LEGACYGOAL]=../include implementations/include common/include
  167. ENDIF
  168. #
  169. # Null provider stuff
  170. #
  171. # Because the null provider is built in, it means that libcrypto must
  172. # include all the object files that are needed.
  173. $NULLGOAL=../libcrypto
  174. SOURCE[$NULLGOAL]=nullprov.c prov_running.c
  175. SOURCE[$LIBNONFIPS]=prov_running.c