openssl_1.1.1h.bb 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. SUMMARY = "Secure Socket Layer"
  2. DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
  3. HOMEPAGE = "http://www.openssl.org/"
  4. BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
  5. SECTION = "libs/network"
  6. # "openssl" here actually means both OpenSSL and SSLeay licenses apply
  7. # (see meta/files/common-licenses/OpenSSL to which "openssl" is SPDXLICENSEMAPped)
  8. LICENSE = "openssl"
  9. LIC_FILES_CHKSUM = "file://LICENSE;md5=d343e62fc9c833710bbbed25f27364c8"
  10. DEPENDS = "hostperl-runtime-native"
  11. SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
  12. file://run-ptest \
  13. file://0001-skip-test_symbol_presence.patch \
  14. file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
  15. file://afalg.patch \
  16. file://reproducible.patch \
  17. "
  18. SRC_URI_append_class-nativesdk = " \
  19. file://environment.d-openssl.sh \
  20. "
  21. SRC_URI[sha256sum] = "5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9"
  22. inherit lib_package multilib_header multilib_script ptest
  23. MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
  24. PACKAGECONFIG ?= ""
  25. PACKAGECONFIG_class-native = ""
  26. PACKAGECONFIG_class-nativesdk = ""
  27. PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
  28. B = "${WORKDIR}/build"
  29. do_configure[cleandirs] = "${B}"
  30. #| ./libcrypto.so: undefined reference to `getcontext'
  31. #| ./libcrypto.so: undefined reference to `setcontext'
  32. #| ./libcrypto.so: undefined reference to `makecontext'
  33. EXTRA_OECONF_append_libc-musl = " no-async"
  34. EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm"
  35. # adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions
  36. # (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
  37. EXTRA_OECONF_class-native = "--with-rand-seed=os,devrandom"
  38. EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom"
  39. # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
  40. CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
  41. CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
  42. do_configure () {
  43. os=${HOST_OS}
  44. case $os in
  45. linux-gnueabi |\
  46. linux-gnuspe |\
  47. linux-musleabi |\
  48. linux-muslspe |\
  49. linux-musl )
  50. os=linux
  51. ;;
  52. *)
  53. ;;
  54. esac
  55. target="$os-${HOST_ARCH}"
  56. case $target in
  57. linux-arm*)
  58. target=linux-armv4
  59. ;;
  60. linux-aarch64*)
  61. target=linux-aarch64
  62. ;;
  63. linux-i?86 | linux-viac3)
  64. target=linux-x86
  65. ;;
  66. linux-gnux32-x86_64 | linux-muslx32-x86_64 )
  67. target=linux-x32
  68. ;;
  69. linux-gnu64-x86_64)
  70. target=linux-x86_64
  71. ;;
  72. linux-mips | linux-mipsel)
  73. # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags
  74. target="linux-mips32 ${TARGET_CC_ARCH}"
  75. ;;
  76. linux-gnun32-mips*)
  77. target=linux-mips64
  78. ;;
  79. linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
  80. target=linux64-mips64
  81. ;;
  82. linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
  83. target=linux-generic32
  84. ;;
  85. linux-powerpc)
  86. target=linux-ppc
  87. ;;
  88. linux-powerpc64)
  89. target=linux-ppc64
  90. ;;
  91. linux-powerpc64le)
  92. target=linux-ppc64le
  93. ;;
  94. linux-riscv32)
  95. target=linux-generic32
  96. ;;
  97. linux-csky)
  98. target=linux-generic32
  99. ;;
  100. linux-riscv64)
  101. target=linux-generic64
  102. ;;
  103. linux-sparc | linux-supersparc)
  104. target=linux-sparcv9
  105. ;;
  106. esac
  107. useprefix=${prefix}
  108. if [ "x$useprefix" = "x" ]; then
  109. useprefix=/
  110. fi
  111. # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
  112. # environment variables set by bitbake. Adjust the environment variables instead.
  113. HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
  114. perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
  115. perl ${B}/configdata.pm --dump
  116. }
  117. do_install () {
  118. oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install
  119. oe_multilib_header openssl/opensslconf.h
  120. # Create SSL structure for packages such as ca-certificates which
  121. # contain hard-coded paths to /etc/ssl. Debian does the same.
  122. install -d ${D}${sysconfdir}/ssl
  123. mv ${D}${libdir}/ssl-1.1/certs \
  124. ${D}${libdir}/ssl-1.1/private \
  125. ${D}${libdir}/ssl-1.1/openssl.cnf \
  126. ${D}${sysconfdir}/ssl/
  127. # Although absolute symlinks would be OK for the target, they become
  128. # invalid if native or nativesdk are relocated from sstate.
  129. ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-1.1/certs
  130. ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-1.1/private
  131. ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-1.1/openssl.cnf
  132. }
  133. do_install_append_class-native () {
  134. create_wrapper ${D}${bindir}/openssl \
  135. OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \
  136. SSL_CERT_DIR=${libdir}/ssl-1.1/certs \
  137. SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \
  138. OPENSSL_ENGINES=${libdir}/engines-1.1
  139. }
  140. do_install_append_class-nativesdk () {
  141. mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
  142. install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
  143. sed 's|/usr/lib/ssl/|/usr/lib/ssl-1.1/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
  144. }
  145. PTEST_BUILD_HOST_FILES += "configdata.pm"
  146. PTEST_BUILD_HOST_PATTERN = "perl_version ="
  147. do_install_ptest () {
  148. # Prune the build tree
  149. rm -f ${B}/fuzz/*.* ${B}/test/*.*
  150. cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
  151. cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH}
  152. # For test_shlibload
  153. ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/
  154. ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/
  155. install -d ${D}${PTEST_PATH}/apps
  156. ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
  157. install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
  158. install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
  159. install -d ${D}${PTEST_PATH}/engines
  160. install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
  161. }
  162. # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
  163. # package RRECOMMENDS on this package. This will enable the configuration
  164. # file to be installed for both the openssl-bin package and the libcrypto
  165. # package since the openssl-bin package depends on the libcrypto package.
  166. PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc"
  167. FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
  168. FILES_libssl = "${libdir}/libssl${SOLIBS}"
  169. FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf \
  170. ${libdir}/ssl-1.1/openssl.cnf* \
  171. "
  172. FILES_${PN}-engines = "${libdir}/engines-1.1"
  173. FILES_${PN}-misc = "${libdir}/ssl-1.1/misc"
  174. FILES_${PN} =+ "${libdir}/ssl-1.1/*"
  175. FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
  176. CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
  177. RRECOMMENDS_libcrypto += "openssl-conf"
  178. RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash"
  179. RDEPENDS_${PN}-bin += "openssl-conf"
  180. BBCLASSEXTEND = "native nativesdk"
  181. CVE_PRODUCT = "openssl:openssl"
  182. # Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37
  183. # Apache in meta-webserver is already recent enough
  184. CVE_CHECK_WHITELIST += "CVE-2019-0190"