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:16:42
Message-Id: 1508706989.bdd5c9e7d6a375e99b3ae89afd4517a3a5786df2.robbat2@gentoo
1 commit: bdd5c9e7d6a375e99b3ae89afd4517a3a5786df2
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:16:29 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdd5c9e7
7
8 dev-libs/openssl: add Fedora Hobbled-EC.
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.1 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 OpenSSL 1.1 is still in package.mask at this time, and a 1.0 version of
24 this patch will follow soon.
25
26 Upstream: https://src.fedoraproject.org/cgit/rpms/openssl.git
27 Bug: https://bugs.gentoo.org/531540
28 Package-Manager: Portage-2.3.8, Repoman-2.3.3
29 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
30
31 dev-libs/openssl/Manifest | 5 +
32 dev-libs/openssl/metadata.xml | 2 +-
33 dev-libs/openssl/openssl-1.1.0f-r1.ebuild | 282 ++++++++++++++++++++++++++++++
34 3 files changed, 288 insertions(+), 1 deletion(-)
35
36 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
37 index 75b606b388c..a5c66ede427 100644
38 --- a/dev-libs/openssl/Manifest
39 +++ b/dev-libs/openssl/Manifest
40 @@ -1,4 +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.1.0-build.patch 3028 SHA256 c626ac8b34df5d55a7272a741f87f06dc06cc20ac80085048788a2c76c08c25f SHA512 b19a912900970052f80c67f28975e793ae9e70ebfc62efae0544e09931079e98c4cd29ce1cc8d937ceca97aff9a12fdc1ff9ce6c2b47fea68c79e7065464a0f0 WHIRLPOOL 950febb159139b145eb7de5bda1115465fa8551234182e6d15459ab5519213f515b4c3e3a3136d05c440d3eec04a7247461d36c2d45136a6f1963613d5896b3e
45 +DIST openssl-1.1.0-ec-curves.patch 2967 SHA256 da60dfa01ed244cd3f77f60cc2ef479a36e64a58fa5e242aa03647c698cc1a42 SHA512 8fb9c6759ae2077ad3697ba77e85ab3970fd8b3f64b21eb260b4f6333b7ebf2f5a53c7eee311229edfbd96a2b904ec5e5e00dfa5b62cf1105fece13069077bd2 WHIRLPOOL e7293ef84f6c36e8e5f5ec8158023fdca484bc9082e73956bd0cc74a17c880350a49799146c855a37f116d743e7c93e54cbe4aa7f70483e235d03687a15a46a5
46 DIST openssl-1.1.0f.tar.gz 5278176 SHA256 12f746f3f2493b2f39da7ecf63d7ee19c6ac9ec6a4fcd8c229da8a522cb12765 SHA512 340ab3f38c90dea346e543b58bc0eff0adede15be212ad20b7cf38718a7f94fab51996da414855c180540f7488b8bd31d8b9a0d04bb19159f735c46d8f6df22c WHIRLPOOL bb4ce1d100c5eb567de0139e4a1c0a2bb1cd308bd014704d6bb796d3fcfc16b91fe69839068944831746e0b937a6ccb234b5cea3b4911fab4283500ed380f0b6
47 +DIST openssl-1.1.0f_ec_curve.c 18393 SHA256 9dd0e1f422116da45eb16936fbbbe4e4e05e7a8fc0f359594af76e935c37716e SHA512 ee3e576825bccdf02cede4205ab92c42ae9dd3a8e75ce58617a3a5980a61d144eb3c5197d9dcd378a5d49bf34c4b2f591aa6a619fee92b7a22825d72681ab879 WHIRLPOOL 6f43f3b8037f5edf323ea865d1150eaa63ee60f60b512b52e37b752b328855e57eae70c812071caba0f91eeeb379c4dd9574806ba50d5bee38ad3b0e3fe03f55
48 +DIST openssl-1.1.0f_ectest.c 29907 SHA256 37682adb07ba260339fad3fead87b186fc8c26321a0aad45deefed4c25ad87cb SHA512 90cec9d46326cb7216236811c8e963032b6fa7500117cea36f28534eb50a5ab1260c7f9a5c8c490d845236b0769576a8d97bc7471f970e9c5e70cb3408c20dae WHIRLPOOL f39da1830f5a6492add40f460af9d85b2fbfac0d5d8ff4eb4ba3cb16e6ff50a030aee38c518d7a06d1167f59030ded5496000793ad4cf2de7ff36f22eeefe7c7
49 +DIST openssl-1.1.0f_hobble-openssl 1117 SHA256 ab168bd8bf578f7361524f9a12eecbbaf41fd7e2c852a0158aafd3bce9cac569 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826 WHIRLPOOL 94537166ad8f5cacba2d30d0b6e4676d896cab157be5891fbeecdb2efa10a322d77e2b35a44ff1d474e860dcece63a8688f9df5edf8fe859bf67b410148ea64a
50
51 diff --git a/dev-libs/openssl/metadata.xml b/dev-libs/openssl/metadata.xml
52 index 0ee764ebd0e..5ca8d93d2f6 100644
53 --- a/dev-libs/openssl/metadata.xml
54 +++ b/dev-libs/openssl/metadata.xml
55 @@ -7,7 +7,7 @@
56 </maintainer>
57 <use>
58 <flag name="asm">Support assembly hand optimized crypto functions (i.e. faster run time)</flag>
59 - <flag name="bindist">Disable EC algorithms (as they seem to be patented) -- note: changes the ABI</flag>
60 + <flag name="bindist">Disable/Restrict EC algorithms (as they seem to be patented) -- note: changes the ABI</flag>
61 <flag name="rfc3779">Enable support for RFC 3779 (X.509 Extensions for IP Addresses and AS Identifiers)</flag>
62 <flag name="sslv2">Support for the old/insecure SSLv2 protocol -- note: not required for TLS/https</flag>
63 <flag name="sslv3">Support for the old/insecure SSLv3 protocol -- note: not required for TLS/https</flag>
64
65 diff --git a/dev-libs/openssl/openssl-1.1.0f-r1.ebuild b/dev-libs/openssl/openssl-1.1.0f-r1.ebuild
66 new file mode 100644
67 index 00000000000..151632bbbcb
68 --- /dev/null
69 +++ b/dev-libs/openssl/openssl-1.1.0f-r1.ebuild
70 @@ -0,0 +1,282 @@
71 +# Copyright 1999-2017 Gentoo Foundation
72 +# Distributed under the terms of the GNU General Public License v2
73 +
74 +EAPI=5
75 +
76 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
77 +
78 +MY_P=${P/_/-}
79 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
80 +HOMEPAGE="http://www.openssl.org/"
81 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
82 +
83 +LICENSE="openssl"
84 +SLOT="0/1.1" # .so version of libssl/libcrypto
85 +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"
86 +IUSE="+asm bindist rfc3779 sctp cpu_flags_x86_sse2 static-libs test tls-heartbeat vanilla zlib"
87 +RESTRICT="!bindist? ( bindist )"
88 +
89 +RDEPEND=">=app-misc/c_rehash-1.7-r1
90 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
91 +DEPEND="${RDEPEND}
92 + >=dev-lang/perl-5
93 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
94 + test? (
95 + sys-apps/diffutils
96 + sys-devel/bc
97 + )"
98 +PDEPEND="app-misc/ca-certificates"
99 +
100 +# This does not copy the entire Fedora patchset, but JUST the parts that
101 +# are needed to make it safe to use EC with RESTRICT=bindist.
102 +# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
103 +SOURCE1=hobble-openssl
104 +SOURCE12=ec_curve.c
105 +SOURCE13=ectest.c
106 +PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
107 +PATCH37=openssl-1.1.0-ec-curves.patch
108 +FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
109 +FEDORA_GIT_BRANCH='f27'
110 +FEDORA_SRC_URI=()
111 +FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
112 +FEDORA_PATCH=( $PATCH1 $PATCH37 )
113 +for i in "${FEDORA_SOURCE[@]}" ; do
114 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${P}_${i}" )
115 +done
116 +for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
117 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${i}" )
118 +done
119 +SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
120 +
121 +S="${WORKDIR}/${MY_P}"
122 +
123 +MULTILIB_WRAPPED_HEADERS=(
124 + usr/include/openssl/opensslconf.h
125 +)
126 +
127 +PATCHES=(
128 + "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
129 +)
130 +
131 +src_prepare() {
132 + if use bindist; then
133 + # This just removes the prefix, and puts it into WORKDIR like the RPM.
134 + for i in "${FEDORA_SOURCE[@]}" ; do
135 + cp -f "${DISTDIR}"/"${P}_${i}" "${WORKDIR}"/"${i}" || die
136 + done
137 + # .spec %prep
138 + bash "${WORKDIR}"/"${SOURCE1}" || die
139 + cp -f "${WORKDIR}"/"${SOURCE12}" "${S}"/crypto/ec/ || die
140 + cp -f "${WORKDIR}"/"${SOURCE13}" "${S}"/test/ || die
141 + for i in "${FEDORA_PATCH[@]}" ; do
142 + epatch "${DISTDIR}"/"${i}"
143 + done
144 + # Also see the configure parts below:
145 + # enable-ec \
146 + # $(use_ssl !bindist ec2m) \
147 +
148 + fi
149 + # keep this in sync with app-misc/c_rehash
150 + SSL_CNF_DIR="/etc/ssl"
151 +
152 + # Make sure we only ever touch Makefile.org and avoid patching a file
153 + # that gets blown away anyways by the Configure script in src_configure
154 + rm -f Makefile
155 +
156 + if ! use vanilla ; then
157 + epatch "${PATCHES[@]}"
158 + epatch_user #332661
159 + fi
160 +
161 + # make sure the man pages are suffixed #302165
162 + # don't bother building man pages if they're disabled
163 + # Make DOCDIR Gentoo compliant
164 + sed -i \
165 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
166 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
167 + -e $(has noman FEATURES \
168 + && echo '/^install:/s:install_docs::' \
169 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
170 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PF}@" \
171 + Configurations/unix-Makefile.tmpl \
172 + || die
173 +
174 + # show the actual commands in the log
175 + sed -i '/^SET_X/s@=.*@=set -x@' Makefile.shared
176 +
177 + # quiet out unknown driver argument warnings since openssl
178 + # doesn't have well-split CFLAGS and we're making it even worse
179 + # and 'make depend' uses -Werror for added fun (#417795 again)
180 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
181 +
182 + # allow openssl to be cross-compiled
183 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
184 + chmod a+rx gentoo.config
185 +
186 + append-flags -fno-strict-aliasing
187 + append-flags $(test-flags-CC -Wa,--noexecstack)
188 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
189 +
190 + # Prefixify Configure shebang (#141906)
191 + sed \
192 + -e "1s,/usr/bin/env,${EPREFIX}&," \
193 + -i Configure || die
194 + # Remove test target when FEATURES=test isn't set
195 + if ! use test ; then
196 + sed \
197 + -e '/^$config{dirs}/s@ "test",@@' \
198 + -i Configure || die
199 + fi
200 + # The config script does stupid stuff to prompt the user. Kill it.
201 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
202 + ./config --test-sanity || die "I AM NOT SANE"
203 +
204 + multilib_copy_sources
205 +}
206 +
207 +multilib_src_configure() {
208 + unset APPS #197996
209 + unset SCRIPTS #312551
210 + unset CROSS_COMPILE #311473
211 +
212 + tc-export CC AR RANLIB RC
213 +
214 + # Clean out patent-or-otherwise-encumbered code
215 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
216 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
217 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
218 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
219 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
220 +
221 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
222 + echoit() { echo "$@" ; "$@" ; }
223 +
224 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
225 +
226 + # See if our toolchain supports __uint128_t. If so, it's 64bit
227 + # friendly and can use the nicely optimized code paths. #460790
228 + local ec_nistp_64_gcc_128
229 + # Disable it for now though #469976
230 + #if ! use bindist ; then
231 + # echo "__uint128_t i;" > "${T}"/128.c
232 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
233 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
234 + # fi
235 + #fi
236 +
237 + local sslout=$(./gentoo.config)
238 + einfo "Use configuration ${sslout:-(openssl knows best)}"
239 + local config="Configure"
240 + [[ -z ${sslout} ]] && config="config"
241 +
242 + # Fedora hobbled-EC needs 'no-ec2m'
243 + # 'srp' was restricted until early 2017 as well.
244 + echoit \
245 + ./${config} \
246 + ${sslout} \
247 + --api=1.0.0 \
248 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
249 + enable-camellia \
250 + disable-deprecated \
251 + enable-ec \
252 + $(use_ssl !bindist ec2m) \
253 + enable-srp \
254 + ${ec_nistp_64_gcc_128} \
255 + enable-idea \
256 + enable-mdc2 \
257 + enable-rc5 \
258 + $(use_ssl asm) \
259 + $(use_ssl rfc3779) \
260 + $(use_ssl sctp) \
261 + $(use_ssl tls-heartbeat heartbeats) \
262 + $(use_ssl zlib) \
263 + --prefix="${EPREFIX}"/usr \
264 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
265 + --libdir=$(get_libdir) \
266 + shared threads \
267 + || die
268 +
269 + # Clean out hardcoded flags that openssl uses
270 + # Fix quoting for sed
271 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
272 + -e 's:^CFLAGS=::' \
273 + -e 's:-fomit-frame-pointer ::g' \
274 + -e 's:-O[0-9] ::g' \
275 + -e 's:-march=[-a-z0-9]* ::g' \
276 + -e 's:-mcpu=[-a-z0-9]* ::g' \
277 + -e 's:-m[a-z0-9]* ::g' \
278 + -e 's:\\:\\\\:g' \
279 + )
280 + sed -i \
281 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
282 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
283 + Makefile || die
284 +}
285 +
286 +multilib_src_compile() {
287 + # depend is needed to use $confopts; it also doesn't matter
288 + # that it's -j1 as the code itself serializes subdirs
289 + emake -j1 depend
290 + emake all
291 +}
292 +
293 +multilib_src_test() {
294 + emake -j1 test
295 +}
296 +
297 +multilib_src_install() {
298 + emake DESTDIR="${D}" install
299 +}
300 +
301 +multilib_src_install_all() {
302 + # openssl installs perl version of c_rehash by default, but
303 + # we provide a shell version via app-misc/c_rehash
304 + rm "${ED}"/usr/bin/c_rehash || die
305 +
306 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
307 + dohtml -r doc/*
308 +
309 + # This is crappy in that the static archives are still built even
310 + # when USE=static-libs. But this is due to a failing in the openssl
311 + # build system: the static archives are built as PIC all the time.
312 + # Only way around this would be to manually configure+compile openssl
313 + # twice; once with shared lib support enabled and once without.
314 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
315 +
316 + # create the certs directory
317 + keepdir ${SSL_CNF_DIR}/certs
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 +}