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