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/
Date: Thu, 30 Jun 2022 19:32:59
Message-Id: 1656617564.e42854131c0978488233a283d90f45000d4f31d6.sam@gentoo
1 commit: e42854131c0978488233a283d90f45000d4f31d6
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 28 18:57:29 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 30 19:32:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4285413
7
8 dev-libs/openssl: add 3.0.4
9
10 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
11 (cherry picked from commit 0b821769c686087817a412b9f6f47ad03603491b)
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 dev-libs/openssl/Manifest | 2 +
15 dev-libs/openssl/openssl-3.0.4.ebuild | 323 ++++++++++++++++++++++++++++++++++
16 2 files changed, 325 insertions(+)
17
18 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
19 index fd4aba44df2c..86edfb8addcb 100644
20 --- a/dev-libs/openssl/Manifest
21 +++ b/dev-libs/openssl/Manifest
22 @@ -13,3 +13,5 @@ DIST openssl-3.0.2.tar.gz.asc 488 BLAKE2B 2f6482114271c4f512159fa159486a3b347063
23 DIST openssl-3.0.3-test-fixes-expiry.patch.xz 29056 BLAKE2B 11be776b9c4baec770d81ff180581d7d8292261f32ebfcb2cfd399d684cef1b9e7b4575d906f23e8a61d853eafb178e1b0e01d9324dbe598c876c0ef74bcf5e8 SHA512 23bc571dfca453deb4f1812aea5fc1bcf1c27358d8638a66ce7f359a698b09a35bdc86e01db36aa5e59b37cc7e36f0ced6f1463b383fb0d904aada69f5d5cb04
24 DIST openssl-3.0.3.tar.gz 15058905 BLAKE2B 8141d13dbea2f1febdd4e46aa404e9f3bac51e1fdc0c9b0df8bf3bf6852e18b09201a2a8cbee99f72e8d6de660834093449b7a14a3fbdda8511286ca3b6743e7 SHA512 949472025211fabdaf2564122f0a9a3baef0facb6373e90cf6c4485164a50898050b179722d0b358c4d8cf1787384ea30d5fd03b98757634631d3e8978509b1a
25 DIST openssl-3.0.3.tar.gz.asc 488 BLAKE2B 3f31e3a73706b69683220e05b1b4ddc75dc3e7e12652dca711e4aa0eb3c023ef736aee9ade15172d7f28e1e1af03e86d4854ec6c3d167cad42882f483c5e56d4 SHA512 04afe65c6af1ae43a9967462383a6a4f567f5acff19ec1952cd6fce2dc3c3d4dfb3cb54126562724c148f40dcb66668abf727282d35730bbf36f82b5c6bacace
26 +DIST openssl-3.0.4.tar.gz 15069605 BLAKE2B e8ef09d74aa128fee0ddc347458a41cde65af07a6e6836889a0230cd7989e46b5d10a4930eb7a63c0cf93485914ec33665d14637b6c27fd442c0e9becb2d2a86 SHA512 478cd801dc4787688e6d9062969ae738c24f869bb186f717ad3be54ae8f2630e5cd845c504efd3405ea1ecda07ebee00014cc6ef7bca9585a6240cf89d516557
27 +DIST openssl-3.0.4.tar.gz.asc 488 BLAKE2B 54f652ae78c6f39aef970fd7372808c876d37a823cc31431d770db67caf11342d1045992e393242d4c73253e4e16640dd9bd56203864394e907976918909e5dc SHA512 c30af3cda92b06cff864ed33c17d8dcb8c7d429ed8419f96d19d3049dfaa268c73ec7753815a134b069ae7f4ea20fb4bcdd04f86d33628592ce4500777494c85
28
29 diff --git a/dev-libs/openssl/openssl-3.0.4.ebuild b/dev-libs/openssl/openssl-3.0.4.ebuild
30 new file mode 100644
31 index 000000000000..ede15424a910
32 --- /dev/null
33 +++ b/dev-libs/openssl/openssl-3.0.4.ebuild
34 @@ -0,0 +1,323 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
41 +inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
42 +
43 +DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
44 +HOMEPAGE="https://www.openssl.org/"
45 +
46 +MY_P=${P/_/-}
47 +
48 +if [[ ${PV} == 9999 ]] ; then
49 + EGIT_REPO_URI="https://github.com/openssl/openssl.git"
50 +
51 + inherit git-r3
52 +else
53 + SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
54 + verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
55 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
56 +fi
57 +
58 +S="${WORKDIR}"/${MY_P}
59 +
60 +LICENSE="Apache-2.0"
61 +SLOT="0/3" # .so version of libssl/libcrypto
62 +IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
63 +RESTRICT="!test? ( test )"
64 +
65 +COMMON_DEPEND="
66 + >=app-misc/c_rehash-1.7-r1
67 + tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
68 +"
69 +BDEPEND="
70 + >=dev-lang/perl-5
71 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
72 + test? (
73 + sys-apps/diffutils
74 + sys-devel/bc
75 + sys-process/procps
76 + )
77 + verify-sig? ( sec-keys/openpgp-keys-openssl )"
78 +
79 +DEPEND="${COMMON_DEPEND}"
80 +RDEPEND="${COMMON_DEPEND}"
81 +PDEPEND="app-misc/ca-certificates"
82 +
83 +REQUIRED_USE="test? ( rfc3779 )"
84 +
85 +MULTILIB_WRAPPED_HEADERS=(
86 + /usr/include/openssl/configuration.h
87 +)
88 +
89 +pkg_setup() {
90 + if use ktls ; then
91 + if kernel_is -lt 4 18 ; then
92 + ewarn "Kernel implementation of TLS (USE=ktls) requires kernel >=4.18!"
93 + else
94 + CONFIG_CHECK="~TLS ~TLS_DEVICE"
95 + ERROR_TLS="You will be unable to offload TLS to kernel because CONFIG_TLS is not set!"
96 + ERROR_TLS_DEVICE="You will be unable to offload TLS to kernel because CONFIG_TLS_DEVICE is not set!"
97 +
98 + linux-info_pkg_setup
99 + fi
100 + fi
101 +
102 + [[ ${MERGE_TYPE} == binary ]] && return
103 +
104 + # must check in pkg_setup; sysctl doesn't work with userpriv!
105 + if use test && use sctp ; then
106 + # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
107 + # if sctp.auth_enable is not enabled.
108 + local sctp_auth_status=$(sysctl -n net.sctp.auth_enable 2>/dev/null)
109 + if [[ -z "${sctp_auth_status}" ]] || [[ ${sctp_auth_status} != 1 ]] ; then
110 + die "FEATURES=test with USE=sctp requires net.sctp.auth_enable=1!"
111 + fi
112 + fi
113 +}
114 +
115 +src_unpack() {
116 + # Can delete this once test fix patch is dropped
117 + if use verify-sig ; then
118 + # Needed for downloaded patch (which is unsigned, which is fine)
119 + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
120 + fi
121 +
122 + default
123 +}
124 +
125 +src_prepare() {
126 + # Allow openssl to be cross-compiled
127 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
128 + chmod a+rx gentoo.config || die
129 +
130 + # Keep this in sync with app-misc/c_rehash
131 + SSL_CNF_DIR="/etc/ssl"
132 +
133 + # Make sure we only ever touch Makefile.org and avoid patching a file
134 + # that gets blown away anyways by the Configure script in src_configure
135 + rm -f Makefile
136 +
137 + if ! use vanilla ; then
138 + PATCHES+=(
139 + # Add patches which are Gentoo-specific customisations here
140 + )
141 + fi
142 +
143 + default
144 +
145 + if use test && use sctp && has network-sandbox ${FEATURES} ; then
146 + einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
147 + rm test/recipes/80-test_ssl_new.t || die
148 + fi
149 +
150 + # - Make sure the man pages are suffixed (bug #302165)
151 + # - Don't bother building man pages if they're disabled
152 + # - Make DOCDIR Gentoo compliant
153 + sed -i \
154 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
155 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
156 + -e $(has noman FEATURES \
157 + && echo '/^install:/s:install_docs::' \
158 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
159 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
160 + Configurations/unix-Makefile.tmpl \
161 + || die
162 +
163 + # Quiet out unknown driver argument warnings since openssl
164 + # doesn't have well-split CFLAGS and we're making it even worse
165 + # and 'make depend' uses -Werror for added fun (bug #417795 again)
166 + tc-is-clang && append-flags -Qunused-arguments
167 +
168 + # We really, really need to build OpenSSL w/ strict aliasing disabled.
169 + # It's filled with violations and it *will* result in miscompiled
170 + # code. This has been in the ebuild for > 10 years but even in 2022,
171 + # it's still relevant:
172 + # - https://github.com/llvm/llvm-project/issues/55255
173 + # - https://github.com/openssl/openssl/issues/18225
174 + # Don't remove the no strict aliasing bits below!
175 + filter-flags -fstrict-aliasing
176 + append-flags -fno-strict-aliasing
177 +
178 + append-flags $(test-flags-CC -Wa,--noexecstack)
179 +
180 + # Prefixify Configure shebang (bug #141906)
181 + sed \
182 + -e "1s,/usr/bin/env,${BROOT}&," \
183 + -i Configure || die
184 +
185 + # Remove test target when FEATURES=test isn't set
186 + if ! use test ; then
187 + sed \
188 + -e '/^$config{dirs}/s@ "test",@@' \
189 + -i Configure || die
190 + fi
191 +
192 + # The config script does stupid stuff to prompt the user. Kill it.
193 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
194 + ./config --test-sanity || die "I AM NOT SANE"
195 +
196 + multilib_copy_sources
197 +}
198 +
199 +multilib_src_configure() {
200 + # bug #197996
201 + unset APPS
202 + # bug #312551
203 + unset SCRIPTS
204 + # bug #311473
205 + unset CROSS_COMPILE
206 +
207 + tc-export AR CC CXX RANLIB RC
208 +
209 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
210 +
211 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
212 +
213 + local sslout=$(./gentoo.config)
214 + einfo "Using configuration: ${sslout:-(openssl knows best)}"
215 + local config="Configure"
216 + [[ -z ${sslout} ]] && config="config"
217 +
218 + # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
219 + local myeconfargs=(
220 + ${sslout}
221 +
222 + $(use cpu_flags_x86_sse2 || echo "no-sse2")
223 + enable-camellia
224 + enable-ec
225 + enable-ec2m
226 + enable-sm2
227 + enable-srp
228 + $(use elibc_musl && echo "no-async")
229 + enable-idea
230 + enable-mdc2
231 + enable-rc5
232 + $(use fips && echo "enable-fips")
233 + $(use_ssl asm)
234 + $(use_ssl ktls)
235 + $(use_ssl rfc3779)
236 + $(use_ssl sctp)
237 + $(use test || echo "no-tests")
238 + $(use_ssl tls-compression zlib)
239 + $(use_ssl weak-ssl-ciphers)
240 +
241 + --prefix="${EPREFIX}"/usr
242 + --openssldir="${EPREFIX}"${SSL_CNF_DIR}
243 + --libdir=$(get_libdir)
244 +
245 + shared
246 + threads
247 + )
248 +
249 + CFLAGS= LDFLAGS= edo ./${config} "${myeconfargs[@]}"
250 +
251 + # Clean out hardcoded flags that openssl uses
252 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
253 + -e 's:^CFLAGS=::' \
254 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
255 + -e 's:\(^\| \)-O[^ ]*::g' \
256 + -e 's:\(^\| \)-march=[^ ]*::g' \
257 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
258 + -e 's:\(^\| \)-m[^ ]*::g' \
259 + -e 's:^ *::' \
260 + -e 's: *$::' \
261 + -e 's: \+: :g' \
262 + -e 's:\\:\\\\:g'
263 + )
264 +
265 + # Now insert clean default flags with user flags
266 + sed -i \
267 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
268 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
269 + Makefile \
270 + || die
271 +}
272 +
273 +multilib_src_compile() {
274 + # depend is needed to use $confopts; it also doesn't matter
275 + # that it's -j1 as the code itself serializes subdirs
276 + emake -j1 depend
277 +
278 + emake all
279 +}
280 +
281 +multilib_src_test() {
282 + # VFP = show subtests verbosely and show failed tests verbosely
283 + # Normal V=1 would show everything verbosely but this slows things down.
284 + emake HARNESS_JOBS="$(makeopts_jobs)" VFP=1 test
285 +}
286 +
287 +multilib_src_install() {
288 + # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
289 + dodir /usr
290 +
291 + emake DESTDIR="${D}" install
292 +
293 + # This is crappy in that the static archives are still built even
294 + # when USE=static-libs. But this is due to a failing in the openssl
295 + # build system: the static archives are built as PIC all the time.
296 + # Only way around this would be to manually configure+compile openssl
297 + # twice; once with shared lib support enabled and once without.
298 + if ! use static-libs ; then
299 + rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
300 + fi
301 +}
302 +
303 +multilib_src_install_all() {
304 + # openssl installs perl version of c_rehash by default, but
305 + # we provide a shell version via app-misc/c_rehash
306 + rm "${ED}"/usr/bin/c_rehash || die
307 +
308 + dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
309 +
310 + # Create the certs directory
311 + keepdir ${SSL_CNF_DIR}/certs
312 +
313 + # Namespace openssl programs to prevent conflicts with other man pages
314 + cd "${ED}"/usr/share/man || die
315 + local m d s
316 + for m in $(find . -type f | xargs grep -L '#include') ; do
317 + d=${m%/*}
318 + d=${d#./}
319 + m=${m##*/}
320 +
321 + [[ ${m} == openssl.1* ]] && continue
322 +
323 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
324 +
325 + mv ${d}/{,ssl-}${m} || die
326 +
327 + # Fix up references to renamed man pages
328 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
329 + ln -s ssl-${m} ${d}/openssl-${m} || die
330 +
331 + # Locate any symlinks that point to this man page
332 + # We assume that any broken links are due to the above renaming
333 + for s in $(find -L ${d} -type l) ; do
334 + s=${s##*/}
335 +
336 + rm -f ${d}/${s}
337 +
338 + # We don't want to "|| die" here
339 + ln -s ssl-${m} ${d}/ssl-${s}
340 + ln -s ssl-${s} ${d}/openssl-${s}
341 + done
342 + done
343 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
344 +
345 + # bug #254521
346 + dodir /etc/sandbox.d
347 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
348 +
349 + diropts -m0700
350 + keepdir ${SSL_CNF_DIR}/private
351 +}
352 +
353 +pkg_postinst() {
354 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
355 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
356 + eend $?
357 +}