blob: e518cb6a02e168167f2d499cdad4b9914cf52817 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "Secure Socket Layer"
2DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
3HOMEPAGE = "http://www.openssl.org/"
4BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
5SECTION = "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)
9LICENSE = "openssl"
10LIC_FILES_CHKSUM = "file://LICENSE;md5=d343e62fc9c833710bbbed25f27364c8"
11
12DEPENDS = "hostperl-runtime-native"
13
14SRC_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
22SRC_URI_append_class-nativesdk = " \
23 file://environment.d-openssl.sh \
24 "
25
Andrew Geissler95ac1b82021-03-31 14:34:31 -050026SRC_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
31SRC_URI[sha256sum] = "892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5"
Andrew Geissler82c905d2020-04-13 13:39:40 -050032
33inherit lib_package multilib_header multilib_script ptest
34MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
35
36PACKAGECONFIG ?= ""
37PACKAGECONFIG_class-native = ""
38PACKAGECONFIG_class-nativesdk = ""
39
40PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060041PACKAGECONFIG[no-tls1] = "no-tls1"
42PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
Andrew Geissler82c905d2020-04-13 13:39:40 -050043
44B = "${WORKDIR}/build"
45do_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'
50EXTRA_OECONF_append_libc-musl = " no-async"
51EXTRA_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)
55EXTRA_OECONF_class-native = "--with-rand-seed=os,devrandom"
56EXTRA_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.
59CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
60CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
61
Andrew Geisslerd1e89492021-02-12 15:35:20 -060062# 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)
74DEPRECATED_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 Geissler82c905d2020-04-13 13:39:40 -050076do_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 Geisslerd1e89492021-02-12 15:35:20 -0600137 mingw32-x86_64)
138 target=mingw64
139 ;;
Andrew Geissler82c905d2020-04-13 13:39:40 -0500140 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 Geisslerd1e89492021-02-12 15:35:20 -0600149 perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
Andrew Geissler82c905d2020-04-13 13:39:40 -0500150 perl ${B}/configdata.pm --dump
151}
152
153do_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
173do_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
181do_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
187PTEST_BUILD_HOST_FILES += "configdata.pm"
188PTEST_BUILD_HOST_PATTERN = "perl_version ="
189do_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 Geissler90fd73c2021-03-05 15:25:55 -0600207
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 Geissler82c905d2020-04-13 13:39:40 -0500211}
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
218PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc"
219
220FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
221FILES_libssl = "${libdir}/libssl${SOLIBS}"
Andrew Geissler475cb722020-07-10 16:00:51 -0500222FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf \
223 ${libdir}/ssl-1.1/openssl.cnf* \
224 "
Andrew Geissler82c905d2020-04-13 13:39:40 -0500225FILES_${PN}-engines = "${libdir}/engines-1.1"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600226# ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP)
227FILES_${PN}-engines_append_mingw32_class-nativesdk = " ${prefix}${libdir}/engines-1_1"
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600228FILES_${PN}-misc = "${libdir}/ssl-1.1/misc ${bindir}/c_rehash"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500229FILES_${PN} =+ "${libdir}/ssl-1.1/*"
230FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
231
232CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
233
234RRECOMMENDS_libcrypto += "openssl-conf"
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600235RDEPENDS_${PN}-misc = "perl"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500236RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash"
237
Andrew Geisslerb7d28612020-07-24 16:15:54 -0500238RDEPENDS_${PN}-bin += "openssl-conf"
239
Andrew Geissler82c905d2020-04-13 13:39:40 -0500240BBCLASSEXTEND = "native nativesdk"
241
242CVE_PRODUCT = "openssl:openssl"
243
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600244CVE_VERSION_SUFFIX = "alphabetical"
245
Andrew Geissler82c905d2020-04-13 13:39:40 -0500246# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37
247# Apache in meta-webserver is already recent enough
248CVE_CHECK_WHITELIST += "CVE-2019-0190"