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