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