Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Tue, 01 Nov 2022 19:19:54
Message-Id: 1667330389.b125a0435c6ac1f605701c780124584ffd08f01d.robbat2@gentoo
1 commit: b125a0435c6ac1f605701c780124584ffd08f01d
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 1 16:03:35 2022 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 1 19:19:49 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b125a043
7
8 dev-libs/openssl: cleanup vulnerable
9
10 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
11
12 dev-libs/openssl/openssl-3.0.5.ebuild | 338 ----------------------------------
13 1 file changed, 338 deletions(-)
14
15 diff --git a/dev-libs/openssl/openssl-3.0.5.ebuild b/dev-libs/openssl/openssl-3.0.5.ebuild
16 deleted file mode 100644
17 index 83047974b399..000000000000
18 --- a/dev-libs/openssl/openssl-3.0.5.ebuild
19 +++ /dev/null
20 @@ -1,338 +0,0 @@
21 -# Copyright 1999-2022 Gentoo Authors
22 -# Distributed under the terms of the GNU General Public License v2
23 -
24 -EAPI=7
25 -
26 -VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
27 -inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
28 -
29 -DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
30 -HOMEPAGE="https://www.openssl.org/"
31 -
32 -MY_P=${P/_/-}
33 -
34 -if [[ ${PV} == 9999 ]] ; then
35 - EGIT_REPO_URI="https://github.com/openssl/openssl.git"
36 -
37 - inherit git-r3
38 -else
39 - SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
40 - verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
41 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
42 -fi
43 -
44 -S="${WORKDIR}"/${MY_P}
45 -
46 -LICENSE="Apache-2.0"
47 -SLOT="0/3" # .so version of libssl/libcrypto
48 -IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
49 -RESTRICT="!test? ( test )"
50 -
51 -COMMON_DEPEND="
52 - >=app-misc/c_rehash-1.7-r1
53 - tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
54 -"
55 -BDEPEND="
56 - >=dev-lang/perl-5
57 - sctp? ( >=net-misc/lksctp-tools-1.0.12 )
58 - test? (
59 - sys-apps/diffutils
60 - sys-devel/bc
61 - sys-process/procps
62 - )
63 - verify-sig? ( sec-keys/openpgp-keys-openssl )"
64 -
65 -DEPEND="${COMMON_DEPEND}"
66 -RDEPEND="${COMMON_DEPEND}"
67 -PDEPEND="app-misc/ca-certificates"
68 -
69 -MULTILIB_WRAPPED_HEADERS=(
70 - /usr/include/openssl/configuration.h
71 -)
72 -
73 -PATCHES=(
74 - "${FILESDIR}"/${P}-test-memcmp.patch
75 -)
76 -
77 -pkg_setup() {
78 - if use ktls ; then
79 - if kernel_is -lt 4 18 ; then
80 - ewarn "Kernel implementation of TLS (USE=ktls) requires kernel >=4.18!"
81 - else
82 - CONFIG_CHECK="~TLS ~TLS_DEVICE"
83 - ERROR_TLS="You will be unable to offload TLS to kernel because CONFIG_TLS is not set!"
84 - ERROR_TLS_DEVICE="You will be unable to offload TLS to kernel because CONFIG_TLS_DEVICE is not set!"
85 -
86 - linux-info_pkg_setup
87 - fi
88 - fi
89 -
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 - # - https://github.com/openssl/openssl/issues/18663#issuecomment-1181478057
163 - # Don't remove the no strict aliasing bits below!
164 - filter-flags -fstrict-aliasing
165 - append-flags -fno-strict-aliasing
166 -
167 - append-flags $(test-flags-CC -Wa,--noexecstack)
168 -
169 - # Prefixify Configure shebang (bug #141906)
170 - sed \
171 - -e "1s,/usr/bin/env,${BROOT}&," \
172 - -i Configure || die
173 -
174 - # Remove test target when FEATURES=test isn't set
175 - if ! use test ; then
176 - sed \
177 - -e '/^$config{dirs}/s@ "test",@@' \
178 - -i Configure || die
179 - fi
180 -
181 - # The config script does stupid stuff to prompt the user. Kill it.
182 - sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
183 - ./config --test-sanity || die "I AM NOT SANE"
184 -
185 - multilib_copy_sources
186 -}
187 -
188 -multilib_src_configure() {
189 - # bug #197996
190 - unset APPS
191 - # bug #312551
192 - unset SCRIPTS
193 - # bug #311473
194 - unset CROSS_COMPILE
195 -
196 - tc-export AR CC CXX RANLIB RC
197 -
198 - use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
199 -
200 - local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
201 -
202 - # See if our toolchain supports __uint128_t. If so, it's 64bit
203 - # friendly and can use the nicely optimized code paths, bug #460790.
204 - #local ec_nistp_64_gcc_128
205 - #
206 - # Disable it for now though (bug #469976)
207 - # Do NOT re-enable without substantial discussion first!
208 - #
209 - #echo "__uint128_t i;" > "${T}"/128.c
210 - #if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
211 - # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
212 - #fi
213 -
214 - local sslout=$(./gentoo.config)
215 - einfo "Using configuration: ${sslout:-(openssl knows best)}"
216 - local config="Configure"
217 - [[ -z ${sslout} ]] && config="config"
218 -
219 - # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
220 - local myeconfargs=(
221 - ${sslout}
222 -
223 - $(use cpu_flags_x86_sse2 || echo "no-sse2")
224 - enable-camellia
225 - enable-ec
226 - enable-ec2m
227 - enable-sm2
228 - enable-srp
229 - $(use elibc_musl && echo "no-async")
230 - enable-idea
231 - enable-mdc2
232 - enable-rc5
233 - $(use fips && echo "enable-fips")
234 - $(use_ssl asm)
235 - $(use_ssl ktls)
236 - $(use_ssl rfc3779)
237 - $(use_ssl sctp)
238 - $(use test || echo "no-tests")
239 - $(use_ssl tls-compression zlib)
240 - $(use_ssl weak-ssl-ciphers)
241 -
242 - --prefix="${EPREFIX}"/usr
243 - --openssldir="${EPREFIX}"${SSL_CNF_DIR}
244 - --libdir=$(get_libdir)
245 -
246 - shared
247 - threads
248 - )
249 -
250 - CFLAGS= LDFLAGS= edo ./${config} "${myeconfargs[@]}"
251 -
252 - # Clean out hardcoded flags that openssl uses
253 - local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
254 - -e 's:^CFLAGS=::' \
255 - -e 's:\(^\| \)-fomit-frame-pointer::g' \
256 - -e 's:\(^\| \)-O[^ ]*::g' \
257 - -e 's:\(^\| \)-march=[^ ]*::g' \
258 - -e 's:\(^\| \)-mcpu=[^ ]*::g' \
259 - -e 's:\(^\| \)-m[^ ]*::g' \
260 - -e 's:^ *::' \
261 - -e 's: *$::' \
262 - -e 's: \+: :g' \
263 - -e 's:\\:\\\\:g'
264 - )
265 -
266 - # Now insert clean default flags with user flags
267 - sed -i \
268 - -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
269 - -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
270 - Makefile \
271 - || die
272 -}
273 -
274 -multilib_src_compile() {
275 - # depend is needed to use $confopts; it also doesn't matter
276 - # that it's -j1 as the code itself serializes subdirs
277 - emake -j1 depend
278 -
279 - emake all
280 -}
281 -
282 -multilib_src_test() {
283 - # VFP = show subtests verbosely and show failed tests verbosely
284 - # Normal V=1 would show everything verbosely but this slows things down.
285 - emake HARNESS_JOBS="$(makeopts_jobs)" VFP=1 test
286 -}
287 -
288 -multilib_src_install() {
289 - # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
290 - dodir /usr
291 -
292 - emake DESTDIR="${D}" install
293 -
294 - # This is crappy in that the static archives are still built even
295 - # when USE=static-libs. But this is due to a failing in the openssl
296 - # build system: the static archives are built as PIC all the time.
297 - # Only way around this would be to manually configure+compile openssl
298 - # twice; once with shared lib support enabled and once without.
299 - if ! use static-libs ; then
300 - rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
301 - fi
302 -}
303 -
304 -multilib_src_install_all() {
305 - # openssl installs perl version of c_rehash by default, but
306 - # we provide a shell version via app-misc/c_rehash
307 - rm "${ED}"/usr/bin/c_rehash || die
308 -
309 - dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
310 -
311 - # Create the certs directory
312 - keepdir ${SSL_CNF_DIR}/certs
313 -
314 - # Namespace openssl programs to prevent conflicts with other man pages
315 - cd "${ED}"/usr/share/man || die
316 - local m d s
317 - for m in $(find . -type f | xargs grep -L '#include') ; do
318 - d=${m%/*}
319 - d=${d#./}
320 - m=${m##*/}
321 -
322 - [[ ${m} == openssl.1* ]] && continue
323 -
324 - [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
325 -
326 - mv ${d}/{,ssl-}${m} || die
327 -
328 - # Fix up references to renamed man pages
329 - sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
330 - ln -s ssl-${m} ${d}/openssl-${m} || die
331 -
332 - # Locate any symlinks that point to this man page
333 - # We assume that any broken links are due to the above renaming
334 - for s in $(find -L ${d} -type l) ; do
335 - s=${s##*/}
336 -
337 - rm -f ${d}/${s}
338 -
339 - # We don't want to "|| die" here
340 - ln -s ssl-${m} ${d}/ssl-${s}
341 - ln -s ssl-${s} ${d}/openssl-${s}
342 - done
343 - done
344 - [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
345 -
346 - # bug #254521
347 - dodir /etc/sandbox.d
348 - echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
349 -
350 - diropts -m0700
351 - keepdir ${SSL_CNF_DIR}/private
352 -}
353 -
354 -pkg_postinst() {
355 - ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
356 - c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
357 - eend $?
358 -}