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-compat/
Date: Fri, 23 Aug 2019 18:10:53
Message-Id: 1566583822.e97ec5edeee8a64d588372637d04ae934d3c514b.whissi@gentoo
1 commit: e97ec5edeee8a64d588372637d04ae934d3c514b
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 23 17:59:39 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 23 18:10:22 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e97ec5ed
7
8 dev-libs/openssl-compat: bump to v1.0.2s
9
10 Package-Manager: Portage-2.3.72, Repoman-2.3.17
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-libs/openssl-compat/Manifest | 4 +
14 .../openssl-compat/openssl-compat-1.0.2s.ebuild | 258 +++++++++++++++++++++
15 2 files changed, 262 insertions(+)
16
17 diff --git a/dev-libs/openssl-compat/Manifest b/dev-libs/openssl-compat/Manifest
18 index 8fc04945964..260480f8468 100644
19 --- a/dev-libs/openssl-compat/Manifest
20 +++ b/dev-libs/openssl-compat/Manifest
21 @@ -4,3 +4,7 @@ DIST openssl-1.0.2r.tar.gz 5348369 BLAKE2B 9f9c2d2fe6eaf9acacab29b394a318f30c38e
22 DIST openssl-1.0.2r_ec_curve.c 17254 BLAKE2B d40d8d6e770443f07abe70e2c4ddda6aec1cc8e37dc1f226a3fdd9ed5d228f09c6d372e8956b1948b55ee1d57d1429493e7288d0f54d9466a37fec805c85aacb SHA512 8e92fb100bcf4bd918c82b9a6cbd75a55abe1a2c08230a007e441c51577f974f8cc336e9ac8a672b32641480428ca8cead5380da1fe81bacb088145a1b754a15
23 DIST openssl-1.0.2r_ectest.c 30735 BLAKE2B 95333a27f1cf0a4305a3cee7f6d46b9d4673582ca9acfcf5ba2a0d9d317ab6219cd0d2ff0ba3a55a317c8f5819342f05cc17ba80ec2c92b2b4cab9a3552382e1 SHA512 f2e4d34327b490bc8371f0845c69df3f9fc51ea16f0ea0de0411a0c1fa9d49bb2b6fafc363eb3b3cd919dc7c24e4a0d075c6ff878c01d70dae918f2540874c19
24 DIST openssl-1.0.2r_hobble-openssl 1302 BLAKE2B 647caa6a0f4c53a2e77baa3b8e5961eaef3bb0ff38e7d5475eab8deef3439f7fe49028ec9ed0406f3453870b62cac67c496b3a048ee4c9ff4c6866d520235960 SHA512 3d757a4708e74a03dd5cb9b8114dfe442ed9520739a6eca693be4c4265771696f1449ea06d1c9bcfc6e94fc9b0dd0c10e153f1c3b0334831c0550b36cd63326e
25 +DIST openssl-1.0.2s.tar.gz 5349149 BLAKE2B 46c72dcceb5b473b129be0a895f3d6c25a24ee852a31dc369ccf0e44319259d8694d3571b8cb698efb8bce89dbe31f4fc9f82753cacb24cbd3d50fa2ab9b6e83 SHA512 9f745452c4f777df694158e95003cde78a2cf8199bc481a563ec36644664c3c1415a774779b9791dd18f2aeb57fa1721cb52b3db12d025955e970071d5b66d2a
26 +DIST openssl-1.0.2s_ec_curve.c 17254 BLAKE2B d40d8d6e770443f07abe70e2c4ddda6aec1cc8e37dc1f226a3fdd9ed5d228f09c6d372e8956b1948b55ee1d57d1429493e7288d0f54d9466a37fec805c85aacb SHA512 8e92fb100bcf4bd918c82b9a6cbd75a55abe1a2c08230a007e441c51577f974f8cc336e9ac8a672b32641480428ca8cead5380da1fe81bacb088145a1b754a15
27 +DIST openssl-1.0.2s_ectest.c 30735 BLAKE2B 95333a27f1cf0a4305a3cee7f6d46b9d4673582ca9acfcf5ba2a0d9d317ab6219cd0d2ff0ba3a55a317c8f5819342f05cc17ba80ec2c92b2b4cab9a3552382e1 SHA512 f2e4d34327b490bc8371f0845c69df3f9fc51ea16f0ea0de0411a0c1fa9d49bb2b6fafc363eb3b3cd919dc7c24e4a0d075c6ff878c01d70dae918f2540874c19
28 +DIST openssl-1.0.2s_hobble-openssl 1302 BLAKE2B 647caa6a0f4c53a2e77baa3b8e5961eaef3bb0ff38e7d5475eab8deef3439f7fe49028ec9ed0406f3453870b62cac67c496b3a048ee4c9ff4c6866d520235960 SHA512 3d757a4708e74a03dd5cb9b8114dfe442ed9520739a6eca693be4c4265771696f1449ea06d1c9bcfc6e94fc9b0dd0c10e153f1c3b0334831c0550b36cd63326e
29
30 diff --git a/dev-libs/openssl-compat/openssl-compat-1.0.2s.ebuild b/dev-libs/openssl-compat/openssl-compat-1.0.2s.ebuild
31 new file mode 100644
32 index 00000000000..7449ff20b7e
33 --- /dev/null
34 +++ b/dev-libs/openssl-compat/openssl-compat-1.0.2s.ebuild
35 @@ -0,0 +1,258 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI="7"
40 +
41 +inherit flag-o-matic toolchain-funcs multilib multilib-minimal
42 +
43 +# openssl-1.0.2-patches-1.6 contain additional CVE patches
44 +# which got fixed with this release.
45 +# Please use 1.7 version number when rolling a new tarball!
46 +PATCH_SET="openssl-1.0.2-patches-1.5"
47 +MY_P=openssl-${PV/_/-}
48 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
49 +HOMEPAGE="https://www.openssl.org/"
50 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
51 + !vanilla? (
52 + mirror://gentoo/${PATCH_SET}.tar.xz
53 + https://dev.gentoo.org/~chutzpah/dist/openssl/${PATCH_SET}.tar.xz
54 + https://dev.gentoo.org/~whissi/dist/openssl/${PATCH_SET}.tar.xz
55 + https://dev.gentoo.org/~polynomial-c/dist/${PATCH_SET}.tar.xz
56 + )"
57 +
58 +LICENSE="openssl"
59 +SLOT="1.0.0"
60 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-linux"
61 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
62 +RESTRICT="!bindist? ( bindist )"
63 +
64 +RDEPEND="gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
65 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
66 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
67 + !=dev-libs/openssl-1.0.2*:0"
68 +DEPEND="${RDEPEND}"
69 +BDEPEND="
70 + >=dev-lang/perl-5
71 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
72 + test? (
73 + sys-apps/diffutils
74 + sys-devel/bc
75 + )"
76 +
77 +RESTRICT="test"
78 +
79 +# Do not install any docs
80 +DOCS=()
81 +
82 +# This does not copy the entire Fedora patchset, but JUST the parts that
83 +# are needed to make it safe to use EC with RESTRICT=bindist.
84 +# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
85 +SOURCE1=hobble-openssl
86 +SOURCE12=ec_curve.c
87 +SOURCE13=ectest.c
88 +# These are ported instead
89 +#PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
90 +#PATCH37=openssl-1.1.0-ec-curves.patch
91 +FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
92 +FEDORA_GIT_BRANCH='f25'
93 +FEDORA_SRC_URI=()
94 +FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
95 +FEDORA_PATCH=( $PATCH1 $PATCH37 )
96 +for i in "${FEDORA_SOURCE[@]}" ; do
97 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> openssl-${PV}_${i}" )
98 +done
99 +for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
100 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${i}" )
101 +done
102 +SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
103 +
104 +S="${WORKDIR}/${MY_P}"
105 +
106 +MULTILIB_WRAPPED_HEADERS=(
107 + usr/include/openssl/opensslconf.h
108 +)
109 +
110 +src_prepare() {
111 + if use bindist; then
112 + # This just removes the prefix, and puts it into WORKDIR like the RPM.
113 + for i in "${FEDORA_SOURCE[@]}" ; do
114 + cp -f "${DISTDIR}"/"openssl-${PV}_${i}" "${WORKDIR}"/"${i}" || die
115 + done
116 + # .spec %prep
117 + bash "${WORKDIR}"/"${SOURCE1}" || die
118 + cp -f "${WORKDIR}"/"${SOURCE12}" "${S}"/crypto/ec/ || die
119 + cp -f "${WORKDIR}"/"${SOURCE13}" "${S}"/crypto/ec/ || die # Moves to test/ in OpenSSL-1.1
120 + for i in "${FEDORA_PATCH[@]}" ; do
121 + eapply "${DISTDIR}"/"${i}"
122 + done
123 + eapply "${FILESDIR}"/openssl-1.0.2p-hobble-ecc.patch
124 + # Also see the configure parts below:
125 + # enable-ec \
126 + # $(use_ssl !bindist ec2m) \
127 + # $(use_ssl !bindist srp) \
128 + fi
129 +
130 + # keep this in sync with app-misc/c_rehash
131 + SSL_CNF_DIR="/etc/ssl"
132 +
133 + # Make sure we only ever touch Makefile.org and avoid patching a file
134 + # that gets blown away anyways by the Configure script in src_configure
135 + rm -f Makefile
136 +
137 + if ! use vanilla ; then
138 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
139 + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
140 + fi
141 + fi
142 +
143 + eapply_user
144 +
145 + # disable fips in the build
146 + # make sure the man pages are suffixed #302165
147 + # don't bother building man pages if they're disabled
148 + sed -i \
149 + -e '/DIRS/s: fips : :g' \
150 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
151 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
152 + -e $(has noman FEATURES \
153 + && echo '/^install:/s:install_docs::' \
154 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
155 + Makefile.org \
156 + || die
157 + # show the actual commands in the log
158 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
159 +
160 + # since we're forcing $(CC) as makedep anyway, just fix
161 + # the conditional as always-on
162 + # helps clang (#417795), and versioned gcc (#499818)
163 + # this breaks build with 1.0.2p, not sure if it is needed anymore
164 + #sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
165 +
166 + # quiet out unknown driver argument warnings since openssl
167 + # doesn't have well-split CFLAGS and we're making it even worse
168 + # and 'make depend' uses -Werror for added fun (#417795 again)
169 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
170 +
171 + # allow openssl to be cross-compiled
172 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
173 + chmod a+rx gentoo.config || die
174 +
175 + append-flags -fno-strict-aliasing
176 + append-flags $(test-flags-CC -Wa,--noexecstack)
177 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
178 +
179 + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
180 + # The config script does stupid stuff to prompt the user. Kill it.
181 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
182 + ./config --test-sanity || die "I AM NOT SANE"
183 +
184 + multilib_copy_sources
185 +}
186 +
187 +multilib_src_configure() {
188 + unset APPS #197996
189 + unset SCRIPTS #312551
190 + unset CROSS_COMPILE #311473
191 +
192 + tc-export CC AR RANLIB RC
193 +
194 + # Clean out patent-or-otherwise-encumbered code
195 + # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
196 + # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
197 + # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
198 + # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
199 + # RC5: Expired https://en.wikipedia.org/wiki/RC5
200 +
201 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
202 + echoit() { echo "$@" ; "$@" ; }
203 +
204 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
205 +
206 + # See if our toolchain supports __uint128_t. If so, it's 64bit
207 + # friendly and can use the nicely optimized code paths. #460790
208 + local ec_nistp_64_gcc_128
209 + # Disable it for now though #469976
210 + #if ! use bindist ; then
211 + # echo "__uint128_t i;" > "${T}"/128.c
212 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
213 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
214 + # fi
215 + #fi
216 +
217 + # https://github.com/openssl/openssl/issues/2286
218 + if use ia64 ; then
219 + replace-flags -g3 -g2
220 + replace-flags -ggdb3 -ggdb2
221 + fi
222 +
223 + local sslout=$(./gentoo.config)
224 + einfo "Use configuration ${sslout:-(openssl knows best)}"
225 + local config="Configure"
226 + [[ -z ${sslout} ]] && config="config"
227 +
228 + # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
229 + # Make sure user flags don't get added *yet* to avoid duplicated
230 + # flags.
231 + CFLAGS= LDFLAGS= echoit \
232 + ./${config} \
233 + ${sslout} \
234 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
235 + enable-camellia \
236 + enable-ec \
237 + $(use_ssl !bindist ec2m) \
238 + $(use_ssl !bindist srp) \
239 + ${ec_nistp_64_gcc_128} \
240 + enable-idea \
241 + enable-mdc2 \
242 + enable-rc5 \
243 + enable-tlsext \
244 + $(use_ssl asm) \
245 + $(use_ssl gmp gmp -lgmp) \
246 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
247 + $(use_ssl rfc3779) \
248 + $(use_ssl sctp) \
249 + $(use_ssl sslv2 ssl2) \
250 + $(use_ssl sslv3 ssl3) \
251 + $(use_ssl tls-heartbeat heartbeats) \
252 + $(use_ssl zlib) \
253 + --prefix="${EPREFIX}"/usr \
254 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
255 + --libdir=$(get_libdir) \
256 + shared threads \
257 + || die
258 +
259 + # Clean out hardcoded flags that openssl uses
260 + local DEFAULT_CFLAGS=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
261 + -e 's:^CFLAG=::' \
262 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
263 + -e 's:\(^\| \)-O[^ ]*::g' \
264 + -e 's:\(^\| \)-march=[^ ]*::g' \
265 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
266 + -e 's:\(^\| \)-m[^ ]*::g' \
267 + -e 's:^ *::' \
268 + -e 's: *$::' \
269 + -e 's: \+: :g' \
270 + -e 's:\\:\\\\:g'
271 + )
272 +
273 + # Now insert clean default flags with user flags
274 + sed -i \
275 + -e "/^CFLAG/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
276 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${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 V=1 depend
284 + emake build_libs
285 +}
286 +
287 +multilib_src_test() {
288 + emake -j1 test
289 +}
290 +
291 +multilib_src_install() {
292 + dolib.so lib{crypto,ssl}.so.${SLOT}
293 +}