summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl_3.5.0.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl_3.5.0.bb')
-rw-r--r--meta/recipes-connectivity/openssl/openssl_3.5.0.bb283
1 files changed, 283 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl_3.5.0.bb b/meta/recipes-connectivity/openssl/openssl_3.5.0.bb
new file mode 100644
index 0000000000..0f5c28dafa
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl_3.5.0.bb
@@ -0,0 +1,283 @@
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 file://0001-Added-handshake-history-reporting-when-test-fails.patch \
15 "
16
17SRC_URI:append:class-nativesdk = " \
18 file://environment.d-openssl.sh \
19 "
20
21SRC_URI[sha256sum] = "344d0a79f1a9b08029b0744e2cc401a43f9c90acd1044d09a530b4885a8e9fc0"
22
23inherit lib_package multilib_header multilib_script ptest perlnative manpages
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"
33PACKAGECONFIG[manpages] = ""
34PACKAGECONFIG[fips] = "enable-fips"
35
36B = "${WORKDIR}/build"
37do_configure[cleandirs] = "${B}"
38
39EXTRA_OECONF = "${@bb.utils.contains('PTEST_ENABLED', '1', '', 'no-tests', d)}"
40
41#| ./libcrypto.so: undefined reference to `getcontext'
42#| ./libcrypto.so: undefined reference to `setcontext'
43#| ./libcrypto.so: undefined reference to `makecontext'
44EXTRA_OECONF:append:libc-musl = " no-async"
45EXTRA_OECONF:append:libc-musl:powerpc64 = " no-asm"
46
47# adding devrandom prevents openssl from using getrandom() which is not available on older glibc versions
48# (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
49EXTRA_OECONF:append:class-native = " --with-rand-seed=os,devrandom"
50EXTRA_OECONF:append:class-nativesdk = " --with-rand-seed=os,devrandom"
51
52# Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
53EXTRA_OEMAKE:append:task-compile:class-native = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"'
54EXTRA_OEMAKE:append:task-compile:class-nativesdk = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"'
55
56#| threads_pthread.c:(.text+0x372): undefined reference to `__atomic_is_lock_free'
57EXTRA_OECONF:append:toolchain-clang:x86 = " -latomic"
58
59# This allows disabling deprecated or undesirable crypto algorithms.
60# The default is to trust upstream choices.
61DEPRECATED_CRYPTO_FLAGS ?= ""
62
63do_configure () {
64 # When we upgrade glibc but not uninative we see obtuse failures in openssl. Make
65 # the issue really clear that perl isn't functional due to symbol mismatch issues.
66 cat <<- EOF > ${WORKDIR}/perltest
67 #!/usr/bin/env perl
68 use POSIX;
69 EOF
70 chmod a+x ${WORKDIR}/perltest
71 ${WORKDIR}/perltest
72
73 os=${HOST_OS}
74 case $os in
75 linux-gnueabi |\
76 linux-gnuspe |\
77 linux-musleabi |\
78 linux-muslspe |\
79 linux-musl )
80 os=linux
81 ;;
82 *)
83 ;;
84 esac
85 target="$os-${HOST_ARCH}"
86 case $target in
87 linux-arc | linux-microblaze*)
88 target=linux-latomic
89 ;;
90 linux-arm*)
91 target=linux-armv4
92 ;;
93 linux-aarch64*)
94 target=linux-aarch64
95 ;;
96 linux-i?86 | linux-viac3)
97 target=linux-x86
98 ;;
99 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
100 target=linux-x32
101 ;;
102 linux-gnu64-x86_64)
103 target=linux-x86_64
104 ;;
105 linux-loongarch64)
106 target=linux64-loongarch64
107 ;;
108 linux-mips | linux-mipsel)
109 # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags
110 target="linux-mips32 ${TARGET_CC_ARCH}"
111 ;;
112 linux-gnun32-mips*)
113 target=linux-mips64
114 ;;
115 linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
116 target=linux64-mips64
117 ;;
118 linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
119 target=linux-generic32
120 ;;
121 linux-powerpc)
122 target=linux-ppc
123 ;;
124 linux-powerpc64)
125 target=linux-ppc64
126 ;;
127 linux-powerpc64le)
128 target=linux-ppc64le
129 ;;
130 linux-riscv32)
131 target=linux32-riscv32
132 ;;
133 linux-riscv64)
134 target=linux64-riscv64
135 ;;
136 linux-sparc | linux-supersparc)
137 target=linux-sparcv9
138 ;;
139 mingw32-x86_64)
140 target=mingw64
141 ;;
142 esac
143
144 # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
145 # environment variables set by bitbake. Adjust the environment variables instead.
146 PERLEXTERNAL="$(realpath ${S}/external/perl/Text-Template-*/lib)"
147 test -d "$PERLEXTERNAL" || bberror "PERLEXTERNAL '$PERLEXTERNAL' not found!"
148 HASHBANGPERL="/usr/bin/env perl" PERL=perl PERL5LIB="$PERLEXTERNAL" \
149 perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} ${DEPRECATED_CRYPTO_FLAGS} --prefix=${prefix} --openssldir=${libdir}/ssl-3 --libdir=${baselib} $target
150 perl ${B}/configdata.pm --dump
151}
152
153do_compile:append () {
154 # The test suite binaries are large and we don't need the debugging in them
155 if test -d ${B}/test; then
156 find ${B}/test -type f -executable -exec ${STRIP} {} \;
157 fi
158}
159
160do_install () {
161 oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install_sw install_ssldirs \
162 ${@bb.utils.contains('PACKAGECONFIG', 'manpages', 'install_docs', '', d)} \
163 ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'install_fips', '', d)}
164
165 oe_multilib_header openssl/opensslconf.h
166 oe_multilib_header openssl/configuration.h
167
168 # Create SSL structure for packages such as ca-certificates which
169 # contain hard-coded paths to /etc/ssl. Debian does the same.
170 install -d ${D}${sysconfdir}/ssl
171 mv ${D}${libdir}/ssl-3/certs \
172 ${D}${libdir}/ssl-3/private \
173 ${D}${libdir}/ssl-3/openssl.cnf \
174 ${D}${sysconfdir}/ssl/
175
176 # Although absolute symlinks would be OK for the target, they become
177 # invalid if native or nativesdk are relocated from sstate.
178 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-3/certs
179 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-3/private
180 ln -sf ${@oe.path.relative('${libdir}/ssl-3', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-3/openssl.cnf
181
182 # Generate fipsmodule.cnf in pkg_postinst_ontarget
183 if ${@bb.utils.contains('PACKAGECONFIG', 'fips', 'true', 'false', d)}; then
184 rm -f ${D}${libdir}/ssl-3/fipsmodule.cnf
185 fi
186}
187
188do_install:append:class-native () {
189 create_wrapper ${D}${bindir}/openssl \
190 OPENSSL_CONF=\${OPENSSL_CONF:-${libdir}/ssl-3/openssl.cnf} \
191 SSL_CERT_DIR=\${SSL_CERT_DIR:-${libdir}/ssl-3/certs} \
192 SSL_CERT_FILE=\${SSL_CERT_FILE:-${libdir}/ssl-3/cert.pem} \
193 OPENSSL_ENGINES=\${OPENSSL_ENGINES:-${libdir}/engines-3} \
194 OPENSSL_MODULES=\${OPENSSL_MODULES:-${libdir}/ossl-modules}
195}
196
197do_install:append:class-nativesdk () {
198 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
199 install -m 644 ${UNPACKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
200}
201
202PTEST_BUILD_HOST_FILES += "configdata.pm"
203PTEST_BUILD_HOST_PATTERN = "perl_version ="
204do_install_ptest() {
205 install -m644 ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
206 cp -rf ${S}/Configurations ${S}/external ${D}${PTEST_PATH}/
207
208 install -d ${D}${PTEST_PATH}/apps
209 ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
210
211 cd ${S}
212 find test/certs test/ct test/d2i-tests test/recipes test/ocsp-tests test/ssl-tests test/smime-certs -type f -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
213 find apps test -name \*.cnf -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
214 find apps test -name \*.der -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
215 find apps test -name \*.pem -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
216 find util -name \*.p[lm] -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
217
218 cd ${B}
219 # Everything but .? (.o and .d)
220 find test -type f -name \*[^.]? -exec install -m755 -D {} ${D}${PTEST_PATH}/{} \;
221 find apps test -name \*.cnf -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
222 find apps test -name \*.pem -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
223 find apps test -name \*.srl -exec install -m644 -D {} ${D}${PTEST_PATH}/{} \;
224 install -m755 ${B}/util/*wrap.* ${D}${PTEST_PATH}/util/
225
226 install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps/
227 install -m755 ${S}/test/*.pl ${D}${PTEST_PATH}/test/
228 install -m755 ${S}/test/shibboleth.pfx ${D}${PTEST_PATH}/test/
229 install -m755 ${S}/test/*.bin ${D}${PTEST_PATH}/test/
230 install -m755 ${S}/test/dane*.in ${D}${PTEST_PATH}/test/
231 install -m755 ${S}/test/smcont*.txt ${D}${PTEST_PATH}/test/
232 install -m755 ${S}/test/ssl_test.tmpl ${D}${PTEST_PATH}/test/
233
234 sed 's|${S}|${PTEST_PATH}|g' -i ${D}${PTEST_PATH}/configdata.pm ${D}${PTEST_PATH}/util/wrap.pl
235
236 install -d ${D}${PTEST_PATH}/engines
237 install -m755 ${B}/engines/dasync.so ${D}${PTEST_PATH}/engines/
238 install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines/
239 ln -s ${libdir}/engines-3/loader_attic.so ${D}${PTEST_PATH}/engines/
240 ln -s ${libdir}/ossl-modules/ ${D}${PTEST_PATH}/providers
241}
242
243pkg_postinst_ontarget:${PN}-ossl-module-fips () {
244 if test -f ${libdir}/ossl-modules/fips.so; then
245 ${bindir}/openssl fipsinstall -out ${libdir}/ssl-3/fipsmodule.cnf -module ${libdir}/ossl-modules/fips.so
246 fi
247}
248
249# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
250# package RRECOMMENDS on this package. This will enable the configuration
251# file to be installed for both the openssl-bin package and the libcrypto
252# package since the openssl-bin package depends on the libcrypto package.
253
254PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc ${PN}-ossl-module-legacy ${PN}-ossl-module-fips"
255
256FILES:libcrypto = "${libdir}/libcrypto${SOLIBS}"
257FILES:libssl = "${libdir}/libssl${SOLIBS}"
258FILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf \
259 ${libdir}/ssl-3/openssl.cnf* \
260 "
261FILES:${PN}-engines = "${libdir}/engines-3"
262# ${prefix} comes from what we pass into --prefix at configure time (which is used for INSTALLTOP)
263FILES:${PN}-engines:append:mingw32:class-nativesdk = " ${prefix}${libdir}/engines-3"
264FILES:${PN}-misc = "${libdir}/ssl-3/misc ${bindir}/c_rehash"
265FILES:${PN}-ossl-module-legacy = "${libdir}/ossl-modules/legacy.so"
266FILES:${PN}-ossl-module-fips = "${libdir}/ossl-modules/fips.so"
267FILES:${PN} =+ "${libdir}/ssl-3/* ${libdir}/ossl-modules/"
268FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
269
270CONFFILES:openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
271
272RRECOMMENDS:libcrypto += "openssl-conf ${PN}-ossl-module-legacy"
273RDEPENDS:${PN}-misc = "perl"
274RDEPENDS:${PN}-ptest += "openssl-bin perl perl-modules bash sed openssl-engines openssl-ossl-module-legacy"
275
276RDEPENDS:${PN}-bin += "openssl-conf"
277
278# The test suite is installed stripped
279INSANE_SKIP:${PN} = "already-stripped"
280
281BBCLASSEXTEND = "native nativesdk"
282
283CVE_PRODUCT = "openssl:openssl"