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, 05 Jul 2022 23:33:41
Message-Id: 1657063983.1f171e1acbd185d7cd5c5a2689f50d02c7c64caf.sam@gentoo
1 commit: 1f171e1acbd185d7cd5c5a2689f50d02c7c64caf
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 5 23:33:03 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 5 23:33:03 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f171e1a
7
8 dev-libs/openssl: add 1.1.1q
9
10 Bug: https://bugs.gentoo.org/856592
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 dev-libs/openssl/Manifest | 2 +
14 .../openssl/files/openssl-3.0.5-test-memcmp.patch | 2 +
15 dev-libs/openssl/openssl-1.1.1q.ebuild | 337 +++++++++++++++++++++
16 3 files changed, 341 insertions(+)
17
18 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
19 index d85b9ffd72e4..f960853b8a8a 100644
20 --- a/dev-libs/openssl/Manifest
21 +++ b/dev-libs/openssl/Manifest
22 @@ -8,6 +8,8 @@ DIST openssl-1.1.1o.tar.gz 9856386 BLAKE2B 5bd355fd17adf43ba4e3bf1a8036ceb724edd
23 DIST openssl-1.1.1o.tar.gz.asc 488 BLAKE2B a03a967e7e2124d1a76ad7765e2f48065f40d32ba102a433be603ee8f86b26a2d246dcb97a95bd694ef3005889ce4f1951f76d39fe1d683f92da1aa3023e9c2d SHA512 da6d88de7c1cd807b6089d50f8bb102c317c0b45ca26e517e3e400c5c65f787d94a1ee522af76279e93790a7fb491348cf25ffcfd66ecb9a9d35209328cb221e
24 DIST openssl-1.1.1p.tar.gz 9860217 BLAKE2B 4354753a5e52393c9cc4569954c2cac6d89a1e204fa4f9ca00a60492782d29f8952fb92664cdbb3576c6443d3cb2eacebea51db584738589f3598b40df579b12 SHA512 203470b1cd37bdbfabfec5ef37fc97c991d9943f070c988316f6396b09dae7cea16ac884bd8646dbf7dd1ed40ebde6bdfa5700beee2d714d07c97cc70b4e48d9
25 DIST openssl-1.1.1p.tar.gz.asc 488 BLAKE2B e68c8a4c992c2448b48428137f61f91fb89e4814f6e80c5525cea695bcf898326eca729f31b953fbd7ff51b448004101ca78abfbd3138ec2389596faa3eafc2f SHA512 c85d65df1ed0f1ae87b799d794ea43e32c8ecaf85caf6e36fbbd4a890ef1d47710380d3846296e0124898680be66113a959ad974e0448bc00d1253794dc48972
26 +DIST openssl-1.1.1q.tar.gz 9864061 BLAKE2B fc8fd6a62dc291d0bda328a051e253175fb04442cc4b8f45d67c3a5027748a0fc5fb372d0483bc9024ae0bff119c4fac8f1e982a182612427696d6d09f5935f5 SHA512 cb9f184ec4974a3423ef59c8ec86b6bf523d5b887da2087ae58c217249da3246896fdd6966ee9c13aea9e6306783365239197e9f742c508a0e35e5744e3e085f
27 +DIST openssl-1.1.1q.tar.gz.asc 833 BLAKE2B 9311abf47469c3802a84dc9b7427a168ba7717496960e6f84b04e4d9263dea1168493082937a06bcb6ef4169b2ed9b2f36084bbac15b5f7ca5b4c41041c4bab6 SHA512 03a41f29d1713c47bb300e01e36dbd048074076a6a3b9913e2fc9a1b56b726c038978f99e86f9a3e4ea39f72bd82a15965842f6d94210fa9d3474f6f0f68559e
28 DIST openssl-3.0.2.tar.gz 15038141 BLAKE2B 140c4c80a0cad89cb0059fef6a4cd421460e6af9a3973f7a3eb5e39f64c0d44794d46e7a869e5235fced139f2249351e37a9ee5ebaa17f2708d63141ebebf919 SHA512 f986850d5be908b4d6b5fd7091bc4652d7378c9bccebfbc5becd7753843c04c1eb61a1749c432139d263dfac33df0b1f6c773664b485cad47542266823a4eb03
29 DIST openssl-3.0.2.tar.gz.asc 488 BLAKE2B 2f6482114271c4f512159fa159486a3b3470637d770cd1614fda004918d06ed9ab562e655d1580d2ebb05745ec72987488c2161b72d078017cc157003d4205da SHA512 4303391a58107c76ad9b05510f5bfc95f687f4cb2f9ff5b03fb262ba99b573423ab83f0437471199954496799b343191b889ad9ef8fabdd7ee4ec3ec9b5f1d81
30 DIST openssl-3.0.3-test-fixes-expiry.patch.xz 29056 BLAKE2B 11be776b9c4baec770d81ff180581d7d8292261f32ebfcb2cfd399d684cef1b9e7b4575d906f23e8a61d853eafb178e1b0e01d9324dbe598c876c0ef74bcf5e8 SHA512 23bc571dfca453deb4f1812aea5fc1bcf1c27358d8638a66ce7f359a698b09a35bdc86e01db36aa5e59b37cc7e36f0ced6f1463b383fb0d904aada69f5d5cb04
31
32 diff --git a/dev-libs/openssl/files/openssl-3.0.5-test-memcmp.patch b/dev-libs/openssl/files/openssl-3.0.5-test-memcmp.patch
33 index 8fa03877581f..fc84d82e87da 100644
34 --- a/dev-libs/openssl/files/openssl-3.0.5-test-memcmp.patch
35 +++ b/dev-libs/openssl/files/openssl-3.0.5-test-memcmp.patch
36 @@ -1,3 +1,5 @@
37 +https://github.com/openssl/openssl/pull/18719
38 +
39 From 7f58de577c05ae0bbd20eee9b2971cfa1cd062c8 Mon Sep 17 00:00:00 2001
40 From: Gregor Jasny <gjasny@××××××××××.com>
41 Date: Tue, 5 Jul 2022 12:57:06 +0200
42
43 diff --git a/dev-libs/openssl/openssl-1.1.1q.ebuild b/dev-libs/openssl/openssl-1.1.1q.ebuild
44 new file mode 100644
45 index 000000000000..ff51db66bd0d
46 --- /dev/null
47 +++ b/dev-libs/openssl/openssl-1.1.1q.ebuild
48 @@ -0,0 +1,337 @@
49 +# Copyright 1999-2022 Gentoo Authors
50 +# Distributed under the terms of the GNU General Public License v2
51 +
52 +EAPI=8
53 +
54 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
55 +inherit edo flag-o-matic toolchain-funcs multilib-minimal verify-sig
56 +
57 +MY_P=${P/_/-}
58 +DESCRIPTION="Full-strength general purpose cryptography library (including SSL and TLS)"
59 +HOMEPAGE="https://www.openssl.org/"
60 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
61 + verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
62 +S="${WORKDIR}/${MY_P}"
63 +
64 +LICENSE="openssl"
65 +SLOT="0/1.1" # .so version of libssl/libcrypto
66 +if [[ ${PV} != *_pre* ]] ; then
67 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
68 +fi
69 +IUSE="+asm rfc3779 sctp cpu_flags_x86_sse2 sslv3 static-libs test tls-compression tls-heartbeat vanilla verify-sig weak-ssl-ciphers"
70 +RESTRICT="!test? ( test )"
71 +
72 +RDEPEND=">=app-misc/c_rehash-1.7-r1
73 + tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
74 +DEPEND="${RDEPEND}"
75 +BDEPEND="
76 + >=dev-lang/perl-5
77 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
78 + test? (
79 + sys-apps/diffutils
80 + sys-devel/bc
81 + kernel_linux? ( sys-process/procps )
82 + )
83 + verify-sig? ( sec-keys/openpgp-keys-openssl )"
84 +PDEPEND="app-misc/ca-certificates"
85 +
86 +# force upgrade to prevent broken login, bug #696950
87 +RDEPEND+=" !<net-misc/openssh-8.0_p1-r3"
88 +
89 +MULTILIB_WRAPPED_HEADERS=(
90 + usr/include/openssl/opensslconf.h
91 +)
92 +
93 +PATCHES=(
94 + # General patches which are suitable to always apply
95 + # If they're Gentoo specific, add to USE=-vanilla logic in src_prepare!
96 + "${FILESDIR}"/${PN}-1.1.0j-parallel_install_fix.patch # bug #671602
97 + "${FILESDIR}"/${PN}-1.1.1i-riscv32.patch
98 + "${FILESDIR}"/${PN}-3.0.5-test-memcmp.patch
99 +)
100 +
101 +pkg_setup() {
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-cppflags -DOPENSSL_NO_BUF_FREELISTS
179 +
180 + append-flags $(test-flags-CC -Wa,--noexecstack)
181 +
182 + # Prefixify Configure shebang (bug #141906)
183 + sed \
184 + -e "1s,/usr/bin/env,${BROOT}&," \
185 + -i Configure || die
186 +
187 + # Remove test target when FEATURES=test isn't set
188 + if ! use test ; then
189 + sed \
190 + -e '/^$config{dirs}/s@ "test",@@' \
191 + -i Configure || die
192 + fi
193 +
194 + if use prefix && [[ ${CHOST} == *-solaris* ]] ; then
195 + # use GNU ld full option, not to confuse it on Solaris
196 + sed -i \
197 + -e 's/-Wl,-M,/-Wl,--version-script=/' \
198 + -e 's/-Wl,-h,/-Wl,--soname=/' \
199 + Configurations/10-main.conf || die
200 +
201 + # fix building on Solaris 10
202 + # https://github.com/openssl/openssl/issues/6333
203 + sed -i \
204 + -e 's/-lsocket -lnsl -ldl/-lsocket -lnsl -ldl -lrt/' \
205 + Configurations/10-main.conf || die
206 + fi
207 +
208 + # The config script does stupid stuff to prompt the user. Kill it.
209 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
210 + ./config --test-sanity || die "I AM NOT SANE"
211 +
212 + multilib_copy_sources
213 +}
214 +
215 +multilib_src_configure() {
216 + # bug #197996
217 + unset APPS
218 + # bug #312551
219 + unset SCRIPTS
220 + # bug #311473
221 + unset CROSS_COMPILE
222 +
223 + tc-export AR CC CXX RANLIB RC
224 +
225 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
226 +
227 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
228 +
229 + # See if our toolchain supports __uint128_t. If so, it's 64bit
230 + # friendly and can use the nicely optimized code paths, bug #460790.
231 + local ec_nistp_64_gcc_128
232 +
233 + # Disable it for now though (bug #469976)
234 + # echo "__uint128_t i;" > "${T}"/128.c
235 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
236 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
237 + # fi
238 +
239 + local sslout=$(./gentoo.config)
240 + einfo "Use configuration ${sslout:-(openssl knows best)}"
241 + local config="Configure"
242 + [[ -z ${sslout} ]] && config="config"
243 +
244 + # "disable-deprecated" option breaks too many consumers.
245 + # Don't set it without thorough revdeps testing.
246 + # Make sure user flags don't get added *yet* to avoid duplicated
247 + # flags.
248 + local myeconfargs=(
249 + ${sslout}
250 +
251 + $(use cpu_flags_x86_sse2 || echo "no-sse2")
252 + enable-camellia
253 + enable-ec
254 + enable-ec2m
255 + enable-sm2
256 + enable-srp
257 + $(use elibc_musl && echo "no-async")
258 + ${ec_nistp_64_gcc_128}
259 + enable-idea
260 + enable-mdc2
261 + enable-rc5
262 + $(use_ssl sslv3 ssl3)
263 + $(use_ssl sslv3 ssl3-method)
264 + $(use_ssl asm)
265 + $(use_ssl rfc3779)
266 + $(use_ssl sctp)
267 + $(use test || echo "no-tests")
268 + $(use_ssl tls-compression zlib)
269 + $(use_ssl tls-heartbeat heartbeats)
270 + $(use_ssl weak-ssl-ciphers)
271 +
272 + --prefix="${EPREFIX}"/usr
273 + --openssldir="${EPREFIX}"${SSL_CNF_DIR}
274 + --libdir=$(get_libdir)
275 +
276 + shared
277 + threads
278 + )
279 +
280 + CFLAGS= LDFLAGS= edo ./${config} "${myeconfargs[@]}"
281 +
282 + # Clean out hardcoded flags that openssl uses
283 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
284 + -e 's:^CFLAGS=::' \
285 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
286 + -e 's:\(^\| \)-O[^ ]*::g' \
287 + -e 's:\(^\| \)-march=[^ ]*::g' \
288 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
289 + -e 's:\(^\| \)-m[^ ]*::g' \
290 + -e 's:^ *::' \
291 + -e 's: *$::' \
292 + -e 's: \+: :g' \
293 + -e 's:\\:\\\\:g'
294 + )
295 +
296 + # Now insert clean default flags with user flags
297 + sed -i \
298 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
299 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
300 + Makefile || die
301 +}
302 +
303 +multilib_src_compile() {
304 + # depend is needed to use $confopts; it also doesn't matter
305 + # that it's -j1 as the code itself serializes subdirs
306 + emake -j1 depend
307 +
308 + emake all
309 +}
310 +
311 +multilib_src_test() {
312 + emake -j1 test
313 +}
314 +
315 +multilib_src_install() {
316 + # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
317 + dodir /usr
318 +
319 + emake DESTDIR="${D}" install
320 +
321 + # This is crappy in that the static archives are still built even
322 + # when USE=static-libs. But this is due to a failing in the openssl
323 + # build system: the static archives are built as PIC all the time.
324 + # Only way around this would be to manually configure+compile openssl
325 + # twice; once with shared lib support enabled and once without.
326 + if ! use static-libs; then
327 + rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
328 + fi
329 +}
330 +
331 +multilib_src_install_all() {
332 + # openssl installs perl version of c_rehash by default, but
333 + # we provide a shell version via app-misc/c_rehash
334 + rm "${ED}"/usr/bin/c_rehash || die
335 +
336 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
337 +
338 + # Create the certs directory
339 + keepdir ${SSL_CNF_DIR}/certs
340 +
341 + # Namespace openssl programs to prevent conflicts with other man pages
342 + cd "${ED}"/usr/share/man || die
343 + local m d s
344 + for m in $(find . -type f | xargs grep -L '#include') ; do
345 + d=${m%/*}
346 + d=${d#./}
347 + m=${m##*/}
348 +
349 + [[ ${m} == openssl.1* ]] && continue
350 +
351 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
352 +
353 + mv ${d}/{,ssl-}${m} || die
354 +
355 + # Fix up references to renamed man pages
356 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
357 + ln -s ssl-${m} ${d}/openssl-${m}
358 +
359 + # Locate any symlinks that point to this man page
360 + # We assume that any broken links are due to the above renaming
361 + for s in $(find -L ${d} -type l) ; do
362 + s=${s##*/}
363 +
364 + rm -f ${d}/${s}
365 +
366 + # We don't want to "|| die" here
367 + ln -s ssl-${m} ${d}/ssl-${s}
368 + ln -s ssl-${s} ${d}/openssl-${s}
369 + done
370 + done
371 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
372 +
373 + # bug #254521
374 + dodir /etc/sandbox.d
375 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
376 +
377 + diropts -m0700
378 + keepdir ${SSL_CNF_DIR}/private
379 +}
380 +
381 +pkg_postinst() {
382 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
383 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
384 + eend $?
385 +}