summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl_3.0.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl_3.0.1.bb')
-rw-r--r--meta/recipes-connectivity/openssl/openssl_3.0.1.bb247
1 files changed, 247 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl_3.0.1.bb b/meta/recipes-connectivity/openssl/openssl_3.0.1.bb
new file mode 100644
index 0000000000..162435480c
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl_3.0.1.bb
@@ -0,0 +1,247 @@
1SUMMARY = "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
7LICENSE = "Apache-2.0"
8LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c75985e733726beaba57bc5253e96d04"
9
10SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
11 file://run-ptest \
12 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
13 file://afalg.patch \
14 file://0001-Configure-do-not-tweak-mips-cflags.patch \
15 "
16
17SRC_URI:append:class-nativesdk = " \
18 file://environment.d-openssl.sh \
19 "
20
21SRC_URI[sha256sum] = "c311ad853353bce796edad01a862c50a8a587f62e7e2100ef465ab53ec9b06d1"
22
23inherit lib_package multilib_header multilib_script ptest perlnative
24MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
25
26PACKAGECONFIG ?= ""
27PACKAGECONFIG:class-native = ""
28PACKAGECONFIG:class-nativesdk = ""
29
30PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux,,cryptodev-module"
31PACKAGECONFIG[no-tls1] = "no-tls1"
32PACKAGECONFIG[no-tls1_1] = "no-tls1_1"
33
34B = "${WORKDIR}/build"
35do_configure[cleandirs] = "${B}"
36
37#| ./libcrypto.so: undefined reference to `getcontext'
38#| ./libcrypto.so: undefined reference to `setcontext'
39#| ./libcrypto.so: undefined reference to `makecontext'
40EXTRA_OECONF:append:libc-musl = " no-async"
41EXTRA_OECONF:append:libc-musl:powerpc64 = " no-asm"
42
43# adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions
44# (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
45EXTRA_OECONF:class-native = "--with-rand-seed=os,devrandom"
46EXTRA_OECONF:class-nativesdk = "--with-rand-seed=os,devrandom"
47
48# Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
49CFLAGS:append:class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
50CFLAGS:append:class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
51
52# This allows disabling deprecated or undesirable crypto algorithms.
53# The default is to trust upstream choices.
54DEPRECATED_CRYPTO_FLAGS ?= ""
55
56do_configure () {
57 os=${HOST_OS}
58 case $os in
59 linux-gnueabi |\
60 linux-gnuspe |\
61 linux-musleabi |\
62 linux-muslspe |\
63 linux-musl )
64 os=linux
65 ;;
66 *)
67 ;;
68 esac
69 target="$os-${HOST_ARCH}"
70 case $target in
71 linux-arc)
72 target=linux-latomic
73 ;;
74 linux-arm*)
75 target=linux-armv4
76 ;;
77 linux-aarch64*)
78 target=linux-aarch64
79 ;;
80 linux-i?86 | linux-viac3)
81 target=linux-x86
82 ;;
83 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
84 target=linux-x32
85 ;;
86 linux-gnu64-x86_64)
87 target=linux-x86_64
88 ;;
89 linux-mips | linux-mipsel)
90 # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags
91 target="linux-mips32 ${TARGET_CC_ARCH}"
92 ;;
93 linux-gnun32-mips*)
94 target=linux-mips64
95 ;;
96 linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
97 target=linux64-mips64
98 ;;
99 linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
100 target=linux-generic32
101 ;;
102 linux-powerpc)
103 target=linux-ppc
104 ;;
105 linux-powerpc64)
106 target=linux-ppc64
107 ;;
108 linux-powerpc64le)
109 target=linux-ppc64le
110 ;;
111 linux-riscv32)
112 target=linux-generic32
113 ;;
114 linux-riscv64)
115 target=linux-generic64
116 ;;
117 linux-sparc | linux-supersparc)
118 target=linux-sparcv9
119 ;;
120 mingw32-x86_64)
121 target=mingw64
122 ;;
123 esac
124
125 useprefix=${prefix}
126 if [ "x$useprefix" = "x" ]; then
127 useprefix=/
128 fi
129 # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
130 # environment variables set by bitbake. Adjust the environment variables instead.
131 HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
132 perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --openssldir=${libdir}/ssl-3 --libdir=${libdir} $target
133 perl ${B}/configdata.pm --dump
134}
135
136do_install () {
137 oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install
138
139 oe_multilib_header openssl/opensslconf.h
140 oe_multilib_header openssl/configuration.h
141
142 # Create SSL structure for packages such as ca-certificates which
143 # contain hard-coded paths to /etc/ssl. Debian does the same.
144 install -d ${D}${sysconfdir}/ssl
145 mv ${D}${libdir}/ssl-3/certs \
146 ${D}${libdir}/ssl-3/private \
147 ${D}${libdir}/ssl-3/openssl.cnf \
148 ${D}${sysconfdir}/ssl/
149
150 # Although absolute symlinks would be OK for the target, they become
151 # invalid if native or nativesdk are relocated from sstate.
152 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-3/certs
153 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-3/private
154 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-3/openssl.cnf
155}
156
157do_install:append:class-native () {
158 create_wrapper ${D}${bindir}/openssl \
159 OPENSSL_CONF=${libdir}/ssl-3/openssl.cnf \
160 SSL_CERT_DIR=${libdir}/ssl-3/certs \
161 SSL_CERT_FILE=${libdir}/ssl-3/cert.pem \
162 OPENSSL_ENGINES=${libdir}/engines-3
163}
164
165do_install:append:class-nativesdk () {
166 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
167 install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
168 sed 's|/usr/lib/ssl/|/usr/lib/ssl-3/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
169}
170
171PTEST_BUILD_HOST_FILES += "configdata.pm"
172PTEST_BUILD_HOST_PATTERN = "perl_version ="
173do_install_ptest () {
174 install -d ${D}${PTEST_PATH}/test
175 install -m755 ${B}/test/p_test.so ${D}${PTEST_PATH}/test
176 install -m755 ${B}/test/provider_internal_test.cnf ${D}${PTEST_PATH}/test
177
178 # Prune the build tree
179 rm -f ${B}/fuzz/*.* ${B}/test/*.*
180
181 cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
182 sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm
183 cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH}
184
185 # For test_shlibload
186 ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/
187 ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/
188
189 install -d ${D}${PTEST_PATH}/apps
190 ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
191 install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
192 install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
193
194 install -d ${D}${PTEST_PATH}/engines
195 install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines
196 install -m755 ${B}/engines/loader_attic.so ${D}${PTEST_PATH}/engines
197 install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
198
199 install -d ${D}${PTEST_PATH}/providers
200 install -m755 ${B}/providers/legacy.so ${D}${PTEST_PATH}/providers
201
202 install -d ${D}${PTEST_PATH}/Configurations
203 cp -rf ${S}/Configurations/* ${D}${PTEST_PATH}/Configurations/
204
205 # seems to be needed with perl 5.32.1
206 install -d ${D}${PTEST_PATH}/util/perl/recipes
207 cp ${D}${PTEST_PATH}/test/recipes/tconversion.pl ${D}${PTEST_PATH}/util/perl/recipes/
208
209 sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/util/wrap.pl
210}
211
212# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
213# package RRECOMMENDS on this package. This will enable the configuration
214# file to be installed for both the openssl-bin package and the libcrypto
215# package since the openssl-bin package depends on the libcrypto package.
216
217PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc"
218
219FILES:libcrypto = "${libdir}/libcrypto${SOLIBS}"
220FILES:libssl = "${libdir}/libssl${SOLIBS}"
221FILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf \
222 ${libdir}/ssl-3/openssl.cnf* \
223 "
224FILES:${PN}-engines = "${libdir}/engines-3"
225# ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP)
226FILES:${PN}-engines:append:mingw32:class-nativesdk = " ${prefix}${libdir}/engines-3"
227FILES:${PN}-misc = "${libdir}/ssl-3/misc ${bindir}/c_rehash"
228FILES:${PN} =+ "${libdir}/ssl-3/* ${libdir}/ossl-modules/"
229FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
230
231CONFFILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
232
233RRECOMMENDS:libcrypto += "openssl-conf"
234RDEPENDS:${PN}-misc = "perl"
235RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed"
236
237RDEPENDS:${PN}-bin += "openssl-conf"
238
239BBCLASSEXTEND = "native nativesdk"
240
241CVE_PRODUCT = "openssl:openssl"
242
243CVE_VERSION_SUFFIX = "alphabetical"
244
245# Only affects OpenSSL >= 1.1.1 in combination with Apache < 2.4.37
246# Apache in meta-webserver is already recent enough
247CVE_CHECK_WHITELIST += "CVE-2019-0190"