Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Wed, 01 Jan 2020 21:25:39
Message-Id: 1577913909.2fd3637f1b9e3cee6adf6b7c10d1ecc4ea08071e.whissi@gentoo
1 commit: 2fd3637f1b9e3cee6adf6b7c10d1ecc4ea08071e
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 1 21:22:39 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 1 21:25:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fd3637f
7
8 dev-libs/openssl: security cleanup (#702176)
9
10 Bug: https://bugs.gentoo.org/702176
11 Package-Manager: Portage-2.3.84, Repoman-2.3.20
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 dev-libs/openssl/Manifest | 1 -
15 dev-libs/openssl/openssl-1.0.2t-r1.ebuild | 308 ------------------------------
16 2 files changed, 309 deletions(-)
17
18 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
19 index 9610c7c62b5..076dc6a995b 100644
20 --- a/dev-libs/openssl/Manifest
21 +++ b/dev-libs/openssl/Manifest
22 @@ -1,6 +1,5 @@
23 DIST openssl-1.0.2-patches-1.5.tar.xz 12404 BLAKE2B 6c1b8c28f339f539b2ab8643379502a24cf62bffde00041dce54d5dd9e8d2620b181362ee5464b0ab32ba4948e209697bfabadbea2944a409a1009100d298f24 SHA512 5725e2d9d1ee8cc074bcef3bed61c71bdab2ff1c114362110c3fb8da11ad5bc8f2ff28e90a293f5f3a5cf96ecda54dffdb7ab3fb3f8b23ef6472250dc3037659
24 DIST openssl-1.0.2t-bindist-1.0.tar.xz 13872 BLAKE2B b2aade96a6e0ca6209a39e205b1c838de945903fcf959c62cc29ddcd1a0cb360fc5db234df86860a6a4c096f5ecc237611e4c2946b986a5500c24ba93c208ef4 SHA512 a48a7efb9b973b865bcc5009d450b428ed6b4b95e4cefe70c51056e47392c8a7bec58215168d8b07712419dc74646c2bd2fd23bcfbba2031376e292249a6b1b6
25 -DIST openssl-1.0.2t.tar.gz 5355422 BLAKE2B dcbc883151ff6c5b60f5849d8789c2e76a384cb3d5eb5f08a6109776d0edf134580dc33fa8b946ae2344542560f04ecef17f218406952dd8d31e4200c4882022 SHA512 0b88868933f42fab87e8b22449435a1091cc6e75f986aad6c173e01ad123161fcae8c226759073701bc65c9f2f0b6ce6a63a61203008ed873cfb6e484f32bc71
26 DIST openssl-1.0.2u.tar.gz 5355412 BLAKE2B b2ff2a10e5851af5aca4093422a9a072c794e87b997263826c1c35910c040f695fac63decac5856cb49399ed03d410f97701d9fd4e1ebfbcacd8f3a74ce8bf57 SHA512 c455bb309e20e2c2d47fdc5619c734d107d5c8c38c1409903ce979acc120b0d5fa0312917c0aa0d630e402d092a703d4249643f36078e8528a3cafc9dac6ab32
27 DIST openssl-1.1.0l-bindist-1.0.tar.xz 13184 BLAKE2B c09e023458faff17b10d6f20c28462c0851757a20d59b4b751220ab307324d5778252df112ad74fd319407cc75fdd1cd507d48058dd0234dc8c03020c882ed42 SHA512 39720ecee3ec6080c1416f2fb7c9246b89ee55b21be2baabad51eb6823dbe1559450b1ae92fa61ac1cf5ba04ac8c02438aa469bc65eae6905cf1ea486f270793
28 DIST openssl-1.1.0l.tar.gz 5294857 BLAKE2B 0e4f30f9e8a22414325bd780dc4e875e962487fbe72967f0392ace959955429192541881a98d097d7bb75ed7238b1817b0c3c2c4da04421512bd538f2b07cdd7 SHA512 81b74149f40ea7d9f7e235820a4f977844653ad1e2b302e65e712c12193f47542fe7e3385fd1e25e3dd074e4e6d04199836cbc492656f5a7692edab5e234f4ad
29
30 diff --git a/dev-libs/openssl/openssl-1.0.2t-r1.ebuild b/dev-libs/openssl/openssl-1.0.2t-r1.ebuild
31 deleted file mode 100644
32 index 37ad94c9f5d..00000000000
33 --- a/dev-libs/openssl/openssl-1.0.2t-r1.ebuild
34 +++ /dev/null
35 @@ -1,308 +0,0 @@
36 -# Copyright 1999-2019 Gentoo Authors
37 -# Distributed under the terms of the GNU General Public License v2
38 -
39 -EAPI="7"
40 -
41 -inherit flag-o-matic toolchain-funcs multilib multilib-minimal
42 -
43 -# openssl-1.0.2-patches-1.6 contain additional CVE patches
44 -# which got fixed with this release.
45 -# Please use 1.7 version number when rolling a new tarball!
46 -PATCH_SET="openssl-1.0.2-patches-1.5"
47 -
48 -MY_P=${P/_/-}
49 -
50 -# This patch set is based on the following files from Fedora 25,
51 -# see https://src.fedoraproject.org/rpms/openssl/blob/25/f/openssl.spec
52 -# for more details:
53 -# - hobble-openssl (SOURCE1)
54 -# - ec_curve.c (SOURCE12) -- MODIFIED
55 -# - ectest.c (SOURCE13)
56 -# - openssl-1.1.1-ec-curves.patch (PATCH37) -- MODIFIED
57 -BINDIST_PATCH_SET="openssl-1.0.2t-bindist-1.0.tar.xz"
58 -
59 -DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
60 -HOMEPAGE="https://www.openssl.org/"
61 -SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
62 - bindist? (
63 - mirror://gentoo/${BINDIST_PATCH_SET}
64 - https://dev.gentoo.org/~whissi/dist/openssl/${BINDIST_PATCH_SET}
65 - )
66 - !vanilla? (
67 - mirror://gentoo/${PATCH_SET}.tar.xz
68 - https://dev.gentoo.org/~chutzpah/dist/${PN}/${PATCH_SET}.tar.xz
69 - https://dev.gentoo.org/~whissi/dist/${PN}/${PATCH_SET}.tar.xz
70 - https://dev.gentoo.org/~polynomial-c/dist/${PATCH_SET}.tar.xz
71 - )"
72 -
73 -LICENSE="openssl"
74 -SLOT="0"
75 -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 ~riscv s390 sh sparc x86 ~x86-linux"
76 -IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
77 -RESTRICT="!bindist? ( bindist )
78 - !test? ( test )"
79 -
80 -RDEPEND=">=app-misc/c_rehash-1.7-r1
81 - gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
82 - kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
83 - zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
84 -DEPEND="${RDEPEND}"
85 -BDEPEND="
86 - >=dev-lang/perl-5
87 - sctp? ( >=net-misc/lksctp-tools-1.0.12 )
88 - test? (
89 - sys-apps/diffutils
90 - sys-devel/bc
91 - )"
92 -PDEPEND="app-misc/ca-certificates"
93 -
94 -S="${WORKDIR}/${MY_P}"
95 -
96 -MULTILIB_WRAPPED_HEADERS=(
97 - usr/include/openssl/opensslconf.h
98 -)
99 -
100 -src_prepare() {
101 - if use bindist; then
102 - mv "${WORKDIR}"/bindist-patches/hobble-openssl "${WORKDIR}" || die
103 - bash "${WORKDIR}"/hobble-openssl || die
104 -
105 - cp -f "${WORKDIR}"/bindist-patches/ec_curve.c "${S}"/crypto/ec/ || die
106 - cp -f "${WORKDIR}"/bindist-patches/ectest.c "${S}"/crypto/ec/ || die
107 -
108 - eapply "${WORKDIR}"/bindist-patches/ec-curves.patch
109 -
110 - # Also see the configure parts below:
111 - # enable-ec \
112 - # $(use_ssl !bindist ec2m) \
113 - # $(use_ssl !bindist srp) \
114 - fi
115 -
116 - # keep this in sync with app-misc/c_rehash
117 - SSL_CNF_DIR="/etc/ssl"
118 -
119 - # Make sure we only ever touch Makefile.org and avoid patching a file
120 - # that gets blown away anyways by the Configure script in src_configure
121 - rm -f Makefile
122 -
123 - if ! use vanilla ; then
124 - eapply "${WORKDIR}"/patch/*.patch
125 - fi
126 -
127 - eapply_user
128 -
129 - # disable fips in the build
130 - # make sure the man pages are suffixed #302165
131 - # don't bother building man pages if they're disabled
132 - sed -i \
133 - -e '/DIRS/s: fips : :g' \
134 - -e '/^MANSUFFIX/s:=.*:=ssl:' \
135 - -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
136 - -e $(has noman FEATURES \
137 - && echo '/^install:/s:install_docs::' \
138 - || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
139 - Makefile.org \
140 - || die
141 - # show the actual commands in the log
142 - sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
143 -
144 - # since we're forcing $(CC) as makedep anyway, just fix
145 - # the conditional as always-on
146 - # helps clang (#417795), and versioned gcc (#499818)
147 - # this breaks build with 1.0.2p, not sure if it is needed anymore
148 - #sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
149 -
150 - # quiet out unknown driver argument warnings since openssl
151 - # doesn't have well-split CFLAGS and we're making it even worse
152 - # and 'make depend' uses -Werror for added fun (#417795 again)
153 - [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
154 -
155 - # allow openssl to be cross-compiled
156 - cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
157 - chmod a+rx gentoo.config || die
158 -
159 - append-flags -fno-strict-aliasing
160 - append-flags $(test-flags-CC -Wa,--noexecstack)
161 - append-cppflags -DOPENSSL_NO_BUF_FREELISTS
162 -
163 - sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
164 - # The config script does stupid stuff to prompt the user. Kill it.
165 - sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
166 - ./config --test-sanity || die "I AM NOT SANE"
167 -
168 - multilib_copy_sources
169 -}
170 -
171 -multilib_src_configure() {
172 - unset APPS #197996
173 - unset SCRIPTS #312551
174 - unset CROSS_COMPILE #311473
175 -
176 - tc-export CC AR RANLIB RC
177 -
178 - # Clean out patent-or-otherwise-encumbered code
179 - # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
180 - # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
181 - # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
182 - # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
183 - # RC5: Expired https://en.wikipedia.org/wiki/RC5
184 -
185 - use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
186 - echoit() { echo "$@" ; "$@" ; }
187 -
188 - local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
189 -
190 - # See if our toolchain supports __uint128_t. If so, it's 64bit
191 - # friendly and can use the nicely optimized code paths. #460790
192 - local ec_nistp_64_gcc_128
193 - # Disable it for now though #469976
194 - #if ! use bindist ; then
195 - # echo "__uint128_t i;" > "${T}"/128.c
196 - # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
197 - # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
198 - # fi
199 - #fi
200 -
201 - # https://github.com/openssl/openssl/issues/2286
202 - if use ia64 ; then
203 - replace-flags -g3 -g2
204 - replace-flags -ggdb3 -ggdb2
205 - fi
206 -
207 - local sslout=$(./gentoo.config)
208 - einfo "Use configuration ${sslout:-(openssl knows best)}"
209 - local config="Configure"
210 - [[ -z ${sslout} ]] && config="config"
211 -
212 - # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
213 - # Make sure user flags don't get added *yet* to avoid duplicated
214 - # flags.
215 - CFLAGS= LDFLAGS= echoit \
216 - ./${config} \
217 - ${sslout} \
218 - $(use cpu_flags_x86_sse2 || echo "no-sse2") \
219 - enable-camellia \
220 - enable-ec \
221 - $(use_ssl !bindist ec2m) \
222 - $(use_ssl !bindist srp) \
223 - ${ec_nistp_64_gcc_128} \
224 - enable-idea \
225 - enable-mdc2 \
226 - enable-rc5 \
227 - enable-tlsext \
228 - $(use_ssl asm) \
229 - $(use_ssl gmp gmp -lgmp) \
230 - $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
231 - $(use_ssl rfc3779) \
232 - $(use_ssl sctp) \
233 - $(use_ssl sslv2 ssl2) \
234 - $(use_ssl sslv3 ssl3) \
235 - $(use_ssl tls-heartbeat heartbeats) \
236 - $(use_ssl zlib) \
237 - --prefix="${EPREFIX}"/usr \
238 - --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
239 - --libdir=$(get_libdir) \
240 - shared threads \
241 - || die
242 -
243 - # Clean out hardcoded flags that openssl uses
244 - local DEFAULT_CFLAGS=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
245 - -e 's:^CFLAG=::' \
246 - -e 's:\(^\| \)-fomit-frame-pointer::g' \
247 - -e 's:\(^\| \)-O[^ ]*::g' \
248 - -e 's:\(^\| \)-march=[^ ]*::g' \
249 - -e 's:\(^\| \)-mcpu=[^ ]*::g' \
250 - -e 's:\(^\| \)-m[^ ]*::g' \
251 - -e 's:^ *::' \
252 - -e 's: *$::' \
253 - -e 's: \+: :g' \
254 - -e 's:\\:\\\\:g'
255 - )
256 -
257 - # Now insert clean default flags with user flags
258 - sed -i \
259 - -e "/^CFLAG/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
260 - -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
261 - Makefile || die
262 -}
263 -
264 -multilib_src_compile() {
265 - # depend is needed to use $confopts; it also doesn't matter
266 - # that it's -j1 as the code itself serializes subdirs
267 - emake -j1 V=1 depend
268 - emake all
269 - # rehash is needed to prep the certs/ dir; do this
270 - # separately to avoid parallel build issues.
271 - emake rehash
272 -}
273 -
274 -multilib_src_test() {
275 - emake -j1 test
276 -}
277 -
278 -multilib_src_install() {
279 - # We need to create $ED/usr on our own to avoid a race condition #665130
280 - if [[ ! -d "${ED}/usr" ]]; then
281 - # We can only create this directory once
282 - mkdir "${ED}"/usr || die
283 - fi
284 -
285 - emake INSTALL_PREFIX="${D}" install
286 -}
287 -
288 -multilib_src_install_all() {
289 - # openssl installs perl version of c_rehash by default, but
290 - # we provide a shell version via app-misc/c_rehash
291 - rm "${ED}"/usr/bin/c_rehash || die
292 -
293 - local -a DOCS=( CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el )
294 - einstalldocs
295 -
296 - use rfc3779 && dodoc engines/ccgost/README.gost
297 -
298 - # This is crappy in that the static archives are still built even
299 - # when USE=static-libs. But this is due to a failing in the openssl
300 - # build system: the static archives are built as PIC all the time.
301 - # Only way around this would be to manually configure+compile openssl
302 - # twice; once with shared lib support enabled and once without.
303 - use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
304 -
305 - # create the certs directory
306 - dodir ${SSL_CNF_DIR}/certs
307 - cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
308 - rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
309 -
310 - # Namespace openssl programs to prevent conflicts with other man pages
311 - cd "${ED}"/usr/share/man
312 - local m d s
313 - for m in $(find . -type f | xargs grep -L '#include') ; do
314 - d=${m%/*} ; d=${d#./} ; m=${m##*/}
315 - [[ ${m} == openssl.1* ]] && continue
316 - [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
317 - mv ${d}/{,ssl-}${m}
318 - # fix up references to renamed man pages
319 - sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
320 - ln -s ssl-${m} ${d}/openssl-${m}
321 - # locate any symlinks that point to this man page ... we assume
322 - # that any broken links are due to the above renaming
323 - for s in $(find -L ${d} -type l) ; do
324 - s=${s##*/}
325 - rm -f ${d}/${s}
326 - ln -s ssl-${m} ${d}/ssl-${s}
327 - ln -s ssl-${s} ${d}/openssl-${s}
328 - done
329 - done
330 - [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
331 -
332 - dodir /etc/sandbox.d #254521
333 - echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
334 -
335 - diropts -m0700
336 - keepdir ${SSL_CNF_DIR}/private
337 -}
338 -
339 -pkg_postinst() {
340 - ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
341 - c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
342 - eend $?
343 -}