diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl_1.1.1w.bb')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl_1.1.1w.bb | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl_1.1.1w.bb b/meta/recipes-connectivity/openssl/openssl_1.1.1w.bb new file mode 100644 index 0000000000..8a53b06862 --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl_1.1.1w.bb | |||
@@ -0,0 +1,221 @@ | |||
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 | file://reproducibility.patch \ | ||
21 | file://0001-Configure-add-2-missing-key-sorts.patch \ | ||
22 | file://0001-Configure-do-not-tweak-mips-cflags.patch \ | ||
23 | " | ||
24 | |||
25 | SRC_URI_append_class-nativesdk = " \ | ||
26 | file://environment.d-openssl.sh \ | ||
27 | " | ||
28 | |||
29 | SRC_URI[sha256sum] = "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8" | ||
30 | |||
31 | inherit lib_package multilib_header multilib_script ptest | ||
32 | MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" | ||
33 | |||
34 | PACKAGECONFIG ?= "" | ||
35 | PACKAGECONFIG_class-native = "" | ||
36 | PACKAGECONFIG_class-nativesdk = "" | ||
37 | |||
38 | PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module" | ||
39 | |||
40 | B = "${WORKDIR}/build" | ||
41 | do_configure[cleandirs] = "${B}" | ||
42 | |||
43 | #| ./libcrypto.so: undefined reference to `getcontext' | ||
44 | #| ./libcrypto.so: undefined reference to `setcontext' | ||
45 | #| ./libcrypto.so: undefined reference to `makecontext' | ||
46 | EXTRA_OECONF_append_libc-musl = " no-async" | ||
47 | EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm" | ||
48 | |||
49 | # adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions | ||
50 | # (native versions can be built with newer glibc, but then relocated onto a system with older glibc) | ||
51 | EXTRA_OECONF_class-native = "--with-rand-seed=os,devrandom" | ||
52 | EXTRA_OECONF_class-nativesdk = "--with-rand-seed=os,devrandom" | ||
53 | |||
54 | # Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate. | ||
55 | CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" | ||
56 | CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin" | ||
57 | |||
58 | do_configure () { | ||
59 | os=${HOST_OS} | ||
60 | case $os in | ||
61 | linux-gnueabi |\ | ||
62 | linux-gnuspe |\ | ||
63 | linux-musleabi |\ | ||
64 | linux-muslspe |\ | ||
65 | linux-musl ) | ||
66 | os=linux | ||
67 | ;; | ||
68 | *) | ||
69 | ;; | ||
70 | esac | ||
71 | target="$os-${HOST_ARCH}" | ||
72 | case $target in | ||
73 | linux-arm*) | ||
74 | target=linux-armv4 | ||
75 | ;; | ||
76 | linux-aarch64*) | ||
77 | target=linux-aarch64 | ||
78 | ;; | ||
79 | linux-i?86 | linux-viac3) | ||
80 | target=linux-x86 | ||
81 | ;; | ||
82 | linux-gnux32-x86_64 | linux-muslx32-x86_64 ) | ||
83 | target=linux-x32 | ||
84 | ;; | ||
85 | linux-gnu64-x86_64) | ||
86 | target=linux-x86_64 | ||
87 | ;; | ||
88 | linux-mips | linux-mipsel) | ||
89 | # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags | ||
90 | target="linux-mips32 ${TARGET_CC_ARCH}" | ||
91 | ;; | ||
92 | linux-gnun32-mips*) | ||
93 | target=linux-mips64 | ||
94 | ;; | ||
95 | linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el) | ||
96 | target=linux64-mips64 | ||
97 | ;; | ||
98 | linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*) | ||
99 | target=linux-generic32 | ||
100 | ;; | ||
101 | linux-powerpc) | ||
102 | target=linux-ppc | ||
103 | ;; | ||
104 | linux-powerpc64) | ||
105 | target=linux-ppc64 | ||
106 | ;; | ||
107 | linux-powerpc64le) | ||
108 | target=linux-ppc64le | ||
109 | ;; | ||
110 | linux-riscv32) | ||
111 | target=linux-generic32 | ||
112 | ;; | ||
113 | linux-riscv64) | ||
114 | target=linux-generic64 | ||
115 | ;; | ||
116 | linux-sparc | linux-supersparc) | ||
117 | target=linux-sparcv9 | ||
118 | ;; | ||
119 | esac | ||
120 | |||
121 | useprefix=${prefix} | ||
122 | if [ "x$useprefix" = "x" ]; then | ||
123 | useprefix=/ | ||
124 | fi | ||
125 | # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the | ||
126 | # environment variables set by bitbake. Adjust the environment variables instead. | ||
127 | HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \ | ||
128 | perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target | ||
129 | perl ${B}/configdata.pm --dump | ||
130 | } | ||
131 | |||
132 | do_install () { | ||
133 | oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install | ||
134 | |||
135 | oe_multilib_header openssl/opensslconf.h | ||
136 | |||
137 | # Create SSL structure for packages such as ca-certificates which | ||
138 | # contain hard-coded paths to /etc/ssl. Debian does the same. | ||
139 | install -d ${D}${sysconfdir}/ssl | ||
140 | mv ${D}${libdir}/ssl-1.1/certs \ | ||
141 | ${D}${libdir}/ssl-1.1/private \ | ||
142 | ${D}${libdir}/ssl-1.1/openssl.cnf \ | ||
143 | ${D}${sysconfdir}/ssl/ | ||
144 | |||
145 | # Although absolute symlinks would be OK for the target, they become | ||
146 | # invalid if native or nativesdk are relocated from sstate. | ||
147 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-1.1/certs | ||
148 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-1.1/private | ||
149 | ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-1.1/openssl.cnf | ||
150 | } | ||
151 | |||
152 | do_install_append_class-native () { | ||
153 | create_wrapper ${D}${bindir}/openssl \ | ||
154 | OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \ | ||
155 | SSL_CERT_DIR=${libdir}/ssl-1.1/certs \ | ||
156 | SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \ | ||
157 | OPENSSL_ENGINES=${libdir}/engines-1.1 | ||
158 | } | ||
159 | |||
160 | do_install_append_class-nativesdk () { | ||
161 | mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d | ||
162 | install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh | ||
163 | sed 's|/usr/lib/ssl/|/usr/lib/ssl-1.1/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh | ||
164 | } | ||
165 | |||
166 | PTEST_BUILD_HOST_FILES += "configdata.pm" | ||
167 | PTEST_BUILD_HOST_PATTERN = "perl_version =" | ||
168 | do_install_ptest () { | ||
169 | # Prune the build tree | ||
170 | rm -f ${B}/fuzz/*.* ${B}/test/*.* | ||
171 | |||
172 | cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH} | ||
173 | cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH} | ||
174 | |||
175 | # For test_shlibload | ||
176 | ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/ | ||
177 | ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/ | ||
178 | |||
179 | install -d ${D}${PTEST_PATH}/apps | ||
180 | ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps | ||
181 | install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps | ||
182 | install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps | ||
183 | |||
184 | install -d ${D}${PTEST_PATH}/engines | ||
185 | install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines | ||
186 | install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines | ||
187 | } | ||
188 | |||
189 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto | ||
190 | # package RRECOMMENDS on this package. This will enable the configuration | ||
191 | # file to be installed for both the openssl-bin package and the libcrypto | ||
192 | # package since the openssl-bin package depends on the libcrypto package. | ||
193 | |||
194 | PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc" | ||
195 | |||
196 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" | ||
197 | FILES_libssl = "${libdir}/libssl${SOLIBS}" | ||
198 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf \ | ||
199 | ${libdir}/ssl-1.1/openssl.cnf* \ | ||
200 | " | ||
201 | FILES_${PN}-engines = "${libdir}/engines-1.1" | ||
202 | FILES_${PN}-misc = "${libdir}/ssl-1.1/misc" | ||
203 | FILES_${PN} =+ "${libdir}/ssl-1.1/*" | ||
204 | FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh" | ||
205 | |||
206 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
207 | |||
208 | RRECOMMENDS_libcrypto += "openssl-conf" | ||
209 | RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash" | ||
210 | |||
211 | RDEPENDS_${PN}-bin += "openssl-conf" | ||
212 | |||
213 | BBCLASSEXTEND = "native nativesdk" | ||
214 | |||
215 | CVE_PRODUCT = "openssl:openssl" | ||
216 | |||
217 | CVE_VERSION_SUFFIX = "alphabetical" | ||
218 | |||
219 | # Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37 | ||
220 | # Apache in meta-webserver is already recent enough | ||
221 | CVE_CHECK_WHITELIST += "CVE-2019-0190" | ||