Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 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 | |
| 7 | LICENSE = "Apache-2.0" |
| 8 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c75985e733726beaba57bc5253e96d04" |
| 9 | |
| 10 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ |
| 11 | file://run-ptest \ |
| 12 | file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 13 | file://0001-Configure-do-not-tweak-mips-cflags.patch \ |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 14 | file://fix_random_labels.patch \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 15 | " |
| 16 | |
| 17 | SRC_URI:append:class-nativesdk = " \ |
| 18 | file://environment.d-openssl.sh \ |
| 19 | " |
| 20 | |
Andrew Geissler | 220dafd | 2023-10-04 10:18:08 -0500 | [diff] [blame] | 21 | SRC_URI[sha256sum] = "f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 22 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 23 | inherit lib_package multilib_header multilib_script ptest perlnative manpages |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 24 | MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" |
| 25 | |
| 26 | PACKAGECONFIG ?= "" |
| 27 | PACKAGECONFIG:class-native = "" |
| 28 | PACKAGECONFIG:class-nativesdk = "" |
| 29 | |
| 30 | PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module" |
| 31 | PACKAGECONFIG[no-tls1] = "no-tls1" |
| 32 | PACKAGECONFIG[no-tls1_1] = "no-tls1_1" |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 33 | PACKAGECONFIG[manpages] = "" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 34 | |
| 35 | B = "${WORKDIR}/build" |
| 36 | do_configure[cleandirs] = "${B}" |
| 37 | |
| 38 | #| ./libcrypto.so: undefined reference to `getcontext' |
| 39 | #| ./libcrypto.so: undefined reference to `setcontext' |
| 40 | #| ./libcrypto.so: undefined reference to `makecontext' |
| 41 | EXTRA_OECONF:append:libc-musl = " no-async" |
| 42 | EXTRA_OECONF:append:libc-musl:powerpc64 = " no-asm" |
| 43 | |
| 44 | # adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions |
| 45 | # (native versions can be built with newer glibc, but then relocated onto a system with older glibc) |
| 46 | EXTRA_OECONF:class-native = "--with-rand-seed=os,devrandom" |
| 47 | EXTRA_OECONF:class-nativesdk = "--with-rand-seed=os,devrandom" |
| 48 | |
| 49 | # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate. |
| 50 | CFLAGS:append:class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" |
| 51 | CFLAGS:append:class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" |
| 52 | |
| 53 | # This allows disabling deprecated or undesirable crypto algorithms. |
| 54 | # The default is to trust upstream choices. |
| 55 | DEPRECATED_CRYPTO_FLAGS ?= "" |
| 56 | |
| 57 | do_configure () { |
| 58 | # When we upgrade glibc but not uninative we see obtuse failures in openssl. Make |
| 59 | # the issue really clear that perl isn't functional due to symbol mismatch issues. |
| 60 | cat <<- EOF > ${WORKDIR}/perltest |
| 61 | #!/usr/bin/env perl |
| 62 | use POSIX; |
| 63 | EOF |
| 64 | chmod a+x ${WORKDIR}/perltest |
| 65 | ${WORKDIR}/perltest |
| 66 | |
| 67 | os=${HOST_OS} |
| 68 | case $os in |
| 69 | linux-gnueabi |\ |
| 70 | linux-gnuspe |\ |
| 71 | linux-musleabi |\ |
| 72 | linux-muslspe |\ |
| 73 | linux-musl ) |
| 74 | os=linux |
| 75 | ;; |
| 76 | *) |
| 77 | ;; |
| 78 | esac |
| 79 | target="$os-${HOST_ARCH}" |
| 80 | case $target in |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 81 | linux-arc | linux-microblaze*) |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 82 | target=linux-latomic |
| 83 | ;; |
| 84 | linux-arm*) |
| 85 | target=linux-armv4 |
| 86 | ;; |
| 87 | linux-aarch64*) |
| 88 | target=linux-aarch64 |
| 89 | ;; |
| 90 | linux-i?86 | linux-viac3) |
| 91 | target=linux-x86 |
| 92 | ;; |
| 93 | linux-gnux32-x86_64 | linux-muslx32-x86_64 ) |
| 94 | target=linux-x32 |
| 95 | ;; |
| 96 | linux-gnu64-x86_64) |
| 97 | target=linux-x86_64 |
| 98 | ;; |
| 99 | linux-mips | linux-mipsel) |
| 100 | # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags |
| 101 | target="linux-mips32 ${TARGET_CC_ARCH}" |
| 102 | ;; |
| 103 | linux-gnun32-mips*) |
| 104 | target=linux-mips64 |
| 105 | ;; |
| 106 | linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el) |
| 107 | target=linux64-mips64 |
| 108 | ;; |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 109 | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*) |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 110 | target=linux-generic32 |
| 111 | ;; |
| 112 | linux-powerpc) |
| 113 | target=linux-ppc |
| 114 | ;; |
| 115 | linux-powerpc64) |
| 116 | target=linux-ppc64 |
| 117 | ;; |
| 118 | linux-powerpc64le) |
| 119 | target=linux-ppc64le |
| 120 | ;; |
| 121 | linux-riscv32) |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 122 | target=linux-latomic |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 123 | ;; |
| 124 | linux-riscv64) |
| 125 | target=linux-generic64 |
| 126 | ;; |
| 127 | linux-sparc | linux-supersparc) |
| 128 | target=linux-sparcv9 |
| 129 | ;; |
| 130 | mingw32-x86_64) |
| 131 | target=mingw64 |
| 132 | ;; |
| 133 | esac |
| 134 | |
| 135 | useprefix=${prefix} |
| 136 | if [ "x$useprefix" = "x" ]; then |
| 137 | useprefix=/ |
| 138 | fi |
| 139 | # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the |
| 140 | # environment variables set by bitbake. Adjust the environment variables instead. |
Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 141 | PERLEXTERNAL="$(realpath ${S}/external/perl/Text-Template-*/lib)" |
| 142 | test -d "$PERLEXTERNAL" || bberror "PERLEXTERNAL '$PERLEXTERNAL' not found!" |
| 143 | HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="$PERLEXTERNAL" \ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 144 | perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-3 --libdir=${libdir} $target |
| 145 | perl ${B}/configdata.pm --dump |
| 146 | } |
| 147 | |
| 148 | do_install () { |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 149 | oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install_sw install_ssldirs ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'install_docs', '', d)} |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 150 | |
| 151 | oe_multilib_header openssl/opensslconf.h |
| 152 | oe_multilib_header openssl/configuration.h |
| 153 | |
| 154 | # Create SSL structure for packages such as ca-certificates which |
| 155 | # contain hard-coded paths to /etc/ssl. Debian does the same. |
| 156 | install -d ${D}${sysconfdir}/ssl |
| 157 | mv ${D}${libdir}/ssl-3/certs \ |
| 158 | ${D}${libdir}/ssl-3/private \ |
| 159 | ${D}${libdir}/ssl-3/openssl.cnf \ |
| 160 | ${D}${sysconfdir}/ssl/ |
| 161 | |
| 162 | # Although absolute symlinks would be OK for the target, they become |
| 163 | # invalid if native or nativesdk are relocated from sstate. |
| 164 | ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-3/certs |
| 165 | ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-3/private |
| 166 | ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-3/openssl.cnf |
| 167 | } |
| 168 | |
| 169 | do_install:append:class-native () { |
| 170 | create_wrapper ${D}${bindir}/openssl \ |
| 171 | OPENSSL_CONF=${libdir}/ssl-3/openssl.cnf \ |
| 172 | SSL_CERT_DIR=${libdir}/ssl-3/certs \ |
| 173 | SSL_CERT_FILE=${libdir}/ssl-3/cert.pem \ |
| 174 | OPENSSL_ENGINES=${libdir}/engines-3 \ |
| 175 | OPENSSL_MODULES=${libdir}/ossl-modules |
| 176 | } |
| 177 | |
| 178 | do_install:append:class-nativesdk () { |
| 179 | mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d |
| 180 | install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh |
| 181 | sed 's|/usr/lib/ssl/|/usr/lib/ssl-3/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh |
| 182 | } |
| 183 | |
| 184 | PTEST_BUILD_HOST_FILES += "configdata.pm" |
| 185 | PTEST_BUILD_HOST_PATTERN = "perl_version =" |
| 186 | do_install_ptest () { |
| 187 | install -d ${D}${PTEST_PATH}/test |
| 188 | install -m755 ${B}/test/p_test.so ${D}${PTEST_PATH}/test |
| 189 | install -m755 ${B}/test/provider_internal_test.cnf ${D}${PTEST_PATH}/test |
| 190 | |
| 191 | # Prune the build tree |
| 192 | rm -f ${B}/fuzz/*.* ${B}/test/*.* |
| 193 | |
| 194 | cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH} |
| 195 | sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm |
| 196 | cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH} |
| 197 | |
| 198 | # For test_shlibload |
| 199 | ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/ |
| 200 | ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/ |
| 201 | |
| 202 | install -d ${D}${PTEST_PATH}/apps |
| 203 | ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps |
| 204 | install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps |
| 205 | install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps |
| 206 | |
| 207 | install -d ${D}${PTEST_PATH}/engines |
| 208 | install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines |
| 209 | install -m755 ${B}/engines/loader_attic.so ${D}${PTEST_PATH}/engines |
| 210 | install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines |
| 211 | |
| 212 | install -d ${D}${PTEST_PATH}/providers |
| 213 | install -m755 ${B}/providers/legacy.so ${D}${PTEST_PATH}/providers |
| 214 | |
| 215 | install -d ${D}${PTEST_PATH}/Configurations |
| 216 | cp -rf ${S}/Configurations/* ${D}${PTEST_PATH}/Configurations/ |
| 217 | |
| 218 | # seems to be needed with perl 5.32.1 |
| 219 | install -d ${D}${PTEST_PATH}/util/perl/recipes |
| 220 | cp ${D}${PTEST_PATH}/test/recipes/tconversion.pl ${D}${PTEST_PATH}/util/perl/recipes/ |
| 221 | |
| 222 | sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/util/wrap.pl |
| 223 | } |
| 224 | |
| 225 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto |
| 226 | # package RRECOMMENDS on this package. This will enable the configuration |
| 227 | # file to be installed for both the openssl-bin package and the libcrypto |
| 228 | # package since the openssl-bin package depends on the libcrypto package. |
| 229 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 230 | PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc ${PN}-ossl-module-legacy" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 231 | |
| 232 | FILES:libcrypto = "${libdir}/libcrypto${SOLIBS}" |
| 233 | FILES:libssl = "${libdir}/libssl${SOLIBS}" |
| 234 | FILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf \ |
| 235 | ${libdir}/ssl-3/openssl.cnf* \ |
| 236 | " |
| 237 | FILES:${PN}-engines = "${libdir}/engines-3" |
| 238 | # ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP) |
| 239 | FILES:${PN}-engines:append:mingw32:class-nativesdk = " ${prefix}${libdir}/engines-3" |
| 240 | FILES:${PN}-misc = "${libdir}/ssl-3/misc ${bindir}/c_rehash" |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 241 | FILES:${PN}-ossl-module-legacy = "${libdir}/ossl-modules/legacy.so" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 242 | FILES:${PN} =+ "${libdir}/ssl-3/* ${libdir}/ossl-modules/" |
| 243 | FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh" |
| 244 | |
| 245 | CONFFILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf" |
| 246 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 247 | RRECOMMENDS:libcrypto += "openssl-conf ${PN}-ossl-module-legacy" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 248 | RDEPENDS:${PN}-misc = "perl" |
| 249 | RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed" |
| 250 | |
| 251 | RDEPENDS:${PN}-bin += "openssl-conf" |
| 252 | |
| 253 | BBCLASSEXTEND = "native nativesdk" |
| 254 | |
| 255 | CVE_PRODUCT = "openssl:openssl" |
| 256 | |
| 257 | CVE_VERSION_SUFFIX = "alphabetical" |
| 258 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 259 | # Apache in meta-webserver is already recent enough |
Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 260 | CVE_STATUS[CVE-2019-0190] = "not-applicable-config: Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37" |