Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: dev-libs/openssl/, dev-libs/openssl/files/
Date: Sun, 15 Sep 2019 18:42:35
Message-Id: 1568572939.e02d57b7ea578d206e577ab90788b3dbe6441e7c.grobian@gentoo
1 commit: e02d57b7ea578d206e577ab90788b3dbe6441e7c
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 15 18:42:19 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 15 18:42:19 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e02d57b7
7
8 dev-libs/openssl: sync (1.1.0l disabled, bug #694516)
9
10 Package-Manager: Portage-2.3.68-prefix, Repoman-2.3.17
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 dev-libs/openssl/Manifest | 6 +
14 .../openssl-0.9.8g-engines-installnames.patch | 6 +-
15 .../openssl-1.0.0b-darwin-bundle-compile-fix.patch | 12 +-
16 .../openssl/files/openssl-1.0.2a-aix-soname.patch | 8 +-
17 dev-libs/openssl/openssl-1.0.2t.ebuild | 322 +++++++++++++++++++++
18 dev-libs/openssl/openssl-1.1.0l.ebuild | 310 ++++++++++++++++++++
19 dev-libs/openssl/openssl-1.1.1d.ebuild | 310 ++++++++++++++++++++
20 7 files changed, 961 insertions(+), 13 deletions(-)
21
22 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
23 index ee4ab6891a..5442ba3658 100644
24 --- a/dev-libs/openssl/Manifest
25 +++ b/dev-libs/openssl/Manifest
26 @@ -3,14 +3,20 @@ DIST openssl-1.0.2r.tar.gz 5348369 BLAKE2B 9f9c2d2fe6eaf9acacab29b394a318f30c38e
27 DIST openssl-1.0.2r_ec_curve.c 17254 BLAKE2B d40d8d6e770443f07abe70e2c4ddda6aec1cc8e37dc1f226a3fdd9ed5d228f09c6d372e8956b1948b55ee1d57d1429493e7288d0f54d9466a37fec805c85aacb SHA512 8e92fb100bcf4bd918c82b9a6cbd75a55abe1a2c08230a007e441c51577f974f8cc336e9ac8a672b32641480428ca8cead5380da1fe81bacb088145a1b754a15
28 DIST openssl-1.0.2r_ectest.c 30735 BLAKE2B 95333a27f1cf0a4305a3cee7f6d46b9d4673582ca9acfcf5ba2a0d9d317ab6219cd0d2ff0ba3a55a317c8f5819342f05cc17ba80ec2c92b2b4cab9a3552382e1 SHA512 f2e4d34327b490bc8371f0845c69df3f9fc51ea16f0ea0de0411a0c1fa9d49bb2b6fafc363eb3b3cd919dc7c24e4a0d075c6ff878c01d70dae918f2540874c19
29 DIST openssl-1.0.2r_hobble-openssl 1302 BLAKE2B 647caa6a0f4c53a2e77baa3b8e5961eaef3bb0ff38e7d5475eab8deef3439f7fe49028ec9ed0406f3453870b62cac67c496b3a048ee4c9ff4c6866d520235960 SHA512 3d757a4708e74a03dd5cb9b8114dfe442ed9520739a6eca693be4c4265771696f1449ea06d1c9bcfc6e94fc9b0dd0c10e153f1c3b0334831c0550b36cd63326e
30 +DIST openssl-1.0.2t-bindist-1.0.tar.xz 13872 BLAKE2B b2aade96a6e0ca6209a39e205b1c838de945903fcf959c62cc29ddcd1a0cb360fc5db234df86860a6a4c096f5ecc237611e4c2946b986a5500c24ba93c208ef4 SHA512 a48a7efb9b973b865bcc5009d450b428ed6b4b95e4cefe70c51056e47392c8a7bec58215168d8b07712419dc74646c2bd2fd23bcfbba2031376e292249a6b1b6
31 +DIST openssl-1.0.2t.tar.gz 5355422 BLAKE2B dcbc883151ff6c5b60f5849d8789c2e76a384cb3d5eb5f08a6109776d0edf134580dc33fa8b946ae2344542560f04ecef17f218406952dd8d31e4200c4882022 SHA512 0b88868933f42fab87e8b22449435a1091cc6e75f986aad6c173e01ad123161fcae8c226759073701bc65c9f2f0b6ce6a63a61203008ed873cfb6e484f32bc71
32 DIST openssl-1.1.0-build_d2ede125556ac99aa0faa7744c703af3f559094e.patch 3001 BLAKE2B 8f0ac4be6409b4ec50bec171697da2aebe2688e8ae06bd0dfac8b0c74661d38ebeb0a12bde0ef941b213eee9b85965262213b140636060285dcfb02a3bd14961 SHA512 ec6710e9669ac19e4c6f1286c89a383e7d276a773a2740037f98a8f2dbf18305614e7d30d9ed530923a0e7d10a3776fea2ca77229adc25df13ecad55589a3673
33 DIST openssl-1.1.0-ec-curves_d2ede125556ac99aa0faa7744c703af3f559094e.patch 5311 BLAKE2B e9ec985adf6f13eb04412158a05da7cbe10be7d64bce73b899152ea379336ece7b7069089ef46993ac301ef850fd46fd0352898e249b2ea9fff5baf20896e5b5 SHA512 c38c4b05195f2b323a07efd8d17335ba2a168a16a59d7941da36568081f1c043da8d2216b7084b0617963635ded9bafeee736ecddbfa251cf0a02e4cba64cdc8
34 DIST openssl-1.1.0j.tar.gz 5411919 BLAKE2B 0fbd936f38d30b64bea717a67cd59704c5ce44ee19f377a820f89ba66b9e0a7509cf39e0fb00c104ae6440a6bd811e388239b458ffe685d8601235bab2afb2f1 SHA512 e7d30951ebb3cbcb6d59e3eb40f64f5a84634b7f5c380a588d378973f1c415395e3ab71a9aaff6478a89ec6efcc88f17f1882c99c25dcd18165f1435a51e5768
35 DIST openssl-1.1.0j_d2ede125556ac99aa0faa7744c703af3f559094e_ec_curve.c 18401 BLAKE2B f969071ac1b5d0e43b50d54e50b5c4d9201fc8b94458902e9849f14841b5505a2e43ed57a8c13255f042a211af9ee904776c155c36da838a8ad22e1052b02bc1 SHA512 a1c2bb3c3e3d342bddc8c952985e87fc4bad2e8142d5d760b18f346c44c20f00db61c4856f3dcf879b2098e0c036330762915f65d80a1a2cba717d2caeb95457
36 DIST openssl-1.1.0j_d2ede125556ac99aa0faa7744c703af3f559094e_ectest.c 30688 BLAKE2B 6673ef0fd139af82d830794179b19b9e06be25fac4a13b8bdfa5fd5dad25f594ce8eab118aab9ec2aab25001e1de127c03f8e1a04f4f3ef4c464b7fb1811ed4a SHA512 240fc72916caf4a8b0af774ce307abfe9a93a762eba6fae760cec79d619fe3db0d6919fc92a8951cb031f73958237700b45f590aa7f9f2890762cccda1f1e74b
37 DIST openssl-1.1.0j_d2ede125556ac99aa0faa7744c703af3f559094e_hobble-openssl 1117 BLAKE2B c3a1477e63331e83cf1cbe58e9ef131ec500a311e22d3da55034800ca353c387b2e202575acf3badb00b236ff91d4bac1bb131a33930939646d26bec27be6e04 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826
38 +DIST openssl-1.1.0k-bindist-1.0.tar.xz 11716 BLAKE2B c491ba0899c44dbcc63f85b255548c439c965a20a04ac2a6324a4122c4691b7c95ec18e62be6d708a7ea62ea197d32e5091987cb5043969878f89e5bc26243d4 SHA512 1d5bc9d7b24cf55d32d996e2421d43a1218b605720293f00d07814afb481387856f0dc000ad3c3e4cba2361055668cfe79a945be44ab85a249555f37e683a909
39 +DIST openssl-1.1.0l.tar.gz 5294857 BLAKE2B 0e4f30f9e8a22414325bd780dc4e875e962487fbe72967f0392ace959955429192541881a98d097d7bb75ed7238b1817b0c3c2c4da04421512bd538f2b07cdd7 SHA512 81b74149f40ea7d9f7e235820a4f977844653ad1e2b302e65e712c12193f47542fe7e3385fd1e25e3dd074e4e6d04199836cbc492656f5a7692edab5e234f4ad
40 DIST openssl-1.1.1-ec-curves.patch 7265 BLAKE2B 04725d226c430132cf54afbfaa30a82f8f8bbfd3608823d1d0cd42c3c13f417e90762759da3134d7b0c4373e531925db337b681340f2f284cb2f16a4caef22e3 SHA512 de4d0f1635740c57217836a476c420141c0d34a5f90cbf7957aed7a80e7ac9ca036de2d8448e6bf4c122999e308730575899f61cea6e51ab6825dd04890d75a1
41 DIST openssl-1.1.1b.tar.gz 8213737 BLAKE2B 7ad9da9548052e2a033a684038f97c420cfffd57994604bcb3fa12640796c8c0aea3d24fb05648ee4940fbec40b81462e81c353da5a41a2575c0585d9718eae8 SHA512 b54025fbb4fe264466f3b0d762aad4be45bd23cd48bdb26d901d4c41a40bfd776177e02230995ab181a695435039dbad313f4b9a563239a70807a2e19ecf045d
42 DIST openssl-1.1.1b_ec_curve.c 17938 BLAKE2B d5cbde40dcd8608087aed6ffa9feb040ffadecf0c46b7f3978cc468a9503f0a5ad0a426ea6f8db56f49a64474a508bebdf946e01ebf09adc727675f3b180bcdc SHA512 ec470f6514cb9a4f680b8cbbe02e2bbe71639b288f3429d976726047901d9c50377dfb2737f32429da2fb0e52fd67878a86debb54520e307ee196d97b5c66415
43 DIST openssl-1.1.1b_ectest.c 35091 BLAKE2B a9602255ab529751c2af2419206ce113f03f93b7b776691ea2ec550f26ddbecd241844bb81dc86988fdbb1c0a587318f82ce4faecba1a6142a19cf08d40fb2c5 SHA512 7813d9b6b7ab62119a7f2dd5431c17c5839f4c320ac7071b0714c9b8528bda5fda779dbb263328dca6ee8446e9fa09c663da659c9a82832a65cf53d1cd8a4cef
44 DIST openssl-1.1.1b_hobble-openssl 1117 BLAKE2B c3a1477e63331e83cf1cbe58e9ef131ec500a311e22d3da55034800ca353c387b2e202575acf3badb00b236ff91d4bac1bb131a33930939646d26bec27be6e04 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826
45 +DIST openssl-1.1.1d-bindist-1.0.tar.xz 13180 BLAKE2B 680bd7400d3dd3930067ee7efa9718b74b30afa9be2397ad80f88031920806b6603b6469beede02b6e7a742abf5f82ebdd7c9b8e69c1ffe223e4860dc9581128 SHA512 9e4296326852010d5cebc204d1a34a34198d8d65460bc91a2bd37c80be892a5ae519513e4b0109e6b51b6faab0e171ef6cdae868868c158711558d147083c06f
46 +DIST openssl-1.1.1d.tar.gz 8845861 BLAKE2B d3155f07b487ebd8dd4fe25396c874f9af18b5cfd7e622298d29c4f2c8ce14ad4534609d321314a4bcd0d44414e1306190340daaacd3c8fca061c04498446244 SHA512 2bc9f528c27fe644308eb7603c992bac8740e9f0c3601a130af30c9ffebbf7e0f5c28b76a00bbb478bad40fbe89b4223a58d604001e1713da71ff4b7fe6a08a7
47
48 diff --git a/dev-libs/openssl/files/openssl-0.9.8g-engines-installnames.patch b/dev-libs/openssl/files/openssl-0.9.8g-engines-installnames.patch
49 index f748ef7ce9..8673e0612b 100644
50 --- a/dev-libs/openssl/files/openssl-0.9.8g-engines-installnames.patch
51 +++ b/dev-libs/openssl/files/openssl-0.9.8g-engines-installnames.patch
52 @@ -1,9 +1,9 @@
53 * grobian@g.o: shared objects, even when disguised as .so files,
54 need to have a proper install_name in order to
55 - work without getting trapped by the kernel
56 + work without getting trapped by the kernel
57
58 ---- Makefile.shared
59 -+++ Makefile.shared
60 +--- a/Makefile.shared
61 ++++ b/Makefile.shared
62 @@ -213,6 +213,7 @@
63 if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
64 SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
65
66 diff --git a/dev-libs/openssl/files/openssl-1.0.0b-darwin-bundle-compile-fix.patch b/dev-libs/openssl/files/openssl-1.0.0b-darwin-bundle-compile-fix.patch
67 index e31d57c22a..c865de6799 100644
68 --- a/dev-libs/openssl/files/openssl-1.0.0b-darwin-bundle-compile-fix.patch
69 +++ b/dev-libs/openssl/files/openssl-1.0.0b-darwin-bundle-compile-fix.patch
70 @@ -1,5 +1,5 @@
71 ---- Makefile.shared
72 -+++ Makefile.shared
73 +--- a/Makefile.shared
74 ++++ b/Makefile.shared
75 @@ -226,7 +226,7 @@
76 link_o.darwin:
77 @ $(CALC_VERSIONS); \
78 @@ -18,8 +18,8 @@
79 $(LINK_SO_O)
80 link_a.darwin:
81 @ $(CALC_VERSIONS); \
82 ---- engines/Makefile
83 -+++ engines/Makefile
84 +--- a/engines/Makefile
85 ++++ b/engines/Makefile
86 @@ -114,7 +114,12 @@
87 if [ "$(PLATFORM)" != "Cygwin" ]; then \
88 case "$(CFLAGS)" in \
89 @@ -34,8 +34,8 @@
90 *DSO_DL*) sfx=".sl";; \
91 *DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
92 *) sfx=".bad";; \
93 ---- engines/ccgost/Makefile
94 -+++ engines/ccgost/Makefile
95 +--- a/engines/ccgost/Makefile
96 ++++ b/engines/ccgost/Makefile
97 @@ -48,7 +48,12 @@
98 if [ "$(PLATFORM)" != "Cygwin" ]; then \
99 case "$(CFLAGS)" in \
100
101 diff --git a/dev-libs/openssl/files/openssl-1.0.2a-aix-soname.patch b/dev-libs/openssl/files/openssl-1.0.2a-aix-soname.patch
102 index 93f0fdcbba..a2fcca4cf9 100644
103 --- a/dev-libs/openssl/files/openssl-1.0.2a-aix-soname.patch
104 +++ b/dev-libs/openssl/files/openssl-1.0.2a-aix-soname.patch
105 @@ -1,5 +1,5 @@
106 ---- Configure
107 -+++ Configure
108 +--- a/Configure
109 ++++ b/Configure
110 @@ -967,6 +967,10 @@
111 {
112 $cross_compile_prefix=$1;
113 @@ -22,8 +22,8 @@
114 if (!$no_shared)
115 {
116 if ($shared_cflag ne "")
117 ---- Makefile.shared
118 -+++ Makefile.shared
119 +--- a/Makefile.shared
120 ++++ b/Makefile.shared
121 @@ -545,6 +545,38 @@
122 NOALLSYMSFLAGS=''; \
123 SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
124
125 diff --git a/dev-libs/openssl/openssl-1.0.2t.ebuild b/dev-libs/openssl/openssl-1.0.2t.ebuild
126 new file mode 100644
127 index 0000000000..324a0685df
128 --- /dev/null
129 +++ b/dev-libs/openssl/openssl-1.0.2t.ebuild
130 @@ -0,0 +1,322 @@
131 +# Copyright 1999-2019 Gentoo Authors
132 +# Distributed under the terms of the GNU General Public License v2
133 +
134 +EAPI="7"
135 +
136 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal
137 +
138 +# openssl-1.0.2-patches-1.6 contain additional CVE patches
139 +# which got fixed with this release.
140 +# Please use 1.7 version number when rolling a new tarball!
141 +PATCH_SET="openssl-1.0.2-patches-1.5"
142 +
143 +MY_P=${P/_/-}
144 +
145 +# This patch set is based on the following files from Fedora 25,
146 +# see https://src.fedoraproject.org/rpms/openssl/blob/25/f/openssl.spec
147 +# for more details:
148 +# - hobble-openssl (SOURCE1)
149 +# - ec_curve.c (SOURCE12) -- MODIFIED
150 +# - ectest.c (SOURCE13)
151 +# - openssl-1.1.1-ec-curves.patch (PATCH37) -- MODIFIED
152 +BINDIST_PATCH_SET="openssl-1.0.2t-bindist-1.0.tar.xz"
153 +
154 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
155 +HOMEPAGE="https://www.openssl.org/"
156 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
157 + bindist? (
158 + mirror://gentoo/${BINDIST_PATCH_SET}
159 + https://dev.gentoo.org/~whissi/dist/openssl/${BINDIST_PATCH_SET}
160 + )
161 + !vanilla? (
162 + mirror://gentoo/${PATCH_SET}.tar.xz
163 + https://dev.gentoo.org/~chutzpah/dist/${PN}/${PATCH_SET}.tar.xz
164 + https://dev.gentoo.org/~whissi/dist/${PN}/${PATCH_SET}.tar.xz
165 + https://dev.gentoo.org/~polynomial-c/dist/${PATCH_SET}.tar.xz
166 + )"
167 +
168 +LICENSE="openssl"
169 +SLOT="0"
170 +KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
171 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
172 +RESTRICT="!bindist? ( bindist )"
173 +
174 +MY_PKGINSTDEPS=">=app-misc/c_rehash-1.7-r1"
175 +RDEPEND="!prefix-stack? ( ${MY_PKGINSTDEPS} )
176 + gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
177 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
178 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
179 +DEPEND="${RDEPEND}
180 + prefix-stack? ( ${MY_PKGINSTDEPS} )
181 + >=dev-lang/perl-5
182 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
183 + test? (
184 + sys-apps/diffutils
185 + sys-devel/bc
186 + )"
187 +PDEPEND="app-misc/ca-certificates"
188 +
189 +S="${WORKDIR}/${MY_P}"
190 +
191 +MULTILIB_WRAPPED_HEADERS=(
192 + usr/include/openssl/opensslconf.h
193 +)
194 +
195 +src_prepare() {
196 + if use bindist; then
197 + mv "${WORKDIR}"/bindist-patches/hobble-openssl "${WORKDIR}" || die
198 + bash "${WORKDIR}"/hobble-openssl || die
199 +
200 + cp -f "${WORKDIR}"/bindist-patches/ec_curve.c "${S}"/crypto/ec/ || die
201 + cp -f "${WORKDIR}"/bindist-patches/ectest.c "${S}"/crypto/ec/ || die
202 +
203 + eapply "${WORKDIR}"/bindist-patches/ec-curves.patch
204 +
205 + # Also see the configure parts below:
206 + # enable-ec \
207 + # $(use_ssl !bindist ec2m) \
208 + # $(use_ssl !bindist srp) \
209 + fi
210 +
211 + # keep this in sync with app-misc/c_rehash
212 + SSL_CNF_DIR="/etc/ssl"
213 +
214 + # Make sure we only ever touch Makefile.org and avoid patching a file
215 + # that gets blown away anyways by the Configure script in src_configure
216 + rm -f Makefile
217 +
218 + if ! use vanilla ; then
219 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
220 + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
221 + fi
222 + fi
223 +
224 + eapply_user
225 +
226 + # <=Solaris-10 /bin/sh does not support "[ -e file ]", added by patches
227 + sed -e 's/\[ -e /\[ -r /' -i Makefile.shared
228 +
229 + # disable fips in the build
230 + # make sure the man pages are suffixed #302165
231 + # don't bother building man pages if they're disabled
232 + sed -i \
233 + -e '/DIRS/s: fips : :g' \
234 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
235 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
236 + -e $(has noman FEATURES \
237 + && echo '/^install:/s:install_docs::' \
238 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
239 + Makefile.org \
240 + || die
241 + # show the actual commands in the log
242 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
243 +
244 + eapply "${FILESDIR}"/${PN}-1.0.2a-aix-soname.patch # like libtool
245 + eapply "${FILESDIR}"/${PN}-0.9.8g-engines-installnames.patch
246 + eapply "${FILESDIR}"/${PN}-1.0.0b-darwin-bundle-compile-fix.patch
247 + eapply "${FILESDIR}"/${PN}-1.0.2l-winnt.patch # parity
248 +
249 + # remove -arch for Darwin
250 + sed -i '/^"darwin/s,-arch [^ ]\+,,g' Configure || die
251 +
252 + # since we're forcing $(CC) as makedep anyway, just fix
253 + # the conditional as always-on
254 + # helps clang (#417795), and versioned gcc (#499818)
255 + # this breaks build with 1.0.2p, not sure if it is needed anymore
256 + #sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
257 +
258 + # quiet out unknown driver argument warnings since openssl
259 + # doesn't have well-split CFLAGS and we're making it even worse
260 + # and 'make depend' uses -Werror for added fun (#417795 again)
261 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
262 +
263 + # allow openssl to be cross-compiled
264 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
265 + chmod a+rx gentoo.config || die
266 +
267 + append-flags -fno-strict-aliasing
268 + append-flags $(test-flags-CC -Wa,--noexecstack)
269 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
270 +
271 + sed -i '1s,^:$,#!'"$(type -P perl)"',' Configure #141906
272 + # The config script does stupid stuff to prompt the user. Kill it.
273 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
274 + ./config --test-sanity || die "I AM NOT SANE"
275 +
276 + multilib_copy_sources
277 +}
278 +
279 +multilib_src_configure() {
280 + unset APPS #197996
281 + unset SCRIPTS #312551
282 + unset CROSS_COMPILE #311473
283 +
284 + tc-export CC AR RANLIB RC
285 +
286 + # Clean out patent-or-otherwise-encumbered code
287 + # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
288 + # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
289 + # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
290 + # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
291 + # RC5: Expired https://en.wikipedia.org/wiki/RC5
292 +
293 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
294 + echoit() { echo "$@" ; "$@" ; }
295 +
296 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
297 +
298 + # See if our toolchain supports __uint128_t. If so, it's 64bit
299 + # friendly and can use the nicely optimized code paths. #460790
300 + local ec_nistp_64_gcc_128
301 + # Disable it for now though #469976
302 + #if ! use bindist ; then
303 + # echo "__uint128_t i;" > "${T}"/128.c
304 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
305 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
306 + # fi
307 + #fi
308 +
309 + # https://github.com/openssl/openssl/issues/2286
310 + if use ia64 ; then
311 + replace-flags -g3 -g2
312 + replace-flags -ggdb3 -ggdb2
313 + fi
314 +
315 + local sslout=$(./gentoo.config)
316 + einfo "Use configuration ${sslout:-(openssl knows best)}"
317 + local config="Configure"
318 + [[ -z ${sslout} ]] && config="config"
319 +
320 + # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
321 + # Make sure user flags don't get added *yet* to avoid duplicated
322 + # flags.
323 + CFLAGS= LDFLAGS= echoit \
324 + ./${config} \
325 + ${sslout} \
326 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
327 + enable-camellia \
328 + enable-ec \
329 + $(use_ssl !bindist ec2m) \
330 + $(use_ssl !bindist srp) \
331 + ${ec_nistp_64_gcc_128} \
332 + enable-idea \
333 + enable-mdc2 \
334 + enable-rc5 \
335 + enable-tlsext \
336 + $(use_ssl asm) \
337 + $(use_ssl gmp gmp -lgmp) \
338 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
339 + $(use_ssl rfc3779) \
340 + $(use_ssl sctp) \
341 + $(use_ssl sslv2 ssl2) \
342 + $(use_ssl sslv3 ssl3) \
343 + $(use_ssl tls-heartbeat heartbeats) \
344 + $(use_ssl zlib) \
345 + --prefix="${EPREFIX}"/usr \
346 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
347 + --libdir=$(get_libdir) \
348 + shared threads \
349 + || die
350 +
351 + # Clean out hardcoded flags that openssl uses
352 + local DEFAULT_CFLAGS=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
353 + -e 's:^CFLAG=::' \
354 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
355 + -e 's:\(^\| \)-O[^ ]*::g' \
356 + -e 's:\(^\| \)-march=[^ ]*::g' \
357 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
358 + -e 's:\(^\| \)-m[^ ]*::g' \
359 + -e 's:^ *::' \
360 + -e 's: *$::' \
361 + -e 's: \+: :g' \
362 + -e 's:\\:\\\\:g'
363 + )
364 +
365 + # Now insert clean default flags with user flags
366 + sed -i \
367 + -e "/^CFLAG/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
368 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
369 + Makefile || die
370 +}
371 +
372 +multilib_src_compile() {
373 + # depend is needed to use $confopts; it also doesn't matter
374 + # that it's -j1 as the code itself serializes subdirs
375 + emake -j1 V=1 depend
376 + emake all
377 + # rehash is needed to prep the certs/ dir; do this
378 + # separately to avoid parallel build issues.
379 + emake rehash
380 +}
381 +
382 +multilib_src_test() {
383 + emake -j1 test
384 +}
385 +
386 +multilib_src_install() {
387 + # We need to create $ED/usr on our own to avoid a race condition #665130
388 + if [[ ! -d "${ED}/usr" ]]; then
389 + # We can only create this directory once
390 + mkdir "${ED}"/usr || die
391 + fi
392 +
393 + emake INSTALL_PREFIX="${D}" install
394 +}
395 +
396 +multilib_src_install_all() {
397 + # openssl installs perl version of c_rehash by default, but
398 + # we provide a shell version via app-misc/c_rehash
399 + rm "${ED}"/usr/bin/c_rehash || die
400 +
401 + local -a DOCS=( CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el )
402 + einstalldocs
403 +
404 + use rfc3779 && dodoc engines/ccgost/README.gost
405 +
406 + # This is crappy in that the static archives are still built even
407 + # when USE=static-libs. But this is due to a failing in the openssl
408 + # build system: the static archives are built as PIC all the time.
409 + # Only way around this would be to manually configure+compile openssl
410 + # twice; once with shared lib support enabled and once without.
411 + use static-libs || find "${ED}"/usr/lib* -mindepth 1 -maxdepth 1 \
412 + -name "lib*.a" -not -name "*.dll.a" -not -name "*$(get_libname)" -delete
413 +
414 + # create the certs directory
415 + dodir ${SSL_CNF_DIR}/certs
416 + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
417 + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
418 +
419 + # Namespace openssl programs to prevent conflicts with other man pages
420 + cd "${ED}"/usr/share/man
421 + local m d s
422 + for m in $(find . -type f | xargs grep -L '#include') ; do
423 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
424 + [[ ${m} == openssl.1* ]] && continue
425 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
426 + mv ${d}/{,ssl-}${m}
427 + # fix up references to renamed man pages
428 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
429 + ln -s ssl-${m} ${d}/openssl-${m}
430 + # locate any symlinks that point to this man page ... we assume
431 + # that any broken links are due to the above renaming
432 + for s in $(find -L ${d} -type l) ; do
433 + s=${s##*/}
434 + rm -f ${d}/${s}
435 + ln -s ssl-${m} ${d}/ssl-${s}
436 + ln -s ssl-${s} ${d}/openssl-${s}
437 + done
438 + done
439 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
440 +
441 + dodir /etc/sandbox.d #254521
442 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
443 +
444 + diropts -m0700
445 + keepdir ${SSL_CNF_DIR}/private
446 +}
447 +
448 +pkg_postinst() {
449 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
450 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
451 + eend $?
452 +}
453
454 diff --git a/dev-libs/openssl/openssl-1.1.0l.ebuild b/dev-libs/openssl/openssl-1.1.0l.ebuild
455 new file mode 100644
456 index 0000000000..f9d64c8261
457 --- /dev/null
458 +++ b/dev-libs/openssl/openssl-1.1.0l.ebuild
459 @@ -0,0 +1,310 @@
460 +# Copyright 1999-2019 Gentoo Authors
461 +# Distributed under the terms of the GNU General Public License v2
462 +
463 +EAPI="7"
464 +
465 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal
466 +
467 +MY_P=${P/_/-}
468 +
469 +# This patch set is based on the following files from Fedora 28,
470 +# see https://src.fedoraproject.org/rpms/openssl/blob/f28/f/openssl.spec
471 +# for more details:
472 +# - hobble-openssl (SOURCE1)
473 +# - ec_curve.c (SOURCE12) -- MODIFIED
474 +# - ectest.c (SOURCE13)
475 +# - openssl-1.1.0-ec-curves.patch (PATCH37) -- MODIFIED
476 +############# MISSING: FIX WHEN #694516 gets fixed: see KEYWORDS #############
477 +BINDIST_PATCH_SET="openssl-1.1.0k-bindist-1.0.tar.xz"
478 +
479 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
480 +HOMEPAGE="https://www.openssl.org/"
481 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
482 + bindist? (
483 + mirror://gentoo/${BINDIST_PATCH_SET}
484 + https://dev.gentoo.org/~whissi/dist/openssl/${BINDIST_PATCH_SET}
485 + )"
486 +
487 +LICENSE="openssl"
488 +SLOT="0/1.1" # .so version of libssl/libcrypto
489 +#KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
490 +IUSE="+asm bindist elibc_musl rfc3779 sctp cpu_flags_x86_sse2 sslv3 static-libs test tls-heartbeat vanilla zlib"
491 +RESTRICT="!bindist? ( bindist )"
492 +
493 +MY_PKGINSTDEPS=">=app-misc/c_rehash-1.7-r1"
494 +RDEPEND="!prefix-stack? ( ${MY_PKGINSTDEPS} )
495 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
496 +DEPEND="${RDEPEND}
497 + prefix-stack? ( ${MY_PKGINSTDEPS} )"
498 +BDEPEND="
499 + >=dev-lang/perl-5
500 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
501 + test? (
502 + sys-apps/diffutils
503 + sys-devel/bc
504 + )"
505 +PDEPEND="app-misc/ca-certificates"
506 +
507 +PATCHES=(
508 + "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
509 + "${FILESDIR}"/${PN}-1.1.0j-parallel_install_fix.patch #671602
510 + "${FILESDIR}"/${PN}-1.1.0k-fix-test_fuzz.patch
511 +)
512 +
513 +S="${WORKDIR}/${MY_P}"
514 +
515 +MULTILIB_WRAPPED_HEADERS=(
516 + usr/include/openssl/opensslconf.h
517 +)
518 +
519 +src_prepare() {
520 + if use bindist; then
521 + mv "${WORKDIR}"/bindist-patches/hobble-openssl "${WORKDIR}" || die
522 + bash "${WORKDIR}"/hobble-openssl || die
523 +
524 + cp -f "${WORKDIR}"/bindist-patches/ec_curve.c "${S}"/crypto/ec/ || die
525 + cp -f "${WORKDIR}"/bindist-patches/ectest.c "${S}"/test/ || die
526 +
527 + eapply "${WORKDIR}"/bindist-patches/ec-curves.patch
528 +
529 + local known_failing_test
530 + for known_failing_test in \
531 + 30-test_evp_extra.t \
532 + 80-test_ssl_new.t \
533 + ; do
534 + ebegin "Disabling test '${known_failing_test}' which is known to fail with USE=bindist"
535 + rm test/recipes/${known_failing_test} || die
536 + eend $?
537 + done
538 +
539 + # Also see the configure parts below:
540 + # enable-ec \
541 + # $(use_ssl !bindist ec2m) \
542 + fi
543 +
544 + # keep this in sync with app-misc/c_rehash
545 + SSL_CNF_DIR="/etc/ssl"
546 +
547 + # Make sure we only ever touch Makefile.org and avoid patching a file
548 + # that gets blown away anyways by the Configure script in src_configure
549 + rm -f Makefile
550 +
551 + if ! use vanilla ; then
552 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
553 + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
554 + fi
555 +
556 + use bindist || eapply "${FILESDIR}"/${PN}-1.1.0l-fix-no-ec2m-in-ec_curve.c.patch
557 + fi
558 +
559 + eapply_user #332661
560 +
561 + # make sure the man pages are suffixed #302165
562 + # don't bother building man pages if they're disabled
563 + # Make DOCDIR Gentoo compliant
564 + sed -i \
565 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
566 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
567 + -e $(has noman FEATURES \
568 + && echo '/^install:/s:install_docs::' \
569 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
570 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
571 + Configurations/unix-Makefile.tmpl \
572 + || die
573 +
574 + # show the actual commands in the log
575 + sed -i '/^SET_X/s@=.*@=set -x@' Makefile.shared || die
576 +
577 + # quiet out unknown driver argument warnings since openssl
578 + # doesn't have well-split CFLAGS and we're making it even worse
579 + # and 'make depend' uses -Werror for added fun (#417795 again)
580 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
581 +
582 + # allow openssl to be cross-compiled
583 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
584 + chmod a+rx gentoo.config || die
585 +
586 + append-flags -fno-strict-aliasing
587 + append-flags $(test-flags-CC -Wa,--noexecstack)
588 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
589 +
590 + # Prefixify Configure shebang (#141906), need to
591 + # search PATH for EAPI 7 cross prefix situations.
592 + sed \
593 + -e "1s,/usr/bin/env,$(type -P env)," \
594 + -i Configure || die
595 + # Remove test target when FEATURES=test isn't set
596 + if ! use test ; then
597 + sed \
598 + -e '/^$config{dirs}/s@ "test",@@' \
599 + -i Configure || die
600 + fi
601 + # The config script does stupid stuff to prompt the user. Kill it.
602 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
603 + ./config --test-sanity || die "I AM NOT SANE"
604 +
605 + multilib_copy_sources
606 +}
607 +
608 +multilib_src_configure() {
609 + unset APPS #197996
610 + unset SCRIPTS #312551
611 + unset CROSS_COMPILE #311473
612 +
613 + tc-export CC AR RANLIB RC
614 +
615 + # Clean out patent-or-otherwise-encumbered code
616 + # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
617 + # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
618 + # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
619 + # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
620 + # RC5: Expired https://en.wikipedia.org/wiki/RC5
621 +
622 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
623 + echoit() { echo "$@" ; "$@" ; }
624 +
625 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
626 +
627 + # See if our toolchain supports __uint128_t. If so, it's 64bit
628 + # friendly and can use the nicely optimized code paths. #460790
629 + local ec_nistp_64_gcc_128
630 + # Disable it for now though #469976
631 + #if ! use bindist ; then
632 + # echo "__uint128_t i;" > "${T}"/128.c
633 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
634 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
635 + # fi
636 + #fi
637 +
638 + local sslout=$(./gentoo.config)
639 + einfo "Use configuration ${sslout:-(openssl knows best)}"
640 + local config="Configure"
641 + [[ -z ${sslout} ]] && config="config"
642 +
643 + # Fedora hobbled-EC needs 'no-ec2m'
644 + # 'srp' was restricted until early 2017 as well.
645 + # "disable-deprecated" option breaks too many consumers.
646 + # Don't set it without thorough revdeps testing.
647 + # Make sure user flags don't get added *yet* to avoid duplicated
648 + # flags.
649 + CFLAGS= LDFLAGS= echoit \
650 + ./${config} \
651 + ${sslout} \
652 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
653 + enable-camellia \
654 + enable-ec \
655 + $(use_ssl !bindist ec2m) \
656 + enable-srp \
657 + $(use elibc_musl && echo "no-async") \
658 + ${ec_nistp_64_gcc_128} \
659 + enable-idea \
660 + enable-mdc2 \
661 + enable-rc5 \
662 + $(use_ssl sslv3 ssl3) \
663 + $(use_ssl sslv3 ssl3-method) \
664 + $(use_ssl asm) \
665 + $(use_ssl rfc3779) \
666 + $(use_ssl sctp) \
667 + $(use_ssl tls-heartbeat heartbeats) \
668 + $(use_ssl zlib) \
669 + --prefix="${EPREFIX}"/usr \
670 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
671 + --libdir=$(get_libdir) \
672 + shared threads \
673 + || die
674 +
675 + # Clean out hardcoded flags that openssl uses
676 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
677 + -e 's:^CFLAGS=::' \
678 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
679 + -e 's:\(^\| \)-O[^ ]*::g' \
680 + -e 's:\(^\| \)-march=[^ ]*::g' \
681 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
682 + -e 's:\(^\| \)-m[^ ]*::g' \
683 + -e 's:^ *::' \
684 + -e 's: *$::' \
685 + -e 's: \+: :g' \
686 + -e 's:\\:\\\\:g'
687 + )
688 +
689 + # Now insert clean default flags with user flags
690 + sed -i \
691 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
692 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
693 + Makefile || die
694 +}
695 +
696 +multilib_src_compile() {
697 + # depend is needed to use $confopts; it also doesn't matter
698 + # that it's -j1 as the code itself serializes subdirs
699 + emake -j1 depend
700 + emake all
701 +}
702 +
703 +multilib_src_test() {
704 + emake -j1 test
705 +}
706 +
707 +multilib_src_install() {
708 + # We need to create $ED/usr on our own to avoid a race condition #665130
709 + if [[ ! -d "${ED}/usr" ]]; then
710 + # We can only create this directory once
711 + mkdir "${ED}"/usr || die
712 + fi
713 +
714 + emake DESTDIR="${D}" install
715 +}
716 +
717 +multilib_src_install_all() {
718 + # openssl installs perl version of c_rehash by default, but
719 + # we provide a shell version via app-misc/c_rehash
720 + rm "${ED}"/usr/bin/c_rehash || die
721 +
722 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
723 +
724 + # This is crappy in that the static archives are still built even
725 + # when USE=static-libs. But this is due to a failing in the openssl
726 + # build system: the static archives are built as PIC all the time.
727 + # Only way around this would be to manually configure+compile openssl
728 + # twice; once with shared lib support enabled and once without.
729 + use static-libs || find "${ED}"/usr/lib* -mindepth 1 -maxdepth 1 \
730 + -name "lib*.a" -not -name "*.dll.a" -not -name "*$(get_libname)" -delete
731 +
732 + # create the certs directory
733 + keepdir ${SSL_CNF_DIR}/certs
734 +
735 + # Namespace openssl programs to prevent conflicts with other man pages
736 + cd "${ED}"/usr/share/man || die
737 + local m d s
738 + for m in $(find . -type f | xargs grep -L '#include') ; do
739 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
740 + [[ ${m} == openssl.1* ]] && continue
741 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
742 + mv ${d}/{,ssl-}${m}
743 + # fix up references to renamed man pages
744 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
745 + ln -s ssl-${m} ${d}/openssl-${m}
746 + # locate any symlinks that point to this man page ... we assume
747 + # that any broken links are due to the above renaming
748 + for s in $(find -L ${d} -type l) ; do
749 + s=${s##*/}
750 + rm -f ${d}/${s}
751 + # We don't want to "|| die" here
752 + ln -s ssl-${m} ${d}/ssl-${s}
753 + ln -s ssl-${s} ${d}/openssl-${s}
754 + done
755 + done
756 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
757 +
758 + dodir /etc/sandbox.d #254521
759 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
760 +
761 + diropts -m0700
762 + keepdir ${SSL_CNF_DIR}/private
763 +}
764 +
765 +pkg_postinst() {
766 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
767 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
768 + eend $?
769 +}
770
771 diff --git a/dev-libs/openssl/openssl-1.1.1d.ebuild b/dev-libs/openssl/openssl-1.1.1d.ebuild
772 new file mode 100644
773 index 0000000000..b79d7747ba
774 --- /dev/null
775 +++ b/dev-libs/openssl/openssl-1.1.1d.ebuild
776 @@ -0,0 +1,310 @@
777 +# Copyright 1999-2019 Gentoo Authors
778 +# Distributed under the terms of the GNU General Public License v2
779 +
780 +EAPI="7"
781 +
782 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal
783 +
784 +MY_P=${P/_/-}
785 +
786 +# This patch set is based on the following files from Fedora 31,
787 +# see https://src.fedoraproject.org/rpms/openssl/blob/f31/f/openssl.spec
788 +# for more details:
789 +# - hobble-openssl (SOURCE1)
790 +# - ec_curve.c (SOURCE12) -- MODIFIED
791 +# - ectest.c (SOURCE13)
792 +# - openssl-1.1.1-ec-curves.patch (PATCH37) -- MODIFIED
793 +BINDIST_PATCH_SET="openssl-1.1.1d-bindist-1.0.tar.xz"
794 +
795 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
796 +HOMEPAGE="https://www.openssl.org/"
797 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
798 + bindist? (
799 + mirror://gentoo/${BINDIST_PATCH_SET}
800 + https://dev.gentoo.org/~whissi/dist/openssl/${BINDIST_PATCH_SET}
801 + )"
802 +
803 +LICENSE="openssl"
804 +SLOT="0/1.1" # .so version of libssl/libcrypto
805 +[[ "${PV}" = *_pre* ]] || \
806 +KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
807 +IUSE="+asm bindist elibc_musl rfc3779 sctp cpu_flags_x86_sse2 sslv3 static-libs test tls-heartbeat vanilla zlib"
808 +RESTRICT="!bindist? ( bindist )"
809 +
810 +MY_PKGINSTDEPS=">=app-misc/c_rehash-1.7-r1"
811 +RDEPEND="!prefix-stack? ( ${MY_PKGINSTDEPS} )
812 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
813 +DEPEND="${RDEPEND}
814 + prefix-stack? ( ${MY_PKGINSTDEPS} )"
815 +BDEPEND="
816 + >=dev-lang/perl-5
817 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
818 + test? (
819 + sys-apps/diffutils
820 + sys-devel/bc
821 + )"
822 +PDEPEND="app-misc/ca-certificates"
823 +
824 +PATCHES=(
825 + "${FILESDIR}"/${PN}-1.1.0j-parallel_install_fix.patch #671602
826 +)
827 +
828 +S="${WORKDIR}/${MY_P}"
829 +
830 +MULTILIB_WRAPPED_HEADERS=(
831 + usr/include/openssl/opensslconf.h
832 +)
833 +
834 +src_prepare() {
835 + if use bindist; then
836 + mv "${WORKDIR}"/bindist-patches/hobble-openssl "${WORKDIR}" || die
837 + bash "${WORKDIR}"/hobble-openssl || die
838 +
839 + cp -f "${WORKDIR}"/bindist-patches/ec_curve.c "${S}"/crypto/ec/ || die
840 + cp -f "${WORKDIR}"/bindist-patches/ectest.c "${S}"/test/ || die
841 +
842 + eapply "${WORKDIR}"/bindist-patches/ec-curves.patch
843 +
844 + local known_failing_test
845 + for known_failing_test in \
846 + 30-test_evp_extra.t \
847 + 80-test_ssl_new.t \
848 + ; do
849 + ebegin "Disabling test '${known_failing_test}' which is known to fail with USE=bindist"
850 + rm test/recipes/${known_failing_test} || die
851 + eend $?
852 + done
853 +
854 + # Also see the configure parts below:
855 + # enable-ec \
856 + # $(use_ssl !bindist ec2m) \
857 + fi
858 +
859 + # keep this in sync with app-misc/c_rehash
860 + SSL_CNF_DIR="/etc/ssl"
861 +
862 + # Make sure we only ever touch Makefile.org and avoid patching a file
863 + # that gets blown away anyways by the Configure script in src_configure
864 + rm -f Makefile
865 +
866 + if ! use vanilla ; then
867 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
868 + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
869 + fi
870 + fi
871 +
872 + eapply_user #332661
873 +
874 + # make sure the man pages are suffixed #302165
875 + # don't bother building man pages if they're disabled
876 + # Make DOCDIR Gentoo compliant
877 + sed -i \
878 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
879 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
880 + -e $(has noman FEATURES \
881 + && echo '/^install:/s:install_docs::' \
882 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
883 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
884 + Configurations/unix-Makefile.tmpl \
885 + || die
886 +
887 + # quiet out unknown driver argument warnings since openssl
888 + # doesn't have well-split CFLAGS and we're making it even worse
889 + # and 'make depend' uses -Werror for added fun (#417795 again)
890 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
891 +
892 + # allow openssl to be cross-compiled
893 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
894 + chmod a+rx gentoo.config || die
895 +
896 + append-flags -fno-strict-aliasing
897 + append-flags $(test-flags-CC -Wa,--noexecstack)
898 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
899 +
900 + # Prefixify Configure shebang (#141906), need to
901 + # search PATH for EAPI 7 cross prefix situations.
902 + sed \
903 + -e "1s,/usr/bin/env,$(type -P env)," \
904 + -i Configure || die
905 + # Remove test target when FEATURES=test isn't set
906 + if ! use test ; then
907 + sed \
908 + -e '/^$config{dirs}/s@ "test",@@' \
909 + -i Configure || die
910 + fi
911 + # use GNU ld full option, not to confuse it on Solaris
912 + sed -i \
913 + -e 's/-Wl,-M,/-Wl,--version-script=/' \
914 + -e 's/-Wl,-h,/-Wl,--soname=/' \
915 + Configurations/10-main.conf || die
916 + # The config script does stupid stuff to prompt the user. Kill it.
917 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
918 + # The MS Azure build agent does set SYSTEM=build. Ignore such vars.
919 + sed -i '1aunset MACHINE RELEASE SYSTEM VERSION' config || die
920 + ./config --test-sanity || die "I AM NOT SANE"
921 +
922 + multilib_copy_sources
923 +}
924 +
925 +multilib_src_configure() {
926 + unset APPS #197996
927 + unset SCRIPTS #312551
928 + unset CROSS_COMPILE #311473
929 +
930 + tc-export CC AR RANLIB RC
931 +
932 + # Clean out patent-or-otherwise-encumbered code
933 + # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
934 + # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
935 + # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
936 + # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
937 + # RC5: Expired https://en.wikipedia.org/wiki/RC5
938 +
939 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
940 + echoit() { echo "$@" ; "$@" ; }
941 +
942 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
943 +
944 + # See if our toolchain supports __uint128_t. If so, it's 64bit
945 + # friendly and can use the nicely optimized code paths. #460790
946 + local ec_nistp_64_gcc_128
947 + # Disable it for now though #469976
948 + #if ! use bindist ; then
949 + # echo "__uint128_t i;" > "${T}"/128.c
950 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
951 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
952 + # fi
953 + #fi
954 +
955 + local sslout=$(./gentoo.config)
956 + einfo "Use configuration ${sslout:-(openssl knows best)}"
957 + local config="Configure"
958 + [[ -z ${sslout} ]] && config="config"
959 +
960 + # Fedora hobbled-EC needs 'no-ec2m'
961 + # 'srp' was restricted until early 2017 as well.
962 + # "disable-deprecated" option breaks too many consumers.
963 + # Don't set it without thorough revdeps testing.
964 + # Make sure user flags don't get added *yet* to avoid duplicated
965 + # flags.
966 + CFLAGS= LDFLAGS= echoit \
967 + ./${config} \
968 + ${sslout} \
969 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
970 + enable-camellia \
971 + enable-ec \
972 + $(use_ssl !bindist ec2m) \
973 + enable-srp \
974 + $(use elibc_musl && echo "no-async") \
975 + ${ec_nistp_64_gcc_128} \
976 + enable-idea \
977 + enable-mdc2 \
978 + enable-rc5 \
979 + $(use_ssl sslv3 ssl3) \
980 + $(use_ssl sslv3 ssl3-method) \
981 + $(use_ssl asm) \
982 + $(use_ssl rfc3779) \
983 + $(use_ssl sctp) \
984 + $(use_ssl tls-heartbeat heartbeats) \
985 + $(use_ssl zlib) \
986 + --prefix="${EPREFIX}"/usr \
987 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
988 + --libdir=$(get_libdir) \
989 + shared threads \
990 + || die
991 +
992 + # Clean out hardcoded flags that openssl uses
993 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
994 + -e 's:^CFLAGS=::' \
995 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
996 + -e 's:\(^\| \)-O[^ ]*::g' \
997 + -e 's:\(^\| \)-march=[^ ]*::g' \
998 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
999 + -e 's:\(^\| \)-m[^ ]*::g' \
1000 + -e 's:^ *::' \
1001 + -e 's: *$::' \
1002 + -e 's: \+: :g' \
1003 + -e 's:\\:\\\\:g'
1004 + )
1005 +
1006 + # Now insert clean default flags with user flags
1007 + sed -i \
1008 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
1009 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
1010 + Makefile || die
1011 +}
1012 +
1013 +multilib_src_compile() {
1014 + # depend is needed to use $confopts; it also doesn't matter
1015 + # that it's -j1 as the code itself serializes subdirs
1016 + emake -j1 depend
1017 + emake all
1018 +}
1019 +
1020 +multilib_src_test() {
1021 + emake -j1 test
1022 +}
1023 +
1024 +multilib_src_install() {
1025 + # We need to create $ED/usr on our own to avoid a race condition #665130
1026 + if [[ ! -d "${ED}/usr" ]]; then
1027 + # We can only create this directory once
1028 + mkdir "${ED}"/usr || die
1029 + fi
1030 +
1031 + emake DESTDIR="${D}" install
1032 +}
1033 +
1034 +multilib_src_install_all() {
1035 + # openssl installs perl version of c_rehash by default, but
1036 + # we provide a shell version via app-misc/c_rehash
1037 + rm "${ED}"/usr/bin/c_rehash || die
1038 +
1039 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
1040 +
1041 + # This is crappy in that the static archives are still built even
1042 + # when USE=static-libs. But this is due to a failing in the openssl
1043 + # build system: the static archives are built as PIC all the time.
1044 + # Only way around this would be to manually configure+compile openssl
1045 + # twice; once with shared lib support enabled and once without.
1046 + use static-libs || find "${ED}"/usr/lib* -mindepth 1 -maxdepth 1 \
1047 + -name "lib*.a" -not -name "*.dll.a" -not -name "*$(get_libname)" -delete
1048 +
1049 + # create the certs directory
1050 + keepdir ${SSL_CNF_DIR}/certs
1051 +
1052 + # Namespace openssl programs to prevent conflicts with other man pages
1053 + cd "${ED}"/usr/share/man || die
1054 + local m d s
1055 + for m in $(find . -type f | xargs grep -L '#include') ; do
1056 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
1057 + [[ ${m} == openssl.1* ]] && continue
1058 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
1059 + mv ${d}/{,ssl-}${m}
1060 + # fix up references to renamed man pages
1061 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
1062 + ln -s ssl-${m} ${d}/openssl-${m}
1063 + # locate any symlinks that point to this man page ... we assume
1064 + # that any broken links are due to the above renaming
1065 + for s in $(find -L ${d} -type l) ; do
1066 + s=${s##*/}
1067 + rm -f ${d}/${s}
1068 + # We don't want to "|| die" here
1069 + ln -s ssl-${m} ${d}/ssl-${s}
1070 + ln -s ssl-${s} ${d}/openssl-${s}
1071 + done
1072 + done
1073 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
1074 +
1075 + dodir /etc/sandbox.d #254521
1076 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
1077 +
1078 + diropts -m0700
1079 + keepdir ${SSL_CNF_DIR}/private
1080 +}
1081 +
1082 +pkg_postinst() {
1083 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
1084 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
1085 + eend $?
1086 +}