Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/files/, dev-libs/openssl/
Date: Tue, 14 Mar 2023 19:49:00
Message-Id: 1678823312.568c16c5c05f87f999b04925544cd1ee344319c1.sam@gentoo
1 commit: 568c16c5c05f87f999b04925544cd1ee344319c1
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 14 19:38:22 2023 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 14 19:48:32 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=568c16c5
7
8 dev-libs/openssl: drop 3.0.7-r1, 3.0.7-r4
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-libs/openssl/Manifest | 2 -
13 .../files/openssl-3.0.7-x509-CVE-2022-3996.patch | 35 ---
14 dev-libs/openssl/openssl-3.0.7-r1.ebuild | 338 ---------------------
15 dev-libs/openssl/openssl-3.0.7-r4.ebuild | 264 ----------------
16 4 files changed, 639 deletions(-)
17
18 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
19 index 31e236b00955..f45d7d6c5109 100644
20 --- a/dev-libs/openssl/Manifest
21 +++ b/dev-libs/openssl/Manifest
22 @@ -5,7 +5,5 @@ DIST openssl-1.1.1s.tar.gz 9868981 BLAKE2B ecd19eaf84dbc80448b51651abe52a89cc005
23 DIST openssl-1.1.1s.tar.gz.asc 858 BLAKE2B d95f0f80d460feac737f84ed629c45aaf5e453103ef202ec7d33cf33b89ad83a9007429433b10754b725d7963b1960e350b64e8bdfe569ad149e26bef462eeca SHA512 aa6e5e940448297a90c46ba162f8e6ee324c2e202a9283328c31f996dc2259dd9f5f981d94d1cf1dd3cc73c44647b473602dacb857b9719bf066931b43b899e6
24 DIST openssl-1.1.1t.tar.gz 9881866 BLAKE2B 66d76ea0c05a4afc3104e22602cffc2373e857728625d31ab3244881cafa91c099a817a09def7746bce4133585bfc90b769f43527e77a81ed13e60a8c2fb4d8d SHA512 628676c9c3bc1cf46083d64f61943079f97f0eefd0264042e40a85dbbd988f271bfe01cd1135d22cc3f67a298f1d078041f8f2e97b0da0d93fe172da573da18c
25 DIST openssl-1.1.1t.tar.gz.asc 833 BLAKE2B fc5e7069268e987a20241dfc4f080529c6e95e217c198568b09c833e390e68b25a604a5d3ec29c6a64b9dee9d42199fd3647214e536ba2f7b8b4e57aa4cba680 SHA512 1232a94fce991d62f008ae6d3d9b6fe68cb6378fe07450feb17a58eb2417fb385ffcb7e6b74eb683134be9ff6ccf6efa183f37f4dd521614fd5aeaddf000b90b
26 -DIST openssl-3.0.7.tar.gz 15107575 BLAKE2B 141881071fa62f056c514e7c653a61c59cc45fe951ec094041e23fb5e619133b7ebbfe31cd8203969c9d8842b8cbc10ec58da67cc181761a11c1cfdd0869df9a SHA512 6c2bcd1cd4b499e074e006150dda906980df505679d8e9d988ae93aa61ee6f8c23c0fa369e2edc1e1a743d7bec133044af11d5ed57633b631ae479feb59e3424
27 -DIST openssl-3.0.7.tar.gz.asc 858 BLAKE2B bd07a6f656cce817038743caf1131ef8d7a21bf587e706e32771ad9e09cb4821d21b71171a7fe7bb6bece95e9b06cea6d723aae9de8b62049b5a8316578500be SHA512 9093a8a5a990f5f37bd95e7ca55f2371e59242be408ea7d9403bcfc9c8873c022237e13c0ec81881a20607ea46927887a895a82b6f50c6f423b4c54f9ef0cde1
28 DIST openssl-3.0.8.tar.gz 15151328 BLAKE2B e163cc9b8b458f72405a2f1bde3811c8d0eb22e8b08ff5608ec64799975f1546dcdce31466b8a1d5ed29bc90d19aa6017d711987c81b71f4b20e279828cf753a SHA512 8ce10be000d7d4092c8efc5b96b1d2f7da04c1c3a624d3a7923899c6b1de06f369016be957e36e8ab6d4c9102eaeec5d1973295d547f7893a7f11f132ae42b0d
29 DIST openssl-3.0.8.tar.gz.asc 833 BLAKE2B 1949801150e254e9be648f33014a4a16f803b42ca5a302c3942d377013e983e0ea0cca8aed594e3f9ecde26c6e31d222581e991af5fae6cd451d7ee83541f4bb SHA512 e1c04f1179aded228b39005fd9e9f6f75aedafb938b77ac58c97a00973eb412d93b92ad1c447332a5d96850b62b01093502928e6c190bdd0234a94c4e815d2a6
30
31 diff --git a/dev-libs/openssl/files/openssl-3.0.7-x509-CVE-2022-3996.patch b/dev-libs/openssl/files/openssl-3.0.7-x509-CVE-2022-3996.patch
32 deleted file mode 100644
33 index 079a4f508ccb..000000000000
34 --- a/dev-libs/openssl/files/openssl-3.0.7-x509-CVE-2022-3996.patch
35 +++ /dev/null
36 @@ -1,35 +0,0 @@
37 -https://bugs.gentoo.org/885797
38 -
39 -https://github.com/openssl/openssl/commit/7725e7bfe6f2ce8146b6552b44e0d226be7638e7
40 -https://github.com/openssl/openssl/issues/19643
41 -
42 -From 7725e7bfe6f2ce8146b6552b44e0d226be7638e7 Mon Sep 17 00:00:00 2001
43 -From: Pauli <pauli@×××××××.org>
44 -Date: Fri, 11 Nov 2022 09:40:19 +1100
45 -Subject: [PATCH] x509: fix double locking problem
46 -
47 -This reverts commit 9aa4be691f5c73eb3c68606d824c104550c053f7 and removed the
48 -redundant flag setting.
49 -
50 -Fixes #19643
51 -
52 -Fixes LOW CVE-2022-3996
53 -
54 -Reviewed-by: Dmitry Belyavskiy <beldmit@×××××.com>
55 -Reviewed-by: Tomas Mraz <tomas@×××××××.org>
56 -(Merged from https://github.com/openssl/openssl/pull/19652)
57 -
58 -(cherry picked from commit 4d0340a6d2f327700a059f0b8f954d6160f8eef5)
59 ---- a/crypto/x509/pcy_map.c
60 -+++ b/crypto/x509/pcy_map.c
61 -@@ -73,10 +73,6 @@ int ossl_policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps)
62 -
63 - ret = 1;
64 - bad_mapping:
65 -- if (ret == -1 && CRYPTO_THREAD_write_lock(x->lock)) {
66 -- x->ex_flags |= EXFLAG_INVALID_POLICY;
67 -- CRYPTO_THREAD_unlock(x->lock);
68 -- }
69 - sk_POLICY_MAPPING_pop_free(maps, POLICY_MAPPING_free);
70 - return ret;
71 -
72
73 diff --git a/dev-libs/openssl/openssl-3.0.7-r1.ebuild b/dev-libs/openssl/openssl-3.0.7-r1.ebuild
74 deleted file mode 100644
75 index a1bcc6a59545..000000000000
76 --- a/dev-libs/openssl/openssl-3.0.7-r1.ebuild
77 +++ /dev/null
78 @@ -1,338 +0,0 @@
79 -# Copyright 1999-2023 Gentoo Authors
80 -# Distributed under the terms of the GNU General Public License v2
81 -
82 -EAPI=8
83 -
84 -VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
85 -inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
86 -
87 -DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
88 -HOMEPAGE="https://www.openssl.org/"
89 -
90 -MY_P=${P/_/-}
91 -
92 -if [[ ${PV} == 9999 ]] ; then
93 - EGIT_REPO_URI="https://github.com/openssl/openssl.git"
94 -
95 - inherit git-r3
96 -else
97 - SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
98 - verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
99 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
100 -fi
101 -
102 -S="${WORKDIR}"/${MY_P}
103 -
104 -LICENSE="Apache-2.0"
105 -SLOT="0/3" # .so version of libssl/libcrypto
106 -IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
107 -RESTRICT="!test? ( test )"
108 -
109 -COMMON_DEPEND="
110 - >=app-misc/c_rehash-1.7-r1
111 - tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
112 -"
113 -BDEPEND="
114 - >=dev-lang/perl-5
115 - sctp? ( >=net-misc/lksctp-tools-1.0.12 )
116 - test? (
117 - sys-apps/diffutils
118 - sys-devel/bc
119 - sys-process/procps
120 - )
121 - verify-sig? ( >=sec-keys/openpgp-keys-openssl-20230207 )"
122 -
123 -DEPEND="${COMMON_DEPEND}"
124 -RDEPEND="${COMMON_DEPEND}"
125 -PDEPEND="app-misc/ca-certificates"
126 -
127 -MULTILIB_WRAPPED_HEADERS=(
128 - /usr/include/openssl/configuration.h
129 -)
130 -
131 -PATCHES=(
132 - "${FILESDIR}"/${P}-x509-CVE-2022-3996.patch
133 -)
134 -
135 -pkg_setup() {
136 - if use ktls ; then
137 - if kernel_is -lt 4 18 ; then
138 - ewarn "Kernel implementation of TLS (USE=ktls) requires kernel >=4.18!"
139 - else
140 - CONFIG_CHECK="~TLS ~TLS_DEVICE"
141 - ERROR_TLS="You will be unable to offload TLS to kernel because CONFIG_TLS is not set!"
142 - ERROR_TLS_DEVICE="You will be unable to offload TLS to kernel because CONFIG_TLS_DEVICE is not set!"
143 -
144 - linux-info_pkg_setup
145 - fi
146 - fi
147 -
148 - [[ ${MERGE_TYPE} == binary ]] && return
149 -
150 - # must check in pkg_setup; sysctl doesn't work with userpriv!
151 - if use test && use sctp ; then
152 - # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
153 - # if sctp.auth_enable is not enabled.
154 - local sctp_auth_status=$(sysctl -n net.sctp.auth_enable 2>/dev/null)
155 - if [[ -z "${sctp_auth_status}" ]] || [[ ${sctp_auth_status} != 1 ]] ; then
156 - die "FEATURES=test with USE=sctp requires net.sctp.auth_enable=1!"
157 - fi
158 - fi
159 -}
160 -
161 -src_unpack() {
162 - # Can delete this once test fix patch is dropped
163 - if use verify-sig ; then
164 - # Needed for downloaded patch (which is unsigned, which is fine)
165 - verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
166 - fi
167 -
168 - default
169 -}
170 -
171 -src_prepare() {
172 - # Allow openssl to be cross-compiled
173 - cp "${FILESDIR}"/gentoo.config-1.0.3 gentoo.config || die
174 - chmod a+rx gentoo.config || die
175 -
176 - # Keep this in sync with app-misc/c_rehash
177 - SSL_CNF_DIR="/etc/ssl"
178 -
179 - # Make sure we only ever touch Makefile.org and avoid patching a file
180 - # that gets blown away anyways by the Configure script in src_configure
181 - rm -f Makefile
182 -
183 - if ! use vanilla ; then
184 - PATCHES+=(
185 - # Add patches which are Gentoo-specific customisations here
186 - )
187 - fi
188 -
189 - default
190 -
191 - if use test && use sctp && has network-sandbox ${FEATURES} ; then
192 - einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
193 - rm test/recipes/80-test_ssl_new.t || die
194 - fi
195 -
196 - # - Make sure the man pages are suffixed (bug #302165)
197 - # - Don't bother building man pages if they're disabled
198 - # - Make DOCDIR Gentoo compliant
199 - sed -i \
200 - -e '/^MANSUFFIX/s:=.*:=ssl:' \
201 - -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
202 - -e $(has noman FEATURES \
203 - && echo '/^install:/s:install_docs::' \
204 - || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
205 - -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
206 - Configurations/unix-Makefile.tmpl \
207 - || die
208 -
209 - # Quiet out unknown driver argument warnings since openssl
210 - # doesn't have well-split CFLAGS and we're making it even worse
211 - # and 'make depend' uses -Werror for added fun (bug #417795 again)
212 - tc-is-clang && append-flags -Qunused-arguments
213 -
214 - # We really, really need to build OpenSSL w/ strict aliasing disabled.
215 - # It's filled with violations and it *will* result in miscompiled
216 - # code. This has been in the ebuild for > 10 years but even in 2022,
217 - # it's still relevant:
218 - # - https://github.com/llvm/llvm-project/issues/55255
219 - # - https://github.com/openssl/openssl/issues/18225
220 - # - https://github.com/openssl/openssl/issues/18663#issuecomment-1181478057
221 - # Don't remove the no strict aliasing bits below!
222 - filter-flags -fstrict-aliasing
223 - append-flags -fno-strict-aliasing
224 -
225 - append-flags $(test-flags-CC -Wa,--noexecstack)
226 -
227 - # Prefixify Configure shebang (bug #141906)
228 - sed \
229 - -e "1s,/usr/bin/env,${BROOT}&," \
230 - -i Configure || die
231 -
232 - # Remove test target when FEATURES=test isn't set
233 - if ! use test ; then
234 - sed \
235 - -e '/^$config{dirs}/s@ "test",@@' \
236 - -i Configure || die
237 - fi
238 -
239 - # The config script does stupid stuff to prompt the user. Kill it.
240 - sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
241 - ./config --test-sanity || die "I AM NOT SANE"
242 -
243 - multilib_copy_sources
244 -}
245 -
246 -multilib_src_configure() {
247 - # bug #197996
248 - unset APPS
249 - # bug #312551
250 - unset SCRIPTS
251 - # bug #311473
252 - unset CROSS_COMPILE
253 -
254 - tc-export AR CC CXX RANLIB RC
255 -
256 - use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
257 -
258 - local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
259 -
260 - # See if our toolchain supports __uint128_t. If so, it's 64bit
261 - # friendly and can use the nicely optimized code paths, bug #460790.
262 - #local ec_nistp_64_gcc_128
263 - #
264 - # Disable it for now though (bug #469976)
265 - # Do NOT re-enable without substantial discussion first!
266 - #
267 - #echo "__uint128_t i;" > "${T}"/128.c
268 - #if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
269 - # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
270 - #fi
271 -
272 - local sslout=$(./gentoo.config)
273 - einfo "Using configuration: ${sslout:-(openssl knows best)}"
274 - local config="Configure"
275 - [[ -z ${sslout} ]] && config="config"
276 -
277 - # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
278 - local myeconfargs=(
279 - ${sslout}
280 -
281 - $(use cpu_flags_x86_sse2 || echo "no-sse2")
282 - enable-camellia
283 - enable-ec
284 - enable-ec2m
285 - enable-sm2
286 - enable-srp
287 - $(use elibc_musl && echo "no-async")
288 - enable-idea
289 - enable-mdc2
290 - enable-rc5
291 - $(use fips && echo "enable-fips")
292 - $(use_ssl asm)
293 - $(use_ssl ktls)
294 - $(use_ssl rfc3779)
295 - $(use_ssl sctp)
296 - $(use test || echo "no-tests")
297 - $(use_ssl tls-compression zlib)
298 - $(use_ssl weak-ssl-ciphers)
299 -
300 - --prefix="${EPREFIX}"/usr
301 - --openssldir="${EPREFIX}"${SSL_CNF_DIR}
302 - --libdir=$(get_libdir)
303 -
304 - shared
305 - threads
306 - )
307 -
308 - CFLAGS= LDFLAGS= edo ./${config} "${myeconfargs[@]}"
309 -
310 - # Clean out hardcoded flags that openssl uses
311 - local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
312 - -e 's:^CFLAGS=::' \
313 - -e 's:\(^\| \)-fomit-frame-pointer::g' \
314 - -e 's:\(^\| \)-O[^ ]*::g' \
315 - -e 's:\(^\| \)-march=[^ ]*::g' \
316 - -e 's:\(^\| \)-mcpu=[^ ]*::g' \
317 - -e 's:\(^\| \)-m[^ ]*::g' \
318 - -e 's:^ *::' \
319 - -e 's: *$::' \
320 - -e 's: \+: :g' \
321 - -e 's:\\:\\\\:g'
322 - )
323 -
324 - # Now insert clean default flags with user flags
325 - sed -i \
326 - -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
327 - -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
328 - Makefile \
329 - || die
330 -}
331 -
332 -multilib_src_compile() {
333 - # depend is needed to use $confopts; it also doesn't matter
334 - # that it's -j1 as the code itself serializes subdirs
335 - emake -j1 depend
336 -
337 - emake all
338 -}
339 -
340 -multilib_src_test() {
341 - # VFP = show subtests verbosely and show failed tests verbosely
342 - # Normal V=1 would show everything verbosely but this slows things down.
343 - emake HARNESS_JOBS="$(makeopts_jobs)" VFP=1 test
344 -}
345 -
346 -multilib_src_install() {
347 - # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
348 - dodir /usr
349 -
350 - emake DESTDIR="${D}" install
351 -
352 - # This is crappy in that the static archives are still built even
353 - # when USE=static-libs. But this is due to a failing in the openssl
354 - # build system: the static archives are built as PIC all the time.
355 - # Only way around this would be to manually configure+compile openssl
356 - # twice; once with shared lib support enabled and once without.
357 - if ! use static-libs ; then
358 - rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
359 - fi
360 -}
361 -
362 -multilib_src_install_all() {
363 - # openssl installs perl version of c_rehash by default, but
364 - # we provide a shell version via app-misc/c_rehash
365 - rm "${ED}"/usr/bin/c_rehash || die
366 -
367 - dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
368 -
369 - # Create the certs directory
370 - keepdir ${SSL_CNF_DIR}/certs
371 -
372 - # Namespace openssl programs to prevent conflicts with other man pages
373 - cd "${ED}"/usr/share/man || die
374 - local m d s
375 - for m in $(find . -type f | xargs grep -L '#include') ; do
376 - d=${m%/*}
377 - d=${d#./}
378 - m=${m##*/}
379 -
380 - [[ ${m} == openssl.1* ]] && continue
381 -
382 - [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
383 -
384 - mv ${d}/{,ssl-}${m} || die
385 -
386 - # Fix up references to renamed man pages
387 - sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
388 - ln -s ssl-${m} ${d}/openssl-${m} || die
389 -
390 - # Locate any symlinks that point to this man page
391 - # We assume that any broken links are due to the above renaming
392 - for s in $(find -L ${d} -type l) ; do
393 - s=${s##*/}
394 -
395 - rm -f ${d}/${s}
396 -
397 - # We don't want to "|| die" here
398 - ln -s ssl-${m} ${d}/ssl-${s}
399 - ln -s ssl-${s} ${d}/openssl-${s}
400 - done
401 - done
402 - [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
403 -
404 - # bug #254521
405 - dodir /etc/sandbox.d
406 - echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
407 -
408 - diropts -m0700
409 - keepdir ${SSL_CNF_DIR}/private
410 -}
411 -
412 -pkg_postinst() {
413 - ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
414 - c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
415 - eend $?
416 -}
417
418 diff --git a/dev-libs/openssl/openssl-3.0.7-r4.ebuild b/dev-libs/openssl/openssl-3.0.7-r4.ebuild
419 deleted file mode 100644
420 index 54d8d66651f8..000000000000
421 --- a/dev-libs/openssl/openssl-3.0.7-r4.ebuild
422 +++ /dev/null
423 @@ -1,264 +0,0 @@
424 -# Copyright 1999-2023 Gentoo Authors
425 -# Distributed under the terms of the GNU General Public License v2
426 -
427 -EAPI=8
428 -
429 -VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
430 -inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
431 -
432 -DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
433 -HOMEPAGE="https://www.openssl.org/"
434 -
435 -MY_P=${P/_/-}
436 -
437 -if [[ ${PV} == 9999 ]] ; then
438 - EGIT_REPO_URI="https://github.com/openssl/openssl.git"
439 -
440 - inherit git-r3
441 -else
442 - SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
443 - verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
444 - #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
445 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
446 -fi
447 -
448 -S="${WORKDIR}"/${MY_P}
449 -
450 -LICENSE="Apache-2.0"
451 -SLOT="0/3" # .so version of libssl/libcrypto
452 -IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
453 -RESTRICT="!test? ( test )"
454 -
455 -COMMON_DEPEND="
456 - tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
457 -"
458 -BDEPEND="
459 - >=dev-lang/perl-5
460 - sctp? ( >=net-misc/lksctp-tools-1.0.12 )
461 - test? (
462 - sys-apps/diffutils
463 - sys-devel/bc
464 - sys-process/procps
465 - )
466 - verify-sig? ( >=sec-keys/openpgp-keys-openssl-20230207 )"
467 -
468 -DEPEND="${COMMON_DEPEND}"
469 -RDEPEND="${COMMON_DEPEND}"
470 -PDEPEND="app-misc/ca-certificates"
471 -
472 -MULTILIB_WRAPPED_HEADERS=(
473 - /usr/include/openssl/configuration.h
474 -)
475 -
476 -PATCHES=(
477 - "${FILESDIR}"/${P}-x509-CVE-2022-3996.patch
478 -)
479 -
480 -pkg_setup() {
481 - if use ktls ; then
482 - if kernel_is -lt 4 18 ; then
483 - ewarn "Kernel implementation of TLS (USE=ktls) requires kernel >=4.18!"
484 - else
485 - CONFIG_CHECK="~TLS ~TLS_DEVICE"
486 - ERROR_TLS="You will be unable to offload TLS to kernel because CONFIG_TLS is not set!"
487 - ERROR_TLS_DEVICE="You will be unable to offload TLS to kernel because CONFIG_TLS_DEVICE is not set!"
488 - use test && CONFIG_CHECK+=" ~CRYPTO_USER_API_SKCIPHER"
489 -
490 - linux-info_pkg_setup
491 - fi
492 - fi
493 -
494 - [[ ${MERGE_TYPE} == binary ]] && return
495 -
496 - # must check in pkg_setup; sysctl doesn't work with userpriv!
497 - if use test && use sctp ; then
498 - # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
499 - # if sctp.auth_enable is not enabled.
500 - local sctp_auth_status=$(sysctl -n net.sctp.auth_enable 2>/dev/null)
501 - if [[ -z "${sctp_auth_status}" ]] || [[ ${sctp_auth_status} != 1 ]] ; then
502 - die "FEATURES=test with USE=sctp requires net.sctp.auth_enable=1!"
503 - fi
504 - fi
505 -}
506 -
507 -src_unpack() {
508 - # Can delete this once test fix patch is dropped
509 - if use verify-sig ; then
510 - # Needed for downloaded patch (which is unsigned, which is fine)
511 - verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
512 - fi
513 -
514 - default
515 -}
516 -
517 -src_prepare() {
518 - # Allow openssl to be cross-compiled
519 - cp "${FILESDIR}"/gentoo.config-1.0.4 gentoo.config || die
520 - chmod a+rx gentoo.config || die
521 -
522 - # Keep this in sync with app-misc/c_rehash
523 - SSL_CNF_DIR="/etc/ssl"
524 -
525 - # Make sure we only ever touch Makefile.org and avoid patching a file
526 - # that gets blown away anyways by the Configure script in src_configure
527 - rm -f Makefile
528 -
529 - if ! use vanilla ; then
530 - PATCHES+=(
531 - # Add patches which are Gentoo-specific customisations here
532 - )
533 - fi
534 -
535 - default
536 -
537 - if use test && use sctp && has network-sandbox ${FEATURES} ; then
538 - einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
539 - rm test/recipes/80-test_ssl_new.t || die
540 - fi
541 -
542 - # Quiet out unknown driver argument warnings since openssl
543 - # doesn't have well-split CFLAGS and we're making it even worse
544 - # and 'make depend' uses -Werror for added fun (bug #417795 again)
545 - tc-is-clang && append-flags -Qunused-arguments
546 -
547 - # We really, really need to build OpenSSL w/ strict aliasing disabled.
548 - # It's filled with violations and it *will* result in miscompiled
549 - # code. This has been in the ebuild for > 10 years but even in 2022,
550 - # it's still relevant:
551 - # - https://github.com/llvm/llvm-project/issues/55255
552 - # - https://github.com/openssl/openssl/issues/18225
553 - # - https://github.com/openssl/openssl/issues/18663#issuecomment-1181478057
554 - # Don't remove the no strict aliasing bits below!
555 - filter-flags -fstrict-aliasing
556 - append-flags -fno-strict-aliasing
557 -
558 - append-flags $(test-flags-CC -Wa,--noexecstack)
559 -
560 - local sslout=$(./gentoo.config)
561 - einfo "Using configuration: ${sslout:-(openssl knows best)}"
562 - edo perl Configure ${sslout} --test-sanity
563 -
564 - multilib_copy_sources
565 -}
566 -
567 -multilib_src_configure() {
568 - # bug #197996
569 - unset APPS
570 - # bug #312551
571 - unset SCRIPTS
572 - # bug #311473
573 - unset CROSS_COMPILE
574 -
575 - tc-export AR CC CXX RANLIB RC
576 -
577 - use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
578 -
579 - local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
580 -
581 - # See if our toolchain supports __uint128_t. If so, it's 64bit
582 - # friendly and can use the nicely optimized code paths, bug #460790.
583 - #local ec_nistp_64_gcc_128
584 - #
585 - # Disable it for now though (bug #469976)
586 - # Do NOT re-enable without substantial discussion first!
587 - #
588 - #echo "__uint128_t i;" > "${T}"/128.c
589 - #if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
590 - # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
591 - #fi
592 -
593 - local sslout=$(./gentoo.config)
594 - einfo "Using configuration: ${sslout:-(openssl knows best)}"
595 -
596 - # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
597 - local myeconfargs=(
598 - ${sslout}
599 -
600 - $(use cpu_flags_x86_sse2 || echo "no-sse2")
601 - enable-camellia
602 - enable-ec
603 - enable-ec2m
604 - enable-sm2
605 - enable-srp
606 - $(use elibc_musl && echo "no-async")
607 - enable-idea
608 - enable-mdc2
609 - enable-rc5
610 - $(use fips && echo "enable-fips")
611 - $(use_ssl asm)
612 - $(use_ssl ktls)
613 - $(use_ssl rfc3779)
614 - $(use_ssl sctp)
615 - $(use test || echo "no-tests")
616 - $(use_ssl tls-compression zlib)
617 - $(use_ssl weak-ssl-ciphers)
618 -
619 - --prefix="${EPREFIX}"/usr
620 - --openssldir="${EPREFIX}"${SSL_CNF_DIR}
621 - --libdir=$(get_libdir)
622 -
623 - shared
624 - threads
625 - )
626 -
627 - edo perl Configure "${myeconfargs[@]}"
628 -}
629 -
630 -multilib_src_compile() {
631 - emake build_sw
632 -
633 - if multilib_is_native_abi; then
634 - emake build_docs
635 - fi
636 -}
637 -
638 -multilib_src_test() {
639 - # VFP = show subtests verbosely and show failed tests verbosely
640 - # Normal V=1 would show everything verbosely but this slows things down.
641 - emake HARNESS_JOBS="$(makeopts_jobs)" VFP=1 test
642 -}
643 -
644 -multilib_src_install() {
645 - emake DESTDIR="${D}" install_sw
646 - if use fips; then
647 - emake DESTDIR="${D}" install_fips
648 - fi
649 -
650 - if multilib_is_native_abi; then
651 - emake DESTDIR="${D}" install_ssldirs
652 - emake DESTDIR="${D}" DOCDIR='$(INSTALLTOP)'/share/doc/${PF} install_docs
653 - fi
654 -
655 - # This is crappy in that the static archives are still built even
656 - # when USE=static-libs. But this is due to a failing in the openssl
657 - # build system: the static archives are built as PIC all the time.
658 - # Only way around this would be to manually configure+compile openssl
659 - # twice; once with shared lib support enabled and once without.
660 - if ! use static-libs ; then
661 - rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
662 - fi
663 -}
664 -
665 -multilib_src_install_all() {
666 - # openssl installs perl version of c_rehash by default, but
667 - # we provide a shell version via app-misc/c_rehash
668 - rm "${ED}"/usr/bin/c_rehash || die
669 -
670 - dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
671 -
672 - # Create the certs directory
673 - keepdir ${SSL_CNF_DIR}/certs
674 -
675 - # bug #254521
676 - dodir /etc/sandbox.d
677 - echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
678 -
679 - diropts -m0700
680 - keepdir ${SSL_CNF_DIR}/private
681 -}
682 -
683 -pkg_postinst() {
684 - ebegin "Running 'openssl rehash ${EROOT}${SSL_CNF_DIR}/certs' to rebuild hashes (bug #333069)"
685 - openssl rehash "${EROOT}${SSL_CNF_DIR}/certs"
686 - eend $?
687 -}