Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [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 | # "openssl" here actually means both OpenSSL and SSLeay licenses apply |
| 8 | # (see meta/files/common-licenses/OpenSSL to which "openssl" is SPDXLICENSEMAPped) |
| 9 | LICENSE = "openssl" |
| 10 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d343e62fc9c833710bbbed25f27364c8" |
| 11 | |
| 12 | DEPENDS = "hostperl-runtime-native" |
| 13 | |
| 14 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ |
| 15 | file://run-ptest \ |
| 16 | file://0001-skip-test_symbol_presence.patch \ |
| 17 | file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ |
| 18 | file://afalg.patch \ |
| 19 | file://reproducible.patch \ |
| 20 | " |
| 21 | |
| 22 | SRC_URI_append_class-nativesdk = " \ |
| 23 | file://environment.d-openssl.sh \ |
| 24 | " |
| 25 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 26 | SRC_URI[sha256sum] = "e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 27 | |
| 28 | inherit lib_package multilib_header multilib_script ptest |
| 29 | MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" |
| 30 | |
| 31 | PACKAGECONFIG ?= "" |
| 32 | PACKAGECONFIG_class-native = "" |
| 33 | PACKAGECONFIG_class-nativesdk = "" |
| 34 | |
| 35 | PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 36 | PACKAGECONFIG[no-tls1] = "no-tls1" |
| 37 | PACKAGECONFIG[no-tls1_1] = "no-tls1_1" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 38 | |
| 39 | B = "${WORKDIR}/build" |
| 40 | do_configure[cleandirs] = "${B}" |
| 41 | |
| 42 | #| ./libcrypto.so: undefined reference to `getcontext' |
| 43 | #| ./libcrypto.so: undefined reference to `setcontext' |
| 44 | #| ./libcrypto.so: undefined reference to `makecontext' |
| 45 | EXTRA_OECONF_append_libc-musl = " no-async" |
| 46 | EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm" |
| 47 | |
| 48 | # adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions |
| 49 | # (native versions can be built with newer glibc, but then relocated onto a system with older glibc) |
| 50 | EXTRA_OECONF_class-native = "--with-rand-seed=os,devrandom" |
| 51 | EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" |
| 52 | |
| 53 | # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate. |
| 54 | CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" |
| 55 | CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" |
| 56 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 57 | # Disable deprecated crypto algorithms |
| 58 | # Retained for compatibilty |
| 59 | # des (curl) |
| 60 | # dh (python-ssl) |
| 61 | # dsa (rpm) |
| 62 | # md4 (cyrus-sasl freeradius hostapd) |
| 63 | # bf (wvstreams postgresql x11vnc crda znc cfengine) |
| 64 | # rc4 (freerdp librtorrent ettercap xrdp transmission pam-ssh-agent-auth php) |
| 65 | # rc2 (mailx) |
| 66 | # psk (qt5) |
| 67 | # srp (libest) |
| 68 | # whirlpool (qca) |
| 69 | DEPRECATED_CRYPTO_FLAGS = "no-ssl no-idea no-rc5 no-md2 no-camellia no-mdc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4" |
| 70 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | do_configure () { |
| 72 | os=${HOST_OS} |
| 73 | case $os in |
| 74 | linux-gnueabi |\ |
| 75 | linux-gnuspe |\ |
| 76 | linux-musleabi |\ |
| 77 | linux-muslspe |\ |
| 78 | linux-musl ) |
| 79 | os=linux |
| 80 | ;; |
| 81 | *) |
| 82 | ;; |
| 83 | esac |
| 84 | target="$os-${HOST_ARCH}" |
| 85 | case $target in |
| 86 | linux-arm*) |
| 87 | target=linux-armv4 |
| 88 | ;; |
| 89 | linux-aarch64*) |
| 90 | target=linux-aarch64 |
| 91 | ;; |
| 92 | linux-i?86 | linux-viac3) |
| 93 | target=linux-x86 |
| 94 | ;; |
| 95 | linux-gnux32-x86_64 | linux-muslx32-x86_64 ) |
| 96 | target=linux-x32 |
| 97 | ;; |
| 98 | linux-gnu64-x86_64) |
| 99 | target=linux-x86_64 |
| 100 | ;; |
| 101 | linux-mips | linux-mipsel) |
| 102 | # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags |
| 103 | target="linux-mips32 ${TARGET_CC_ARCH}" |
| 104 | ;; |
| 105 | linux-gnun32-mips*) |
| 106 | target=linux-mips64 |
| 107 | ;; |
| 108 | linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el) |
| 109 | target=linux64-mips64 |
| 110 | ;; |
| 111 | linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*) |
| 112 | target=linux-generic32 |
| 113 | ;; |
| 114 | linux-powerpc) |
| 115 | target=linux-ppc |
| 116 | ;; |
| 117 | linux-powerpc64) |
| 118 | target=linux-ppc64 |
| 119 | ;; |
| 120 | linux-powerpc64le) |
| 121 | target=linux-ppc64le |
| 122 | ;; |
| 123 | linux-riscv32) |
| 124 | target=linux-generic32 |
| 125 | ;; |
| 126 | linux-riscv64) |
| 127 | target=linux-generic64 |
| 128 | ;; |
| 129 | linux-sparc | linux-supersparc) |
| 130 | target=linux-sparcv9 |
| 131 | ;; |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 132 | mingw32-x86_64) |
| 133 | target=mingw64 |
| 134 | ;; |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 135 | esac |
| 136 | |
| 137 | useprefix=${prefix} |
| 138 | if [ "x$useprefix" = "x" ]; then |
| 139 | useprefix=/ |
| 140 | fi |
| 141 | # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the |
| 142 | # environment variables set by bitbake. Adjust the environment variables instead. |
| 143 | HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 144 | perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 145 | perl ${B}/configdata.pm --dump |
| 146 | } |
| 147 | |
| 148 | do_install () { |
| 149 | oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install |
| 150 | |
| 151 | oe_multilib_header openssl/opensslconf.h |
| 152 | |
| 153 | # Create SSL structure for packages such as ca-certificates which |
| 154 | # contain hard-coded paths to /etc/ssl. Debian does the same. |
| 155 | install -d ${D}${sysconfdir}/ssl |
| 156 | mv ${D}${libdir}/ssl-1.1/certs \ |
| 157 | ${D}${libdir}/ssl-1.1/private \ |
| 158 | ${D}${libdir}/ssl-1.1/openssl.cnf \ |
| 159 | ${D}${sysconfdir}/ssl/ |
| 160 | |
| 161 | # Although absolute symlinks would be OK for the target, they become |
| 162 | # invalid if native or nativesdk are relocated from sstate. |
| 163 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-1.1/certs |
| 164 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-1.1/private |
| 165 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-1.1/openssl.cnf |
| 166 | } |
| 167 | |
| 168 | do_install_append_class-native () { |
| 169 | create_wrapper ${D}${bindir}/openssl \ |
| 170 | OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \ |
| 171 | SSL_CERT_DIR=${libdir}/ssl-1.1/certs \ |
| 172 | SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \ |
| 173 | OPENSSL_ENGINES=${libdir}/engines-1.1 |
| 174 | } |
| 175 | |
| 176 | do_install_append_class-nativesdk () { |
| 177 | mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d |
| 178 | install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh |
| 179 | sed 's|/usr/lib/ssl/|/usr/lib/ssl-1.1/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh |
| 180 | } |
| 181 | |
| 182 | PTEST_BUILD_HOST_FILES += "configdata.pm" |
| 183 | PTEST_BUILD_HOST_PATTERN = "perl_version =" |
| 184 | do_install_ptest () { |
| 185 | # Prune the build tree |
| 186 | rm -f ${B}/fuzz/*.* ${B}/test/*.* |
| 187 | |
| 188 | cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH} |
| 189 | cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH} |
| 190 | |
| 191 | # For test_shlibload |
| 192 | ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/ |
| 193 | ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/ |
| 194 | |
| 195 | install -d ${D}${PTEST_PATH}/apps |
| 196 | ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps |
| 197 | install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps |
| 198 | install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps |
| 199 | |
| 200 | install -d ${D}${PTEST_PATH}/engines |
| 201 | install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines |
| 202 | } |
| 203 | |
| 204 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto |
| 205 | # package RRECOMMENDS on this package. This will enable the configuration |
| 206 | # file to be installed for both the openssl-bin package and the libcrypto |
| 207 | # package since the openssl-bin package depends on the libcrypto package. |
| 208 | |
| 209 | PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc" |
| 210 | |
| 211 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" |
| 212 | FILES_libssl = "${libdir}/libssl${SOLIBS}" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 213 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf \ |
| 214 | ${libdir}/ssl-1.1/openssl.cnf* \ |
| 215 | " |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 216 | FILES_${PN}-engines = "${libdir}/engines-1.1" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 217 | # ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP) |
| 218 | FILES_${PN}-engines_append_mingw32_class-nativesdk = " ${prefix}${libdir}/engines-1_1" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 219 | FILES_${PN}-misc = "${libdir}/ssl-1.1/misc ${bindir}/c_rehash" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 220 | FILES_${PN} =+ "${libdir}/ssl-1.1/*" |
| 221 | FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh" |
| 222 | |
| 223 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" |
| 224 | |
| 225 | RRECOMMENDS_libcrypto += "openssl-conf" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 226 | RDEPENDS_${PN}-misc = "perl" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 227 | RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash" |
| 228 | |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 229 | RDEPENDS_${PN}-bin += "openssl-conf" |
| 230 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 231 | BBCLASSEXTEND = "native nativesdk" |
| 232 | |
| 233 | CVE_PRODUCT = "openssl:openssl" |
| 234 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame^] | 235 | CVE_VERSION_SUFFIX = "alphabetical" |
| 236 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 237 | # Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37 |
| 238 | # Apache in meta-webserver is already recent enough |
| 239 | CVE_CHECK_WHITELIST += "CVE-2019-0190" |