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