diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl10_1.0.2u.bb')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl10_1.0.2u.bb | 362 |
1 files changed, 362 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl10_1.0.2u.bb b/meta/recipes-connectivity/openssl/openssl10_1.0.2u.bb new file mode 100644 index 0000000000..c5a00066ba --- /dev/null +++ b/meta/recipes-connectivity/openssl/openssl10_1.0.2u.bb | |||
@@ -0,0 +1,362 @@ | |||
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 | SSLeay" dual license | ||
8 | LICENSE = "openssl" | ||
9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f475368924827d06d4b416111c8bdb77" | ||
10 | |||
11 | DEPENDS = "hostperl-runtime-native" | ||
12 | DEPENDS_append_class-target = " openssl-native" | ||
13 | |||
14 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ | ||
15 | file://run-ptest \ | ||
16 | file://openssl-c_rehash.sh \ | ||
17 | file://configure-targets.patch \ | ||
18 | file://shared-libs.patch \ | ||
19 | file://oe-ldflags.patch \ | ||
20 | file://engines-install-in-libdir-ssl.patch \ | ||
21 | file://debian1.0.2/block_diginotar.patch \ | ||
22 | file://debian1.0.2/block_digicert_malaysia.patch \ | ||
23 | file://debian/c_rehash-compat.patch \ | ||
24 | file://debian/debian-targets.patch \ | ||
25 | file://debian/man-dir.patch \ | ||
26 | file://debian/man-section.patch \ | ||
27 | file://debian/no-rpath.patch \ | ||
28 | file://debian/no-symbolic.patch \ | ||
29 | file://debian/pic.patch \ | ||
30 | file://debian1.0.2/version-script.patch \ | ||
31 | file://debian1.0.2/soname.patch \ | ||
32 | file://openssl_fix_for_x32.patch \ | ||
33 | file://openssl-fix-des.pod-error.patch \ | ||
34 | file://Makefiles-ptest.patch \ | ||
35 | file://ptest-deps.patch \ | ||
36 | file://ptest_makefile_deps.patch \ | ||
37 | file://configure-musl-target.patch \ | ||
38 | file://parallel.patch \ | ||
39 | file://Use-SHA256-not-MD5-as-default-digest.patch \ | ||
40 | file://0001-Fix-build-with-clang-using-external-assembler.patch \ | ||
41 | file://0001-openssl-force-soft-link-to-avoid-rare-race.patch \ | ||
42 | file://0001-allow-manpages-to-be-disabled.patch \ | ||
43 | file://0001-Fix-BN_LLONG-breakage.patch \ | ||
44 | file://0001-Fix-DES_LONG-breakage.patch \ | ||
45 | " | ||
46 | |||
47 | SRC_URI_append_class-target = " \ | ||
48 | file://reproducible-cflags.patch \ | ||
49 | file://reproducible-mkbuildinf.patch \ | ||
50 | " | ||
51 | |||
52 | SRC_URI_append_class-nativesdk = " \ | ||
53 | file://environment.d-openssl.sh \ | ||
54 | " | ||
55 | |||
56 | SRC_URI[md5sum] = "cdc2638f789ecc2db2c91488265686c1" | ||
57 | SRC_URI[sha256sum] = "ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16" | ||
58 | |||
59 | S = "${WORKDIR}/openssl-${PV}" | ||
60 | |||
61 | UPSTREAM_CHECK_REGEX = "openssl-(?P<pver>1\.0.+)\.tar" | ||
62 | |||
63 | CVE_PRODUCT = "openssl:openssl" | ||
64 | |||
65 | inherit pkgconfig siteinfo multilib_header ptest manpages | ||
66 | |||
67 | PACKAGECONFIG ?= "cryptodev-linux" | ||
68 | PACKAGECONFIG_class-native = "" | ||
69 | PACKAGECONFIG_class-nativesdk = "" | ||
70 | |||
71 | PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux" | ||
72 | PACKAGECONFIG[manpages] = ",,," | ||
73 | PACKAGECONFIG[perl] = ",,," | ||
74 | |||
75 | # Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE | ||
76 | # vulnerability | ||
77 | EXTRA_OECONF = "no-ssl3" | ||
78 | |||
79 | EXTRA_OEMAKE = "${@bb.utils.contains('PACKAGECONFIG', 'manpages', '', 'OE_DISABLE_MANPAGES=1', d)}" | ||
80 | |||
81 | export OE_LDFLAGS = "${LDFLAGS}" | ||
82 | |||
83 | TERMIO ?= "-DTERMIO" | ||
84 | TERMIO_libc-musl = "-DTERMIOS" | ||
85 | EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm" | ||
86 | |||
87 | CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ | ||
88 | ${TERMIO} ${CFLAGS} -Wall" | ||
89 | |||
90 | # Avoid binaries being marked as requiring an executable stack since they don't | ||
91 | # (and it causes issues with SELinux) | ||
92 | CFLAG += "-Wa,--noexecstack" | ||
93 | |||
94 | CFLAG_append_class-native = " -fPIC" | ||
95 | |||
96 | do_configure () { | ||
97 | # The crypto_use_bigint patch means that perl's bignum module needs to be | ||
98 | # installed, but some distributions (for example Fedora 23) don't ship it by | ||
99 | # default. As the resulting error is very misleading check for bignum before | ||
100 | # building. | ||
101 | if ! perl -Mbigint -e true; then | ||
102 | bbfatal "The perl module 'bignum' was not found but this is required to build openssl. Please install this module (often packaged as perl-bignum) and re-run bitbake." | ||
103 | fi | ||
104 | |||
105 | ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/ | ||
106 | |||
107 | os=${HOST_OS} | ||
108 | case $os in | ||
109 | linux-gnueabi |\ | ||
110 | linux-gnuspe |\ | ||
111 | linux-musleabi |\ | ||
112 | linux-muslspe |\ | ||
113 | linux-musl ) | ||
114 | os=linux | ||
115 | ;; | ||
116 | *) | ||
117 | ;; | ||
118 | esac | ||
119 | target="$os-${HOST_ARCH}" | ||
120 | case $target in | ||
121 | linux-arm) | ||
122 | target=linux-armv4 | ||
123 | ;; | ||
124 | linux-armeb) | ||
125 | target=linux-elf-armeb | ||
126 | ;; | ||
127 | linux-aarch64*) | ||
128 | target=linux-aarch64 | ||
129 | ;; | ||
130 | linux-sh3) | ||
131 | target=debian-sh3 | ||
132 | ;; | ||
133 | linux-sh4) | ||
134 | target=debian-sh4 | ||
135 | ;; | ||
136 | linux-i486) | ||
137 | target=debian-i386-i486 | ||
138 | ;; | ||
139 | linux-i586 | linux-viac3) | ||
140 | target=debian-i386-i586 | ||
141 | ;; | ||
142 | linux-i686) | ||
143 | target=debian-i386-i686/cmov | ||
144 | ;; | ||
145 | linux-gnux32-x86_64 | linux-muslx32-x86_64 ) | ||
146 | target=linux-x32 | ||
147 | ;; | ||
148 | linux-gnu64-x86_64) | ||
149 | target=linux-x86_64 | ||
150 | ;; | ||
151 | linux-gnun32-mips*el) | ||
152 | target=debian-mipsn32el | ||
153 | ;; | ||
154 | linux-gnun32-mips*) | ||
155 | target=debian-mipsn32 | ||
156 | ;; | ||
157 | linux-mips*64*el) | ||
158 | target=debian-mips64el | ||
159 | ;; | ||
160 | linux-mips*64*) | ||
161 | target=debian-mips64 | ||
162 | ;; | ||
163 | linux-mips*el) | ||
164 | target=debian-mipsel | ||
165 | ;; | ||
166 | linux-mips*) | ||
167 | target=debian-mips | ||
168 | ;; | ||
169 | linux-microblaze* | linux-nios2* | linux-gnu*ilp32** | linux-arc*) | ||
170 | target=linux-generic32 | ||
171 | ;; | ||
172 | linux-powerpc) | ||
173 | target=linux-ppc | ||
174 | ;; | ||
175 | linux-powerpc64) | ||
176 | target=linux-ppc64 | ||
177 | ;; | ||
178 | linux-riscv32) | ||
179 | target=linux-generic32 | ||
180 | ;; | ||
181 | linux-riscv64) | ||
182 | target=linux-generic64 | ||
183 | ;; | ||
184 | linux-sparc | linux-supersparc) | ||
185 | target=linux-sparcv8 | ||
186 | ;; | ||
187 | esac | ||
188 | |||
189 | # inject machine-specific flags | ||
190 | sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure | ||
191 | |||
192 | useprefix=${prefix} | ||
193 | if [ "x$useprefix" = "x" ]; then | ||
194 | useprefix=/ | ||
195 | fi | ||
196 | libdirleaf="$( echo "${libdir}" | sed "s:^$useprefix/*::" )" | ||
197 | perl ./Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=$libdirleaf $target | ||
198 | } | ||
199 | |||
200 | do_compile () { | ||
201 | oe_runmake depend | ||
202 | oe_runmake | ||
203 | } | ||
204 | |||
205 | do_compile_class-target () { | ||
206 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile | ||
207 | oe_runmake depend | ||
208 | cc_sanitized=$(echo "${CC} ${CFLAG}" | sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' -e 's|${DEBUG_PREFIX_MAP}||g' -e 's/[ \t]\+/ /g') | ||
209 | oe_runmake CC_INFO="$cc_sanitized" | ||
210 | } | ||
211 | |||
212 | do_compile_ptest () { | ||
213 | oe_runmake buildtest | ||
214 | } | ||
215 | |||
216 | do_install () { | ||
217 | # Create ${D}/${prefix} to fix parallel issues | ||
218 | mkdir -p ${D}/${prefix}/ | ||
219 | |||
220 | oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install | ||
221 | |||
222 | oe_libinstall -so libcrypto ${D}${libdir} | ||
223 | oe_libinstall -so libssl ${D}${libdir} | ||
224 | |||
225 | install -d ${D}${includedir} | ||
226 | cp --dereference -R include/openssl ${D}${includedir} | ||
227 | |||
228 | oe_multilib_header openssl/opensslconf.h | ||
229 | |||
230 | install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash | ||
231 | sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash | ||
232 | |||
233 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then | ||
234 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl | ||
235 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget | ||
236 | else | ||
237 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget | ||
238 | fi | ||
239 | |||
240 | # Create SSL structure for packages such as ca-certificates which | ||
241 | # contain hard-coded paths to /etc/ssl. Debian does the same. | ||
242 | install -d ${D}${sysconfdir}/ssl | ||
243 | mv ${D}${libdir}/ssl/certs \ | ||
244 | ${D}${libdir}/ssl/private \ | ||
245 | ${D}${libdir}/ssl/openssl.cnf \ | ||
246 | ${D}${sysconfdir}/ssl/ | ||
247 | |||
248 | # Although absolute symlinks would be OK for the target, they become | ||
249 | # invalid if native or nativesdk are relocated from sstate. | ||
250 | ln -sf ${@oe.path.relative('${libdir}/ssl', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl/certs | ||
251 | ln -sf ${@oe.path.relative('${libdir}/ssl', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl/private | ||
252 | ln -sf ${@oe.path.relative('${libdir}/ssl', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl/openssl.cnf | ||
253 | |||
254 | # Rename man pages to prefix openssl10-* | ||
255 | for f in `find ${D}${mandir} -type f`; do | ||
256 | mv $f $(dirname $f)/openssl10-$(basename $f) | ||
257 | done | ||
258 | for f in `find ${D}${mandir} -type l`; do | ||
259 | ln_f=`readlink $f` | ||
260 | rm -f $f | ||
261 | ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f) | ||
262 | done | ||
263 | } | ||
264 | |||
265 | do_install_append_class-native () { | ||
266 | create_wrapper ${D}${bindir}/openssl \ | ||
267 | OPENSSL_CONF=${libdir}/ssl/openssl.cnf \ | ||
268 | SSL_CERT_DIR=${libdir}/ssl/certs \ | ||
269 | SSL_CERT_FILE=${libdir}/ssl/cert.pem \ | ||
270 | OPENSSL_ENGINES=${libdir}/ssl/engines | ||
271 | } | ||
272 | |||
273 | do_install_append_class-nativesdk () { | ||
274 | mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d | ||
275 | install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh | ||
276 | } | ||
277 | |||
278 | do_install_ptest () { | ||
279 | cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH} | ||
280 | |||
281 | # Replace the path to native perl with the path to target perl | ||
282 | sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile | ||
283 | |||
284 | cp Configure config e_os.h ${D}${PTEST_PATH} | ||
285 | cp -r -L include ${D}${PTEST_PATH} | ||
286 | ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH} | ||
287 | ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH} | ||
288 | mkdir -p ${D}${PTEST_PATH}/crypto | ||
289 | cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto | ||
290 | cp -r certs ${D}${PTEST_PATH} | ||
291 | mkdir -p ${D}${PTEST_PATH}/apps | ||
292 | ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps | ||
293 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps | ||
294 | ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps | ||
295 | cp apps/server.pem ${D}${PTEST_PATH}/apps | ||
296 | cp apps/server2.pem ${D}${PTEST_PATH}/apps | ||
297 | mkdir -p ${D}${PTEST_PATH}/util | ||
298 | install util/opensslwrap.sh ${D}${PTEST_PATH}/util | ||
299 | install util/shlib_wrap.sh ${D}${PTEST_PATH}/util | ||
300 | # Time stamps are relevant for "make alltests", otherwise | ||
301 | # make may try to recompile binaries. Not only must the | ||
302 | # binary files be newer than the sources, they also must | ||
303 | # be more recent than the header files in /usr/include. | ||
304 | # | ||
305 | # Using "cp -a" is not sufficient, because do_install | ||
306 | # does not preserve the original time stamps. | ||
307 | # | ||
308 | # So instead of using the original file stamps, we set | ||
309 | # the current time for all files. Binaries will get | ||
310 | # modified again later when stripping them, but that's okay. | ||
311 | touch ${D}${PTEST_PATH} | ||
312 | find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH} | ||
313 | |||
314 | # exclude binary files or the package won't install | ||
315 | for d in ssltest_old v3ext x509aux; do | ||
316 | rm -rf ${D}${libdir}/${BPN}/ptest/test/$d | ||
317 | done | ||
318 | |||
319 | # Remove build host references | ||
320 | sed -i \ | ||
321 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
322 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
323 | ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure | ||
324 | } | ||
325 | |||
326 | # Add the openssl.cnf file to the openssl-conf package. Make the libcrypto | ||
327 | # package RRECOMMENDS on this package. This will enable the configuration | ||
328 | # file to be installed for both the base openssl package and the libcrypto | ||
329 | # package since the base openssl package depends on the libcrypto package. | ||
330 | |||
331 | PACKAGES =+ "libcrypto10 libssl10 openssl10-conf ${PN}-engines ${PN}-misc" | ||
332 | |||
333 | FILES_libcrypto10 = "${libdir}/libcrypto${SOLIBS}" | ||
334 | FILES_libssl10 = "${libdir}/libssl${SOLIBS}" | ||
335 | FILES_openssl10-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
336 | FILES_${PN}-engines = "${libdir}/ssl/engines/*.so ${libdir}/engines" | ||
337 | FILES_${PN}-misc = "${libdir}/ssl/misc" | ||
338 | FILES_${PN} =+ "${libdir}/ssl/*" | ||
339 | FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh" | ||
340 | |||
341 | CONFFILES_openssl10-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
342 | |||
343 | RRECOMMENDS_libcrypto10 += "openssl10-conf" | ||
344 | RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" | ||
345 | RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc" | ||
346 | |||
347 | BBCLASSEXTEND = "native nativesdk" | ||
348 | PACKAGE_PREPROCESS_FUNCS += "openssl_package_preprocess" | ||
349 | |||
350 | # openssl 1.0 development files and executable binaries clash with openssl 1.1 | ||
351 | # files when installed into target rootfs. So we don't put them into | ||
352 | # packages, but they continue to be provided via target sysroot for | ||
353 | # cross-compilation on the host, if some software still depends on openssl 1.0. | ||
354 | openssl_package_preprocess () { | ||
355 | for file in `find ${PKGD} -name *.h -o -name *.pc -o -name *.so`; do | ||
356 | rm $file | ||
357 | done | ||
358 | rm ${PKGD}${bindir}/openssl | ||
359 | rm ${PKGD}${bindir}/c_rehash | ||
360 | rmdir ${PKGD}${bindir} | ||
361 | |||
362 | } | ||