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: Sun, 22 Oct 2017 21:51:43
Message-Id: 1508709088.acd5dfadfd157c7dcb73a3ff1f6295416a2ab04e.robbat2@gentoo
1 commit: acd5dfadfd157c7dcb73a3ff1f6295416a2ab04e
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 22 20:19:37 2017 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 22 21:51:28 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=acd5dfad
7
8 dev-libs/openssl: add Fedora Hobbled-EC for 1.0.
9
10 As resolved in the Foundation Trustees meeting 2017/10/22, and the
11 Licensing team, Fedora's Hobbled-EC patchset is added for USE=bindist in
12 OpenSSL 1.0 series.
13
14 This provides the subset of Elliptic Curve Cryptography that Fedora &
15 RedHat believe to be free of patent concerns at this time, and use for
16 their RPMs.
17
18 The patch disables or modifies:
19 - some Elliptic Curves
20 - some EC methods
21 - code that interacts the above
22
23 This code passes the upstream testsuite with:
24 FEATURES=test RESTRICT=bindist USE=test emerge =openssl-1.0.2l-r1
25
26 See-Also bdd5c9e7d6a375e99b3ae89afd4517a3a5786df2
27 Upstream: https://src.fedoraproject.org/cgit/rpms/openssl.git
28 Bug: https://bugs.gentoo.org/531540
29 Package-Manager: Portage-2.3.8, Repoman-2.3.3
30 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
31
32 dev-libs/openssl/Manifest | 3 +
33 dev-libs/openssl/openssl-1.0.2l-r1.ebuild | 296 ++++++++++++++++++++++++++++++
34 2 files changed, 299 insertions(+)
35
36 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
37 index a5c66ede427..732d1736742 100644
38 --- a/dev-libs/openssl/Manifest
39 +++ b/dev-libs/openssl/Manifest
40 @@ -1,6 +1,9 @@
41 DIST openssl-0.9.8zh.tar.gz 3818524 SHA256 f1d9f3ed1b85a82ecf80d0e2d389e1fda3fca9a4dba0bf07adbf231e1a5e2fd6 SHA512 b97fa2468211f86c0719c68ad1781eff84f772c479ed5193d6da14bac086b4ca706e7d851209d9df3f0962943b5e5333ab0def00110fb2e517caa73c0c6674c6 WHIRLPOOL 8ed3362e6aed89cd6ae02438bc3fb58ff3a91afb8a2d401d1d66c1ee4fd96f4befb50558131dd03a60fc15b588172fc1ede5d56bb1f68e184453bfe3b34f9abf
42 DIST openssl-1.0.2k.tar.gz 5309236 SHA256 6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0 SHA512 0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016 WHIRLPOOL ffa3d89a078db6829f1fff21779a19c87e059600162e6d7d3114b8440ba5fa7d1a08e04594b6ed8ab47e148782de299d7ec338f2ba2d466bf7737b0749f590cd
43 DIST openssl-1.0.2l.tar.gz 5365054 SHA256 ce07195b659e75f4e1db43552860070061f156a98bb37b672b101ba6e3ddf30c SHA512 047d964508ad6025c79caabd8965efd2416dc026a56183d0ef4de7a0a6769ce8e0b4608a3f8393d326f6d03b26a2b067e6e0c750f35b20be190e595e8290c0e3 WHIRLPOOL fa5b303fd7007eb2b7afe0b6a7d90a6676b738bf39addc1005f15a4664e61e72f9465d5020477abcf6b3e420d46a618e44751ad9e21671c70e5dbe8cdc768bfc
44 +DIST openssl-1.0.2l_ec_curve.c 17254 SHA256 43ad99527a9f494c97c1efd4a87b49508455437da5de1b9ecd89b0d36fb764c8 SHA512 8e92fb100bcf4bd918c82b9a6cbd75a55abe1a2c08230a007e441c51577f974f8cc336e9ac8a672b32641480428ca8cead5380da1fe81bacb088145a1b754a15 WHIRLPOOL 5a43777a2886a2e7bd41eeb3a96c90c62b0eaa771249a50eb5996993f43384dca5f24993ed6a6deede2c4f119f896fb11dbc26b72650c909c856bd8c313501f0
45 +DIST openssl-1.0.2l_ectest.c 30735 SHA256 14f12b1db5121f3f58466f52ad10555c038c281e90e53c0a2f7940a754bb4d80 SHA512 f2e4d34327b490bc8371f0845c69df3f9fc51ea16f0ea0de0411a0c1fa9d49bb2b6fafc363eb3b3cd919dc7c24e4a0d075c6ff878c01d70dae918f2540874c19 WHIRLPOOL 0d708b382d97e1f20a03e695f0a990fb9fd6cd8ab8ced29e072d52ca3f09f87d18c287d6134fd5ac2243ca541982f4d9eaa2fa8964d62b6b8f1a4b879e8fd997
46 +DIST openssl-1.0.2l_hobble-openssl 1302 SHA256 7ec32aab6a1db2124de52c3918cc7f7e487972581e30235447eed15d59415384 SHA512 3d757a4708e74a03dd5cb9b8114dfe442ed9520739a6eca693be4c4265771696f1449ea06d1c9bcfc6e94fc9b0dd0c10e153f1c3b0334831c0550b36cd63326e WHIRLPOOL b9630ce76492bff481d0bd48b72449d1e1d4fbb98c2387c4824d84833796adaba716e10976b3130eed9fd9442511a71604d9944600ba6be5253087f865cefe8c
47 DIST openssl-1.1.0-build.patch 3028 SHA256 c626ac8b34df5d55a7272a741f87f06dc06cc20ac80085048788a2c76c08c25f SHA512 b19a912900970052f80c67f28975e793ae9e70ebfc62efae0544e09931079e98c4cd29ce1cc8d937ceca97aff9a12fdc1ff9ce6c2b47fea68c79e7065464a0f0 WHIRLPOOL 950febb159139b145eb7de5bda1115465fa8551234182e6d15459ab5519213f515b4c3e3a3136d05c440d3eec04a7247461d36c2d45136a6f1963613d5896b3e
48 DIST openssl-1.1.0-ec-curves.patch 2967 SHA256 da60dfa01ed244cd3f77f60cc2ef479a36e64a58fa5e242aa03647c698cc1a42 SHA512 8fb9c6759ae2077ad3697ba77e85ab3970fd8b3f64b21eb260b4f6333b7ebf2f5a53c7eee311229edfbd96a2b904ec5e5e00dfa5b62cf1105fece13069077bd2 WHIRLPOOL e7293ef84f6c36e8e5f5ec8158023fdca484bc9082e73956bd0cc74a17c880350a49799146c855a37f116d743e7c93e54cbe4aa7f70483e235d03687a15a46a5
49 DIST openssl-1.1.0f.tar.gz 5278176 SHA256 12f746f3f2493b2f39da7ecf63d7ee19c6ac9ec6a4fcd8c229da8a522cb12765 SHA512 340ab3f38c90dea346e543b58bc0eff0adede15be212ad20b7cf38718a7f94fab51996da414855c180540f7488b8bd31d8b9a0d04bb19159f735c46d8f6df22c WHIRLPOOL bb4ce1d100c5eb567de0139e4a1c0a2bb1cd308bd014704d6bb796d3fcfc16b91fe69839068944831746e0b937a6ccb234b5cea3b4911fab4283500ed380f0b6
50
51 diff --git a/dev-libs/openssl/openssl-1.0.2l-r1.ebuild b/dev-libs/openssl/openssl-1.0.2l-r1.ebuild
52 new file mode 100644
53 index 00000000000..4c78a177bf6
54 --- /dev/null
55 +++ b/dev-libs/openssl/openssl-1.0.2l-r1.ebuild
56 @@ -0,0 +1,296 @@
57 +# Copyright 1999-2017 Gentoo Foundation
58 +# Distributed under the terms of the GNU General Public License v2
59 +
60 +EAPI="5"
61 +
62 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
63 +
64 +MY_P=${P/_/-}
65 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
66 +HOMEPAGE="http://www.openssl.org/"
67 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
68 +
69 +LICENSE="openssl"
70 +SLOT="0"
71 +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"
72 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
73 +RESTRICT="!bindist? ( bindist )"
74 +
75 +RDEPEND=">=app-misc/c_rehash-1.7-r1
76 + gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
77 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
78 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )"
79 +DEPEND="${RDEPEND}
80 + >=dev-lang/perl-5
81 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
82 + test? (
83 + sys-apps/diffutils
84 + sys-devel/bc
85 + )"
86 +PDEPEND="app-misc/ca-certificates"
87 +
88 +# This does not copy the entire Fedora patchset, but JUST the parts that
89 +# are needed to make it safe to use EC with RESTRICT=bindist.
90 +# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
91 +SOURCE1=hobble-openssl
92 +SOURCE12=ec_curve.c
93 +SOURCE13=ectest.c
94 +#PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
95 +#PATCH37=openssl-1.1.0-ec-curves.patch
96 +FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
97 +FEDORA_GIT_BRANCH='f25'
98 +FEDORA_SRC_URI=()
99 +FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
100 +FEDORA_PATCH=( $PATCH1 $PATCH37 )
101 +for i in "${FEDORA_SOURCE[@]}" ; do
102 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${P}_${i}" )
103 +done
104 +for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
105 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${i}" )
106 +done
107 +SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
108 +
109 +S="${WORKDIR}/${MY_P}"
110 +
111 +MULTILIB_WRAPPED_HEADERS=(
112 + usr/include/openssl/opensslconf.h
113 +)
114 +
115 +src_prepare() {
116 + if use bindist; then
117 + # This just removes the prefix, and puts it into WORKDIR like the RPM.
118 + for i in "${FEDORA_SOURCE[@]}" ; do
119 + cp -f "${DISTDIR}"/"${P}_${i}" "${WORKDIR}"/"${i}" || die
120 + done
121 + # .spec %prep
122 + bash "${WORKDIR}"/"${SOURCE1}" || die
123 + cp -f "${WORKDIR}"/"${SOURCE12}" "${S}"/crypto/ec/ || die
124 + cp -f "${WORKDIR}"/"${SOURCE13}" "${S}"/crypto/ec/ || die # Moves to test/ in OpenSSL-1.1
125 + for i in "${FEDORA_PATCH[@]}" ; do
126 + epatch "${DISTDIR}"/"${i}"
127 + done
128 + # Also see the configure parts below:
129 + # enable-ec \
130 + # $(use_ssl !bindist ec2m) \
131 + # $(use_ssl !bindist srp) \
132 +
133 + fi
134 + # keep this in sync with app-misc/c_rehash
135 + SSL_CNF_DIR="/etc/ssl"
136 +
137 + # Make sure we only ever touch Makefile.org and avoid patching a file
138 + # that gets blown away anyways by the Configure script in src_configure
139 + rm -f Makefile
140 +
141 + if ! use vanilla ; then
142 + epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
143 + epatch "${FILESDIR}"/${PN}-1.0.2i-parallel-build.patch
144 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
145 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
146 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch #545028
147 + epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
148 + epatch "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
149 + epatch "${FILESDIR}"/${PN}-1.0.1p-default-source.patch #554338
150 +
151 + epatch_user #332661
152 + fi
153 +
154 + # disable fips in the build
155 + # make sure the man pages are suffixed #302165
156 + # don't bother building man pages if they're disabled
157 + sed -i \
158 + -e '/DIRS/s: fips : :g' \
159 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
160 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
161 + -e $(has noman FEATURES \
162 + && echo '/^install:/s:install_docs::' \
163 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
164 + Makefile.org \
165 + || die
166 + # show the actual commands in the log
167 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
168 +
169 + # since we're forcing $(CC) as makedep anyway, just fix
170 + # the conditional as always-on
171 + # helps clang (#417795), and versioned gcc (#499818)
172 + sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
173 +
174 + # quiet out unknown driver argument warnings since openssl
175 + # doesn't have well-split CFLAGS and we're making it even worse
176 + # and 'make depend' uses -Werror for added fun (#417795 again)
177 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
178 +
179 + # allow openssl to be cross-compiled
180 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
181 + chmod a+rx gentoo.config
182 +
183 + append-flags -fno-strict-aliasing
184 + append-flags $(test-flags-CC -Wa,--noexecstack)
185 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
186 +
187 + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
188 + # The config script does stupid stuff to prompt the user. Kill it.
189 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
190 + ./config --test-sanity || die "I AM NOT SANE"
191 +
192 + multilib_copy_sources
193 +}
194 +
195 +multilib_src_configure() {
196 + unset APPS #197996
197 + unset SCRIPTS #312551
198 + unset CROSS_COMPILE #311473
199 +
200 + tc-export CC AR RANLIB RC
201 +
202 + # Clean out patent-or-otherwise-encumbered code
203 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
204 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
205 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
206 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
207 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
208 +
209 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
210 + echoit() { echo "$@" ; "$@" ; }
211 +
212 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
213 +
214 + # See if our toolchain supports __uint128_t. If so, it's 64bit
215 + # friendly and can use the nicely optimized code paths. #460790
216 + local ec_nistp_64_gcc_128
217 + # Disable it for now though #469976
218 + #if ! use bindist ; then
219 + # echo "__uint128_t i;" > "${T}"/128.c
220 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
221 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
222 + # fi
223 + #fi
224 +
225 + # https://github.com/openssl/openssl/issues/2286
226 + if use ia64 ; then
227 + replace-flags -g3 -g2
228 + replace-flags -ggdb3 -ggdb2
229 + fi
230 +
231 + local sslout=$(./gentoo.config)
232 + einfo "Use configuration ${sslout:-(openssl knows best)}"
233 + local config="Configure"
234 + [[ -z ${sslout} ]] && config="config"
235 +
236 + # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
237 + echoit \
238 + ./${config} \
239 + ${sslout} \
240 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
241 + enable-camellia \
242 + enable-ec \
243 + $(use_ssl !bindist ec2m) \
244 + $(use_ssl !bindist srp) \
245 + ${ec_nistp_64_gcc_128} \
246 + enable-idea \
247 + enable-mdc2 \
248 + enable-rc5 \
249 + enable-tlsext \
250 + $(use_ssl asm) \
251 + $(use_ssl gmp gmp -lgmp) \
252 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
253 + $(use_ssl rfc3779) \
254 + $(use_ssl sctp) \
255 + $(use_ssl sslv2 ssl2) \
256 + $(use_ssl sslv3 ssl3) \
257 + $(use_ssl tls-heartbeat heartbeats) \
258 + $(use_ssl zlib) \
259 + --prefix="${EPREFIX}"/usr \
260 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
261 + --libdir=$(get_libdir) \
262 + shared threads \
263 + || die
264 +
265 + # Clean out hardcoded flags that openssl uses
266 + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
267 + -e 's:^CFLAG=::' \
268 + -e 's:-fomit-frame-pointer ::g' \
269 + -e 's:-O[0-9] ::g' \
270 + -e 's:-march=[-a-z0-9]* ::g' \
271 + -e 's:-mcpu=[-a-z0-9]* ::g' \
272 + -e 's:-m[a-z0-9]* ::g' \
273 + )
274 + sed -i \
275 + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
276 + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
277 + Makefile || die
278 +}
279 +
280 +multilib_src_compile() {
281 + # depend is needed to use $confopts; it also doesn't matter
282 + # that it's -j1 as the code itself serializes subdirs
283 + emake -j1 depend
284 + emake all
285 + # rehash is needed to prep the certs/ dir; do this
286 + # separately to avoid parallel build issues.
287 + emake rehash
288 +}
289 +
290 +multilib_src_test() {
291 + emake -j1 test
292 +}
293 +
294 +multilib_src_install() {
295 + emake INSTALL_PREFIX="${D}" install
296 +}
297 +
298 +multilib_src_install_all() {
299 + # openssl installs perl version of c_rehash by default, but
300 + # we provide a shell version via app-misc/c_rehash
301 + rm "${ED}"/usr/bin/c_rehash || die
302 +
303 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
304 + dohtml -r doc/*
305 + use rfc3779 && dodoc engines/ccgost/README.gost
306 +
307 + # This is crappy in that the static archives are still built even
308 + # when USE=static-libs. But this is due to a failing in the openssl
309 + # build system: the static archives are built as PIC all the time.
310 + # Only way around this would be to manually configure+compile openssl
311 + # twice; once with shared lib support enabled and once without.
312 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
313 +
314 + # create the certs directory
315 + dodir ${SSL_CNF_DIR}/certs
316 + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
317 + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
318 +
319 + # Namespace openssl programs to prevent conflicts with other man pages
320 + cd "${ED}"/usr/share/man
321 + local m d s
322 + for m in $(find . -type f | xargs grep -L '#include') ; do
323 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
324 + [[ ${m} == openssl.1* ]] && continue
325 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
326 + mv ${d}/{,ssl-}${m}
327 + # fix up references to renamed man pages
328 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
329 + ln -s ssl-${m} ${d}/openssl-${m}
330 + # locate any symlinks that point to this man page ... we assume
331 + # that any broken links are due to the above renaming
332 + for s in $(find -L ${d} -type l) ; do
333 + s=${s##*/}
334 + rm -f ${d}/${s}
335 + ln -s ssl-${m} ${d}/ssl-${s}
336 + ln -s ssl-${s} ${d}/openssl-${s}
337 + done
338 + done
339 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
340 +
341 + dodir /etc/sandbox.d #254521
342 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
343 +
344 + diropts -m0700
345 + keepdir ${SSL_CNF_DIR}/private
346 +}
347 +
348 +pkg_postinst() {
349 + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
350 + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
351 + eend $?
352 +}