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: Thu, 02 Nov 2017 15:58:14
Message-Id: 1509638275.ddc7a2854b198ea1377a9b109a1d366e4c3099e0.whissi@gentoo
1 commit: ddc7a2854b198ea1377a9b109a1d366e4c3099e0
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 2 15:57:41 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 2 15:57:55 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddc7a285
7
8 dev-libs/openssl: Bump for CVE-2017-{3735,3736}
9
10 Bug: https://bugs.gentoo.org/629290
11 Bug: https://bugs.gentoo.org/636264
12 Package-Manager: Portage-2.3.13, Repoman-2.3.4
13
14 dev-libs/openssl/Manifest | 2 +
15 dev-libs/openssl/openssl-1.0.2m.ebuild | 254 +++++++++++++++++++++++++++++++++
16 dev-libs/openssl/openssl-1.1.0g.ebuild | 240 +++++++++++++++++++++++++++++++
17 3 files changed, 496 insertions(+)
18
19 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
20 index 732d1736742..9ea348a713c 100644
21 --- a/dev-libs/openssl/Manifest
22 +++ b/dev-libs/openssl/Manifest
23 @@ -4,9 +4,11 @@ DIST openssl-1.0.2l.tar.gz 5365054 SHA256 ce07195b659e75f4e1db43552860070061f156
24 DIST openssl-1.0.2l_ec_curve.c 17254 SHA256 43ad99527a9f494c97c1efd4a87b49508455437da5de1b9ecd89b0d36fb764c8 SHA512 8e92fb100bcf4bd918c82b9a6cbd75a55abe1a2c08230a007e441c51577f974f8cc336e9ac8a672b32641480428ca8cead5380da1fe81bacb088145a1b754a15 WHIRLPOOL 5a43777a2886a2e7bd41eeb3a96c90c62b0eaa771249a50eb5996993f43384dca5f24993ed6a6deede2c4f119f896fb11dbc26b72650c909c856bd8c313501f0
25 DIST openssl-1.0.2l_ectest.c 30735 SHA256 14f12b1db5121f3f58466f52ad10555c038c281e90e53c0a2f7940a754bb4d80 SHA512 f2e4d34327b490bc8371f0845c69df3f9fc51ea16f0ea0de0411a0c1fa9d49bb2b6fafc363eb3b3cd919dc7c24e4a0d075c6ff878c01d70dae918f2540874c19 WHIRLPOOL 0d708b382d97e1f20a03e695f0a990fb9fd6cd8ab8ced29e072d52ca3f09f87d18c287d6134fd5ac2243ca541982f4d9eaa2fa8964d62b6b8f1a4b879e8fd997
26 DIST openssl-1.0.2l_hobble-openssl 1302 SHA256 7ec32aab6a1db2124de52c3918cc7f7e487972581e30235447eed15d59415384 SHA512 3d757a4708e74a03dd5cb9b8114dfe442ed9520739a6eca693be4c4265771696f1449ea06d1c9bcfc6e94fc9b0dd0c10e153f1c3b0334831c0550b36cd63326e WHIRLPOOL b9630ce76492bff481d0bd48b72449d1e1d4fbb98c2387c4824d84833796adaba716e10976b3130eed9fd9442511a71604d9944600ba6be5253087f865cefe8c
27 +DIST openssl-1.0.2m.tar.gz 5373776 SHA256 8c6ff15ec6b319b50788f42c7abc2890c08ba5a1cdcd3810eb9092deada37b0f SHA512 7619aa223ee50d0f5e270ac9090e95b2b1ba5dfc656c98f625a9a277dda472fb960a4e89a7ba300044cb401b2072b2ca6a6fcce8206d927bf373d1c981806a93 WHIRLPOOL 0fa5ab02eb3ca8507b45c408739027f8632a77183a7355f8c31bcc5fedc507222e5cc44a4aff88b22fba87b69188f90465980c4a84bad1133287442ebd136a23
28 DIST openssl-1.1.0-build.patch 3028 SHA256 c626ac8b34df5d55a7272a741f87f06dc06cc20ac80085048788a2c76c08c25f SHA512 b19a912900970052f80c67f28975e793ae9e70ebfc62efae0544e09931079e98c4cd29ce1cc8d937ceca97aff9a12fdc1ff9ce6c2b47fea68c79e7065464a0f0 WHIRLPOOL 950febb159139b145eb7de5bda1115465fa8551234182e6d15459ab5519213f515b4c3e3a3136d05c440d3eec04a7247461d36c2d45136a6f1963613d5896b3e
29 DIST openssl-1.1.0-ec-curves.patch 2967 SHA256 da60dfa01ed244cd3f77f60cc2ef479a36e64a58fa5e242aa03647c698cc1a42 SHA512 8fb9c6759ae2077ad3697ba77e85ab3970fd8b3f64b21eb260b4f6333b7ebf2f5a53c7eee311229edfbd96a2b904ec5e5e00dfa5b62cf1105fece13069077bd2 WHIRLPOOL e7293ef84f6c36e8e5f5ec8158023fdca484bc9082e73956bd0cc74a17c880350a49799146c855a37f116d743e7c93e54cbe4aa7f70483e235d03687a15a46a5
30 DIST openssl-1.1.0f.tar.gz 5278176 SHA256 12f746f3f2493b2f39da7ecf63d7ee19c6ac9ec6a4fcd8c229da8a522cb12765 SHA512 340ab3f38c90dea346e543b58bc0eff0adede15be212ad20b7cf38718a7f94fab51996da414855c180540f7488b8bd31d8b9a0d04bb19159f735c46d8f6df22c WHIRLPOOL bb4ce1d100c5eb567de0139e4a1c0a2bb1cd308bd014704d6bb796d3fcfc16b91fe69839068944831746e0b937a6ccb234b5cea3b4911fab4283500ed380f0b6
31 DIST openssl-1.1.0f_ec_curve.c 18393 SHA256 9dd0e1f422116da45eb16936fbbbe4e4e05e7a8fc0f359594af76e935c37716e SHA512 ee3e576825bccdf02cede4205ab92c42ae9dd3a8e75ce58617a3a5980a61d144eb3c5197d9dcd378a5d49bf34c4b2f591aa6a619fee92b7a22825d72681ab879 WHIRLPOOL 6f43f3b8037f5edf323ea865d1150eaa63ee60f60b512b52e37b752b328855e57eae70c812071caba0f91eeeb379c4dd9574806ba50d5bee38ad3b0e3fe03f55
32 DIST openssl-1.1.0f_ectest.c 29907 SHA256 37682adb07ba260339fad3fead87b186fc8c26321a0aad45deefed4c25ad87cb SHA512 90cec9d46326cb7216236811c8e963032b6fa7500117cea36f28534eb50a5ab1260c7f9a5c8c490d845236b0769576a8d97bc7471f970e9c5e70cb3408c20dae WHIRLPOOL f39da1830f5a6492add40f460af9d85b2fbfac0d5d8ff4eb4ba3cb16e6ff50a030aee38c518d7a06d1167f59030ded5496000793ad4cf2de7ff36f22eeefe7c7
33 DIST openssl-1.1.0f_hobble-openssl 1117 SHA256 ab168bd8bf578f7361524f9a12eecbbaf41fd7e2c852a0158aafd3bce9cac569 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826 WHIRLPOOL 94537166ad8f5cacba2d30d0b6e4676d896cab157be5891fbeecdb2efa10a322d77e2b35a44ff1d474e860dcece63a8688f9df5edf8fe859bf67b410148ea64a
34 +DIST openssl-1.1.0g.tar.gz 5404748 SHA256 de4d501267da39310905cb6dc8c6121f7a2cad45a7707f76df828fe1b85073af SHA512 6c76f698fc2a4540f3977d97c889e139acf7d3f9eb85f349974175e8a7707b19743ef91c5ce32839310b6ea06ca88a03d9709ee011687b4634c5c50b5814f42a WHIRLPOOL 86363a038df1621b9fbf634efec6648e0c35b882f7b582e6522a3869f8f5c67e32ed1a4637cb0009bf6fab4528072964cba5878540407306ea2e4210026c7a78
35
36 diff --git a/dev-libs/openssl/openssl-1.0.2m.ebuild b/dev-libs/openssl/openssl-1.0.2m.ebuild
37 new file mode 100644
38 index 00000000000..e47810140be
39 --- /dev/null
40 +++ b/dev-libs/openssl/openssl-1.0.2m.ebuild
41 @@ -0,0 +1,254 @@
42 +# Copyright 1999-2017 Gentoo Foundation
43 +# Distributed under the terms of the GNU General Public License v2
44 +
45 +EAPI="5"
46 +
47 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
48 +
49 +MY_P=${P/_/-}
50 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
51 +HOMEPAGE="https://www.openssl.org/"
52 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
53 +
54 +LICENSE="openssl"
55 +SLOT="0"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
57 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
58 +RESTRICT="!bindist? ( bindist )"
59 +
60 +RDEPEND=">=app-misc/c_rehash-1.7-r1
61 + gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
62 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
63 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )"
64 +DEPEND="${RDEPEND}
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 + )"
71 +PDEPEND="app-misc/ca-certificates"
72 +
73 +S="${WORKDIR}/${MY_P}"
74 +
75 +MULTILIB_WRAPPED_HEADERS=(
76 + usr/include/openssl/opensslconf.h
77 +)
78 +
79 +src_prepare() {
80 + # keep this in sync with app-misc/c_rehash
81 + SSL_CNF_DIR="/etc/ssl"
82 +
83 + # Make sure we only ever touch Makefile.org and avoid patching a file
84 + # that gets blown away anyways by the Configure script in src_configure
85 + rm -f Makefile
86 +
87 + if ! use vanilla ; then
88 + epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
89 + epatch "${FILESDIR}"/${PN}-1.0.2i-parallel-build.patch
90 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
91 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
92 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch #545028
93 + epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
94 + epatch "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
95 + epatch "${FILESDIR}"/${PN}-1.0.1p-default-source.patch #554338
96 +
97 + epatch_user #332661
98 + fi
99 +
100 + # disable fips in the build
101 + # make sure the man pages are suffixed #302165
102 + # don't bother building man pages if they're disabled
103 + sed -i \
104 + -e '/DIRS/s: fips : :g' \
105 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
106 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
107 + -e $(has noman FEATURES \
108 + && echo '/^install:/s:install_docs::' \
109 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
110 + Makefile.org \
111 + || die
112 + # show the actual commands in the log
113 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
114 +
115 + # since we're forcing $(CC) as makedep anyway, just fix
116 + # the conditional as always-on
117 + # helps clang (#417795), and versioned gcc (#499818)
118 + sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
119 +
120 + # quiet out unknown driver argument warnings since openssl
121 + # doesn't have well-split CFLAGS and we're making it even worse
122 + # and 'make depend' uses -Werror for added fun (#417795 again)
123 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
124 +
125 + # allow openssl to be cross-compiled
126 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
127 + chmod a+rx gentoo.config
128 +
129 + append-flags -fno-strict-aliasing
130 + append-flags $(test-flags-CC -Wa,--noexecstack)
131 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
132 +
133 + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
134 + # The config script does stupid stuff to prompt the user. Kill it.
135 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
136 + ./config --test-sanity || die "I AM NOT SANE"
137 +
138 + multilib_copy_sources
139 +}
140 +
141 +multilib_src_configure() {
142 + unset APPS #197996
143 + unset SCRIPTS #312551
144 + unset CROSS_COMPILE #311473
145 +
146 + tc-export CC AR RANLIB RC
147 +
148 + # Clean out patent-or-otherwise-encumbered code
149 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
150 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
151 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
152 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
153 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
154 +
155 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
156 + echoit() { echo "$@" ; "$@" ; }
157 +
158 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
159 +
160 + # See if our toolchain supports __uint128_t. If so, it's 64bit
161 + # friendly and can use the nicely optimized code paths. #460790
162 + local ec_nistp_64_gcc_128
163 + # Disable it for now though #469976
164 + #if ! use bindist ; then
165 + # echo "__uint128_t i;" > "${T}"/128.c
166 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
167 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
168 + # fi
169 + #fi
170 +
171 + # https://github.com/openssl/openssl/issues/2286
172 + if use ia64 ; then
173 + replace-flags -g3 -g2
174 + replace-flags -ggdb3 -ggdb2
175 + fi
176 +
177 + local sslout=$(./gentoo.config)
178 + einfo "Use configuration ${sslout:-(openssl knows best)}"
179 + local config="Configure"
180 + [[ -z ${sslout} ]] && config="config"
181 +
182 + echoit \
183 + ./${config} \
184 + ${sslout} \
185 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
186 + enable-camellia \
187 + $(use_ssl !bindist ec) \
188 + ${ec_nistp_64_gcc_128} \
189 + enable-idea \
190 + enable-mdc2 \
191 + enable-rc5 \
192 + enable-tlsext \
193 + $(use_ssl asm) \
194 + $(use_ssl gmp gmp -lgmp) \
195 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
196 + $(use_ssl rfc3779) \
197 + $(use_ssl sctp) \
198 + $(use_ssl sslv2 ssl2) \
199 + $(use_ssl sslv3 ssl3) \
200 + $(use_ssl tls-heartbeat heartbeats) \
201 + $(use_ssl zlib) \
202 + --prefix="${EPREFIX}"/usr \
203 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
204 + --libdir=$(get_libdir) \
205 + shared threads \
206 + || die
207 +
208 + # Clean out hardcoded flags that openssl uses
209 + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
210 + -e 's:^CFLAG=::' \
211 + -e 's:-fomit-frame-pointer ::g' \
212 + -e 's:-O[0-9] ::g' \
213 + -e 's:-march=[-a-z0-9]* ::g' \
214 + -e 's:-mcpu=[-a-z0-9]* ::g' \
215 + -e 's:-m[a-z0-9]* ::g' \
216 + )
217 + sed -i \
218 + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
219 + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
220 + Makefile || die
221 +}
222 +
223 +multilib_src_compile() {
224 + # depend is needed to use $confopts; it also doesn't matter
225 + # that it's -j1 as the code itself serializes subdirs
226 + emake -j1 depend
227 + emake all
228 + # rehash is needed to prep the certs/ dir; do this
229 + # separately to avoid parallel build issues.
230 + emake rehash
231 +}
232 +
233 +multilib_src_test() {
234 + emake -j1 test
235 +}
236 +
237 +multilib_src_install() {
238 + emake INSTALL_PREFIX="${D}" install
239 +}
240 +
241 +multilib_src_install_all() {
242 + # openssl installs perl version of c_rehash by default, but
243 + # we provide a shell version via app-misc/c_rehash
244 + rm "${ED}"/usr/bin/c_rehash || die
245 +
246 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
247 + dohtml -r doc/*
248 + use rfc3779 && dodoc engines/ccgost/README.gost
249 +
250 + # This is crappy in that the static archives are still built even
251 + # when USE=static-libs. But this is due to a failing in the openssl
252 + # build system: the static archives are built as PIC all the time.
253 + # Only way around this would be to manually configure+compile openssl
254 + # twice; once with shared lib support enabled and once without.
255 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
256 +
257 + # create the certs directory
258 + dodir ${SSL_CNF_DIR}/certs
259 + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
260 + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
261 +
262 + # Namespace openssl programs to prevent conflicts with other man pages
263 + cd "${ED}"/usr/share/man
264 + local m d s
265 + for m in $(find . -type f | xargs grep -L '#include') ; do
266 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
267 + [[ ${m} == openssl.1* ]] && continue
268 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
269 + mv ${d}/{,ssl-}${m}
270 + # fix up references to renamed man pages
271 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
272 + ln -s ssl-${m} ${d}/openssl-${m}
273 + # locate any symlinks that point to this man page ... we assume
274 + # that any broken links are due to the above renaming
275 + for s in $(find -L ${d} -type l) ; do
276 + s=${s##*/}
277 + rm -f ${d}/${s}
278 + ln -s ssl-${m} ${d}/ssl-${s}
279 + ln -s ssl-${s} ${d}/openssl-${s}
280 + done
281 + done
282 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
283 +
284 + dodir /etc/sandbox.d #254521
285 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
286 +
287 + diropts -m0700
288 + keepdir ${SSL_CNF_DIR}/private
289 +}
290 +
291 +pkg_postinst() {
292 + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
293 + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
294 + eend $?
295 +}
296
297 diff --git a/dev-libs/openssl/openssl-1.1.0g.ebuild b/dev-libs/openssl/openssl-1.1.0g.ebuild
298 new file mode 100644
299 index 00000000000..c8df4c14330
300 --- /dev/null
301 +++ b/dev-libs/openssl/openssl-1.1.0g.ebuild
302 @@ -0,0 +1,240 @@
303 +# Copyright 1999-2017 Gentoo Foundation
304 +# Distributed under the terms of the GNU General Public License v2
305 +
306 +EAPI=5
307 +
308 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
309 +
310 +MY_P=${P/_/-}
311 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
312 +HOMEPAGE="http://www.openssl.org/"
313 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
314 +
315 +LICENSE="openssl"
316 +SLOT="0/1.1" # .so version of libssl/libcrypto
317 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
318 +IUSE="+asm bindist rfc3779 sctp cpu_flags_x86_sse2 static-libs test tls-heartbeat vanilla zlib"
319 +RESTRICT="!bindist? ( bindist )"
320 +
321 +RDEPEND=">=app-misc/c_rehash-1.7-r1
322 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
323 +DEPEND="${RDEPEND}
324 + >=dev-lang/perl-5
325 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
326 + test? (
327 + sys-apps/diffutils
328 + sys-devel/bc
329 + )"
330 +PDEPEND="app-misc/ca-certificates"
331 +
332 +S="${WORKDIR}/${MY_P}"
333 +
334 +MULTILIB_WRAPPED_HEADERS=(
335 + usr/include/openssl/opensslconf.h
336 +)
337 +
338 +PATCHES=(
339 + "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
340 +)
341 +
342 +src_prepare() {
343 + # keep this in sync with app-misc/c_rehash
344 + SSL_CNF_DIR="/etc/ssl"
345 +
346 + # Make sure we only ever touch Makefile.org and avoid patching a file
347 + # that gets blown away anyways by the Configure script in src_configure
348 + rm -f Makefile
349 +
350 + if ! use vanilla ; then
351 + epatch "${PATCHES[@]}"
352 + epatch_user #332661
353 + fi
354 +
355 + # make sure the man pages are suffixed #302165
356 + # don't bother building man pages if they're disabled
357 + # Make DOCDIR Gentoo compliant
358 + sed -i \
359 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
360 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
361 + -e $(has noman FEATURES \
362 + && echo '/^install:/s:install_docs::' \
363 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
364 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PF}@" \
365 + Configurations/unix-Makefile.tmpl \
366 + || die
367 +
368 + # show the actual commands in the log
369 + sed -i '/^SET_X/s@=.*@=set -x@' Makefile.shared
370 +
371 + # quiet out unknown driver argument warnings since openssl
372 + # doesn't have well-split CFLAGS and we're making it even worse
373 + # and 'make depend' uses -Werror for added fun (#417795 again)
374 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
375 +
376 + # allow openssl to be cross-compiled
377 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
378 + chmod a+rx gentoo.config
379 +
380 + append-flags -fno-strict-aliasing
381 + append-flags $(test-flags-CC -Wa,--noexecstack)
382 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
383 +
384 + # Prefixify Configure shebang (#141906)
385 + sed \
386 + -e "1s,/usr/bin/env,${EPREFIX}&," \
387 + -i Configure || die
388 + # Remove test target when FEATURES=test isn't set
389 + if ! use test ; then
390 + sed \
391 + -e '/^$config{dirs}/s@ "test",@@' \
392 + -i Configure || die
393 + fi
394 + # The config script does stupid stuff to prompt the user. Kill it.
395 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
396 + ./config --test-sanity || die "I AM NOT SANE"
397 +
398 + multilib_copy_sources
399 +}
400 +
401 +multilib_src_configure() {
402 + unset APPS #197996
403 + unset SCRIPTS #312551
404 + unset CROSS_COMPILE #311473
405 +
406 + tc-export CC AR RANLIB RC
407 +
408 + # Clean out patent-or-otherwise-encumbered code
409 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
410 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
411 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
412 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
413 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
414 +
415 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
416 + echoit() { echo "$@" ; "$@" ; }
417 +
418 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
419 +
420 + # See if our toolchain supports __uint128_t. If so, it's 64bit
421 + # friendly and can use the nicely optimized code paths. #460790
422 + local ec_nistp_64_gcc_128
423 + # Disable it for now though #469976
424 + #if ! use bindist ; then
425 + # echo "__uint128_t i;" > "${T}"/128.c
426 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
427 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
428 + # fi
429 + #fi
430 +
431 + local sslout=$(./gentoo.config)
432 + einfo "Use configuration ${sslout:-(openssl knows best)}"
433 + local config="Configure"
434 + [[ -z ${sslout} ]] && config="config"
435 +
436 + echoit \
437 + ./${config} \
438 + ${sslout} \
439 + --api=1.0.0 \
440 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
441 + enable-camellia \
442 + disable-deprecated \
443 + $(use_ssl !bindist ec) \
444 + ${ec_nistp_64_gcc_128} \
445 + enable-idea \
446 + enable-mdc2 \
447 + enable-rc5 \
448 + $(use_ssl asm) \
449 + $(use_ssl rfc3779) \
450 + $(use_ssl sctp) \
451 + $(use_ssl tls-heartbeat heartbeats) \
452 + $(use_ssl zlib) \
453 + --prefix="${EPREFIX}"/usr \
454 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
455 + --libdir=$(get_libdir) \
456 + shared threads \
457 + || die
458 +
459 + # Clean out hardcoded flags that openssl uses
460 + # Fix quoting for sed
461 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
462 + -e 's:^CFLAGS=::' \
463 + -e 's:-fomit-frame-pointer ::g' \
464 + -e 's:-O[0-9] ::g' \
465 + -e 's:-march=[-a-z0-9]* ::g' \
466 + -e 's:-mcpu=[-a-z0-9]* ::g' \
467 + -e 's:-m[a-z0-9]* ::g' \
468 + -e 's:\\:\\\\:g' \
469 + )
470 + sed -i \
471 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
472 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
473 + Makefile || die
474 +}
475 +
476 +multilib_src_compile() {
477 + # depend is needed to use $confopts; it also doesn't matter
478 + # that it's -j1 as the code itself serializes subdirs
479 + emake -j1 depend
480 + emake all
481 +}
482 +
483 +multilib_src_test() {
484 + emake -j1 test
485 +}
486 +
487 +multilib_src_install() {
488 + emake DESTDIR="${D}" install
489 +}
490 +
491 +multilib_src_install_all() {
492 + # openssl installs perl version of c_rehash by default, but
493 + # we provide a shell version via app-misc/c_rehash
494 + rm "${ED}"/usr/bin/c_rehash || die
495 +
496 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
497 + dohtml -r doc/*
498 +
499 + # This is crappy in that the static archives are still built even
500 + # when USE=static-libs. But this is due to a failing in the openssl
501 + # build system: the static archives are built as PIC all the time.
502 + # Only way around this would be to manually configure+compile openssl
503 + # twice; once with shared lib support enabled and once without.
504 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
505 +
506 + # create the certs directory
507 + keepdir ${SSL_CNF_DIR}/certs
508 +
509 + # Namespace openssl programs to prevent conflicts with other man pages
510 + cd "${ED}"/usr/share/man
511 + local m d s
512 + for m in $(find . -type f | xargs grep -L '#include') ; do
513 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
514 + [[ ${m} == openssl.1* ]] && continue
515 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
516 + mv ${d}/{,ssl-}${m}
517 + # fix up references to renamed man pages
518 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
519 + ln -s ssl-${m} ${d}/openssl-${m}
520 + # locate any symlinks that point to this man page ... we assume
521 + # that any broken links are due to the above renaming
522 + for s in $(find -L ${d} -type l) ; do
523 + s=${s##*/}
524 + rm -f ${d}/${s}
525 + ln -s ssl-${m} ${d}/ssl-${s}
526 + ln -s ssl-${s} ${d}/openssl-${s}
527 + done
528 + done
529 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
530 +
531 + dodir /etc/sandbox.d #254521
532 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
533 +
534 + diropts -m0700
535 + keepdir ${SSL_CNF_DIR}/private
536 +}
537 +
538 +pkg_postinst() {
539 + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
540 + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
541 + eend $?
542 +}