commit:     ed94450ee6c76aad055c5db84c02ea392650662b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  8 18:04:19 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb  8 18:04:19 2018 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ed94450e

dev-libs/openssl: sync, bug #647006

Closes: https://bugs.gentoo.org/647006
Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6

 dev-libs/openssl/Manifest                          |  11 +-
 .../files/openssl-1.1.0g-CVE-2017-3738.patch       |  77 ++++++
 dev-libs/openssl/openssl-1.0.2k.ebuild             | 267 ---------------------
 ...openssl-1.0.2l.ebuild => openssl-1.0.2n.ebuild} |  36 ++-
 ...nssl-1.1.0f.ebuild => openssl-1.1.0g-r2.ebuild} |  56 ++++-
 5 files changed, 151 insertions(+), 296 deletions(-)

diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
index b15d822eca..aa1b1accb1 100644
--- a/dev-libs/openssl/Manifest
+++ b/dev-libs/openssl/Manifest
@@ -1,3 +1,8 @@
-DIST openssl-1.0.2k.tar.gz 5309236 BLAKE2B 
97069b9c7aaab2381ae5be989caff6907cd44ab1831d84685c3421ad985889a2bbc3a462decdff9c4c158ace96975de2b9e49e4f1b9f306990c3dc0f03767dad
 SHA512 
0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016
-DIST openssl-1.0.2l.tar.gz 5365054 BLAKE2B 
0a459a93a0013269dea79bd6df96a434b9dad95b6d98b24a48bc1b1438415c0a8de01b67166ac13a73ae65fb64131568924c3e6f945d862b7e960f05332cf097
 SHA512 
047d964508ad6025c79caabd8965efd2416dc026a56183d0ef4de7a0a6769ce8e0b4608a3f8393d326f6d03b26a2b067e6e0c750f35b20be190e595e8290c0e3
-DIST openssl-1.1.0f.tar.gz 5278176 SHA256 
12f746f3f2493b2f39da7ecf63d7ee19c6ac9ec6a4fcd8c229da8a522cb12765 SHA512 
340ab3f38c90dea346e543b58bc0eff0adede15be212ad20b7cf38718a7f94fab51996da414855c180540f7488b8bd31d8b9a0d04bb19159f735c46d8f6df22c
 WHIRLPOOL 
bb4ce1d100c5eb567de0139e4a1c0a2bb1cd308bd014704d6bb796d3fcfc16b91fe69839068944831746e0b937a6ccb234b5cea3b4911fab4283500ed380f0b6
+DIST openssl-1.0.2-patches-1.0.tar.xz 11572 BLAKE2B 
bdb9d2b8388f1aadf3a9274133aa8f86b0029fae1ce86d005baa39a7347657f8d4d84395b54e8ccd67944356ee197dfb527f843b4f146e305533e2ad5450721d
 SHA512 
15234ade359a0acf001cf10c7a7fc05f54603a44c67831529c2a6eda03342f9ba1cf40664ac782b5b73c50b23ec5649fb48ccff2aea8f0df2ef634959c47e3e9
+DIST openssl-1.0.2n.tar.gz 5375802 BLAKE2B 
2e04f8c3d5e2296859b8474d7e100e270f53f18a26c6d37a4cf5e01cd14f44d24d334b4e705da05d77c33b5dc91cffea0feea9f7c83c77ba16c9b6d5f5085894
 SHA512 
144bf0d6aa27b4af01df0b7b734c39962649e1711554247d42e05e14d8945742b18745aefdba162e2dfc762b941fd7d3b2d5dc6a781ae4ba10a6f5a3cadb0687
+DIST openssl-1.1.0-build.patch 3028 BLAKE2B 
f8cf981ed3717af234ce02fa50f27cdbcbf2b766968a5957fc6f0a4ea997549505fa77398444d7f3b9a75f66048447fe62542b9cb1d5f0268add87c44915a6fd
 SHA512 
b19a912900970052f80c67f28975e793ae9e70ebfc62efae0544e09931079e98c4cd29ce1cc8d937ceca97aff9a12fdc1ff9ce6c2b47fea68c79e7065464a0f0
+DIST openssl-1.1.0-ec-curves.patch 2967 BLAKE2B 
1c639514445ea85cf731732aa7901b5a03ddb5f637b0483ab2ec6825433ad978723c5a07316db684bdaca4a12fc673b4e049a49c0cd4dbe5f25a5e2bd3b75cf5
 SHA512 
8fb9c6759ae2077ad3697ba77e85ab3970fd8b3f64b21eb260b4f6333b7ebf2f5a53c7eee311229edfbd96a2b904ec5e5e00dfa5b62cf1105fece13069077bd2
+DIST openssl-1.1.0g.tar.gz 5404748 BLAKE2B 
23daf80e4143aad4654ae86f8e96042dd7328a9d1186b4922e284fcfe0f68259ea12d21c4472d92d65a7fcef21e049cf9371cc9bdad11b66a3df11286418ed42
 SHA512 
6c76f698fc2a4540f3977d97c889e139acf7d3f9eb85f349974175e8a7707b19743ef91c5ce32839310b6ea06ca88a03d9709ee011687b4634c5c50b5814f42a
+DIST openssl-1.1.0g_ec_curve.c 18393 BLAKE2B 
49dca7ddbc23270e5927454925df7bb18c8d9eb58f79e3a4fbcd8b7fc22fad36e2cb54ff9b63c2beeeea15c0c075a96e4ce8d03991355419af41fa9dc2aed3ad
 SHA512 
ee3e576825bccdf02cede4205ab92c42ae9dd3a8e75ce58617a3a5980a61d144eb3c5197d9dcd378a5d49bf34c4b2f591aa6a619fee92b7a22825d72681ab879
+DIST openssl-1.1.0g_ectest.c 29907 BLAKE2B 
73dc800c1de5449f14d7753f7f7b8e672cd36bd4570e6df07f246d1d823c7dbbeef492f25cdd0ebfd693f5956732bc84c9d91fc6a22c854fe4b245ecf3890bda
 SHA512 
90cec9d46326cb7216236811c8e963032b6fa7500117cea36f28534eb50a5ab1260c7f9a5c8c490d845236b0769576a8d97bc7471f970e9c5e70cb3408c20dae
+DIST openssl-1.1.0g_hobble-openssl 1117 BLAKE2B 
c3a1477e63331e83cf1cbe58e9ef131ec500a311e22d3da55034800ca353c387b2e202575acf3badb00b236ff91d4bac1bb131a33930939646d26bec27be6e04
 SHA512 
fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826

diff --git a/dev-libs/openssl/files/openssl-1.1.0g-CVE-2017-3738.patch 
b/dev-libs/openssl/files/openssl-1.1.0g-CVE-2017-3738.patch
new file mode 100644
index 0000000000..4b01feb8e8
--- /dev/null
+++ b/dev-libs/openssl/files/openssl-1.1.0g-CVE-2017-3738.patch
@@ -0,0 +1,77 @@
+From e502cc86df9dafded1694fceb3228ee34d11c11a Mon Sep 17 00:00:00 2001
+From: Andy Polyakov <ap...@openssl.org>
+Date: Fri, 24 Nov 2017 11:35:50 +0100
+Subject: [PATCH] bn/asm/rsaz-avx2.pl: fix digit correction bug in
+ rsaz_1024_mul_avx2.
+
+Credit to OSS-Fuzz for finding this.
+
+CVE-2017-3738
+
+Reviewed-by: Rich Salz <rs...@openssl.org>
+---
+ crypto/bn/asm/rsaz-avx2.pl | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/crypto/bn/asm/rsaz-avx2.pl b/crypto/bn/asm/rsaz-avx2.pl
+index 0c1b236ef98..46d746b7d0e 100755
+--- a/crypto/bn/asm/rsaz-avx2.pl
++++ b/crypto/bn/asm/rsaz-avx2.pl
+@@ -246,7 +246,7 @@
+       vmovdqu         32*8-128($ap), $ACC8
+ 
+       lea     192(%rsp), $tp0                 # 64+128=192
+-      vpbroadcastq    .Land_mask(%rip), $AND_MASK
++      vmovdqu .Land_mask(%rip), $AND_MASK
+       jmp     .LOOP_GRANDE_SQR_1024
+ 
+ .align        32
+@@ -1077,10 +1077,10 @@
+       vpmuludq        32*6-128($np),$Yi,$TEMP1
+       vpaddq          $TEMP1,$ACC6,$ACC6
+       vpmuludq        32*7-128($np),$Yi,$TEMP2
+-       vpblendd       \$3, $ZERO, $ACC9, $ACC9        # correct $ACC3
++       vpblendd       \$3, $ZERO, $ACC9, $TEMP1       # correct $ACC3
+       vpaddq          $TEMP2,$ACC7,$ACC7
+       vpmuludq        32*8-128($np),$Yi,$TEMP0
+-       vpaddq         $ACC9, $ACC3, $ACC3             # correct $ACC3
++       vpaddq         $TEMP1, $ACC3, $ACC3            # correct $ACC3
+       vpaddq          $TEMP0,$ACC8,$ACC8
+ 
+       mov     %rbx, %rax
+@@ -1093,7 +1093,9 @@
+        vmovdqu        -8+32*2-128($ap),$TEMP2
+ 
+       mov     $r1, %rax
++       vpblendd       \$0xfc, $ZERO, $ACC9, $ACC9     # correct $ACC3
+       imull   $n0, %eax
++       vpaddq         $ACC9,$ACC4,$ACC4               # correct $ACC3
+       and     \$0x1fffffff, %eax
+ 
+        imulq  16-128($ap),%rbx
+@@ -1329,15 +1331,12 @@
+ #     But as we underutilize resources, it's possible to correct in
+ #     each iteration with marginal performance loss. But then, as
+ #     we do it in each iteration, we can correct less digits, and
+-#     avoid performance penalties completely. Also note that we
+-#     correct only three digits out of four. This works because
+-#     most significant digit is subjected to less additions.
++#     avoid performance penalties completely.
+ 
+ $TEMP0 = $ACC9;
+ $TEMP3 = $Bi;
+ $TEMP4 = $Yi;
+ $code.=<<___;
+-      vpermq          \$0, $AND_MASK, $AND_MASK
+       vpaddq          (%rsp), $TEMP1, $ACC0
+ 
+       vpsrlq          \$29, $ACC0, $TEMP1
+@@ -1770,7 +1769,7 @@
+ 
+ .align        64
+ .Land_mask:
+-      .quad   0x1fffffff,0x1fffffff,0x1fffffff,-1
++      .quad   0x1fffffff,0x1fffffff,0x1fffffff,0x1fffffff
+ .Lscatter_permd:
+       .long   0,2,4,6,7,7,7,7
+ .Lgather_permd:

diff --git a/dev-libs/openssl/openssl-1.0.2k.ebuild 
b/dev-libs/openssl/openssl-1.0.2k.ebuild
deleted file mode 100644
index d512d107f2..0000000000
--- a/dev-libs/openssl/openssl-1.0.2k.ebuild
+++ /dev/null
@@ -1,267 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
-
-MY_P=${P/_/-}
-DESCRIPTION="full-strength general purpose cryptography library (including SSL 
and TLS)"
-HOMEPAGE="http://www.openssl.org/";
-SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
-
-LICENSE="openssl"
-SLOT="0"
-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"
-IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 
static-libs test +tls-heartbeat vanilla zlib"
-RESTRICT="!bindist? ( bindist )"
-
-RDEPEND=">=app-misc/c_rehash-1.7-r1
-       gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
-       zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
-       kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )"
-DEPEND="${RDEPEND}
-       >=dev-lang/perl-5
-       sctp? ( >=net-misc/lksctp-tools-1.0.12 )
-       test? (
-               sys-apps/diffutils
-               sys-devel/bc
-       )"
-PDEPEND="app-misc/ca-certificates"
-
-S="${WORKDIR}/${MY_P}"
-
-MULTILIB_WRAPPED_HEADERS=(
-       usr/include/openssl/opensslconf.h
-)
-
-src_prepare() {
-       # keep this in sync with app-misc/c_rehash
-       SSL_CNF_DIR="/etc/ssl"
-
-       # Make sure we only ever touch Makefile.org and avoid patching a file
-       # that gets blown away anyways by the Configure script in src_configure
-       rm -f Makefile
-
-       if ! use vanilla ; then
-               epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
-               epatch "${FILESDIR}"/${PN}-1.0.2i-parallel-build.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch 
#545028
-               epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
-               epatch "${FILESDIR}"/${PN}-1.0.1p-default-source.patch #554338
-
-               epatch_user #332661
-
-               # Solaris /bin/sh does not support "[ -e file ]", added by 
patches
-               sed -e 's/\[ -e /\[ -r /' -i Makefile.shared
-       fi
-
-       # disable fips in the build
-       # make sure the man pages are suffixed #302165
-       # don't bother building man pages if they're disabled
-       sed -i \
-               -e '/DIRS/s: fips : :g' \
-               -e '/^MANSUFFIX/s:=.*:=ssl:' \
-               -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
-               -e $(has noman FEATURES \
-                       && echo '/^install:/s:install_docs::' \
-                       || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') 
\
-               Makefile.org \
-               || die
-       # show the actual commands in the log
-       sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
-
-       epatch "${FILESDIR}"/${PN}-1.0.2a-aix-soname.patch # like libtool
-       epatch "${FILESDIR}"/${PN}-0.9.8g-engines-installnames.patch
-       epatch "${FILESDIR}"/${PN}-1.0.0b-darwin-bundle-compile-fix.patch
-       epatch "${FILESDIR}"/${PN}-1.0.2-gethostbyname2-solaris.patch
-
-       # remove -arch for Darwin
-       sed -i '/^"darwin/s,-arch [^ ]\+,,g' Configure || die
-
-       # since we're forcing $(CC) as makedep anyway, just fix
-       # the conditional as always-on
-       # helps clang (#417795), and versioned gcc (#499818)
-       sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
-
-       # quiet out unknown driver argument warnings since openssl
-       # doesn't have well-split CFLAGS and we're making it even worse
-       # and 'make depend' uses -Werror for added fun (#417795 again)
-       [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
-
-       # allow openssl to be cross-compiled
-       cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
-       chmod a+rx gentoo.config
-
-       append-flags -fno-strict-aliasing
-       append-flags $(test-flags-CC -Wa,--noexecstack)
-       append-cppflags -DOPENSSL_NO_BUF_FREELISTS
-
-       use prefix-chain && sed -i '1s,^:$,#!/usr/bin/env perl,' Configure 
#141906
-       sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
-       # The config script does stupid stuff to prompt the user.  Kill it.
-       sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
-       ./config --test-sanity || die "I AM NOT SANE"
-
-       multilib_copy_sources
-}
-
-multilib_src_configure() {
-       unset APPS #197996
-       unset SCRIPTS #312551
-       unset CROSS_COMPILE #311473
-
-       tc-export CC AR RANLIB RC
-
-       # Clean out patent-or-otherwise-encumbered code
-       # Camellia: Royalty Free            
http://en.wikipedia.org/wiki/Camellia_(cipher)
-       # IDEA:     Expired                 
http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
-       # EC:       ????????? ??/??/2015    
http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
-       # MDC2:     Expired                 http://en.wikipedia.org/wiki/MDC-2
-       # RC5:      Expired                 http://en.wikipedia.org/wiki/RC5
-
-       use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
-       echoit() { echo "$@" ; "$@" ; }
-
-       local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo 
"Heimdal")
-
-       # See if our toolchain supports __uint128_t.  If so, it's 64bit
-       # friendly and can use the nicely optimized code paths. #460790
-       local ec_nistp_64_gcc_128
-       # Disable it for now though #469976
-       #if ! use bindist ; then
-       #       echo "__uint128_t i;" > "${T}"/128.c
-       #       if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; 
then
-       #               ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
-       #       fi
-       #fi
-
-       # https://github.com/openssl/openssl/issues/2286
-       if use ia64 ; then
-               replace-flags -g3 -g2
-               replace-flags -ggdb3 -ggdb2
-       fi
-
-       local sslout=$(./gentoo.config)
-       einfo "Use configuration ${sslout:-(openssl knows best)}"
-       local config="Configure"
-       [[ -z ${sslout} ]] && config="config"
-
-       echoit \
-       ./${config} \
-               ${sslout} \
-               $(use cpu_flags_x86_sse2 || echo "no-sse2") \
-               enable-camellia \
-               $(use_ssl !bindist ec) \
-               ${ec_nistp_64_gcc_128} \
-               enable-idea \
-               enable-mdc2 \
-               enable-rc5 \
-               enable-tlsext \
-               $(use_ssl asm) \
-               $(use_ssl gmp gmp -lgmp) \
-               $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
-               $(use_ssl rfc3779) \
-               $(use_ssl sctp) \
-               $(use_ssl sslv2 ssl2) \
-               $(use_ssl sslv3 ssl3) \
-               $(use_ssl tls-heartbeat heartbeats) \
-               $(use_ssl zlib) \
-               --prefix="${EPREFIX}"/usr \
-               --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
-               --libdir=$(get_libdir) \
-               shared threads \
-               || die
-
-       # Clean out hardcoded flags that openssl uses
-       local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
-               -e 's:^CFLAG=::' \
-               -e 's:-fomit-frame-pointer ::g' \
-               -e 's:-O[0-9] ::g' \
-               -e 's:-march=[-a-z0-9]* ::g' \
-               -e 's:-mcpu=[-a-z0-9]* ::g' \
-               -e 's:-m[a-z0-9]* ::g' \
-       )
-       sed -i \
-               -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
-               -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
-               Makefile || die
-}
-
-multilib_src_compile() {
-       # depend is needed to use $confopts; it also doesn't matter
-       # that it's -j1 as the code itself serializes subdirs
-       emake -j1 depend
-       emake all
-       # rehash is needed to prep the certs/ dir; do this
-       # separately to avoid parallel build issues.
-       emake rehash
-}
-
-multilib_src_test() {
-       emake -j1 test
-}
-
-multilib_src_install() {
-       emake INSTALL_PREFIX="${D}" install
-}
-
-multilib_src_install_all() {
-       # openssl installs perl version of c_rehash by default, but
-       # we provide a shell version via app-misc/c_rehash
-       rm "${ED}"/usr/bin/c_rehash || die
-
-       dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
-       dohtml -r doc/*
-       use rfc3779 && dodoc engines/ccgost/README.gost
-
-       # This is crappy in that the static archives are still built even
-       # when USE=static-libs.  But this is due to a failing in the openssl
-       # build system: the static archives are built as PIC all the time.
-       # Only way around this would be to manually configure+compile openssl
-       # twice; once with shared lib support enabled and once without.
-       use static-libs || find "${ED}"usr/lib* -mindepth 1 -maxdepth 1 \
-               -name "lib*.a" -not -name "lib*$(get_libname)" -delete
-
-       # create the certs directory
-       dodir ${SSL_CNF_DIR}/certs
-       cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
-       rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
-
-       # Namespace openssl programs to prevent conflicts with other man pages
-       cd "${ED}"/usr/share/man
-       local m d s
-       for m in $(find . -type f | xargs grep -L '#include') ; do
-               d=${m%/*} ; d=${d#./} ; m=${m##*/}
-               [[ ${m} == openssl.1* ]] && continue
-               [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links 
already!"
-               mv ${d}/{,ssl-}${m}
-               # fix up references to renamed man pages
-               sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' 
${d}/ssl-${m}
-               ln -s ssl-${m} ${d}/openssl-${m}
-               # locate any symlinks that point to this man page ... we assume
-               # that any broken links are due to the above renaming
-               for s in $(find -L ${d} -type l) ; do
-                       s=${s##*/}
-                       rm -f ${d}/${s}
-                       ln -s ssl-${m} ${d}/ssl-${s}
-                       ln -s ssl-${s} ${d}/openssl-${s}
-               done
-       done
-       [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
-
-       dodir /etc/sandbox.d #254521
-       echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
-
-       diropts -m0700
-       keepdir ${SSL_CNF_DIR}/private
-}
-
-pkg_postinst() {
-       ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild 
hashes #333069"
-       c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
-       eend $?
-}

diff --git a/dev-libs/openssl/openssl-1.0.2l.ebuild 
b/dev-libs/openssl/openssl-1.0.2n.ebuild
similarity index 90%
rename from dev-libs/openssl/openssl-1.0.2l.ebuild
rename to dev-libs/openssl/openssl-1.0.2n.ebuild
index 21850a7d25..b797b4284c 100644
--- a/dev-libs/openssl/openssl-1.0.2l.ebuild
+++ b/dev-libs/openssl/openssl-1.0.2n.ebuild
@@ -1,14 +1,17 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI="6"
 
 inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
 
+PATCH_SET="openssl-1.0.2-patches-1.0"
 MY_P=${P/_/-}
 DESCRIPTION="full-strength general purpose cryptography library (including SSL 
and TLS)"
-HOMEPAGE="http://www.openssl.org/";
-SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
+HOMEPAGE="https://www.openssl.org/";
+SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
+       mirror://gentoo/${PATCH_SET}.tar.xz
+       https://dev.gentoo.org/~whissi/dist/${PN}/${PATCH_SET}.tar.xz";
 
 LICENSE="openssl"
 SLOT="0"
@@ -44,21 +47,14 @@ src_prepare() {
        rm -f Makefile
 
        if ! use vanilla ; then
-               epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
-               epatch "${FILESDIR}"/${PN}-1.0.2i-parallel-build.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch 
#545028
-               epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
-               epatch "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
-               epatch "${FILESDIR}"/${PN}-1.0.1p-default-source.patch #554338
-
-               epatch_user #332661
-
-               # Solaris /bin/sh does not support "[ -e file ]", added by 
patches
-               sed -e 's/\[ -e /\[ -r /' -i Makefile.shared
+               eapply "${WORKDIR}"/patch/*.patch
        fi
 
+       eapply_user
+
+       # Solaris /bin/sh does not support "[ -e file ]", added by patches
+       sed -e 's/\[ -e /\[ -r /' -i Makefile.shared
+
        # disable fips in the build
        # make sure the man pages are suffixed #302165
        # don't bother building man pages if they're disabled
@@ -96,13 +92,12 @@ src_prepare() {
 
        # allow openssl to be cross-compiled
        cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
-       chmod a+rx gentoo.config
+       chmod a+rx gentoo.config || die
 
        append-flags -fno-strict-aliasing
        append-flags $(test-flags-CC -Wa,--noexecstack)
        append-cppflags -DOPENSSL_NO_BUF_FREELISTS
 
-       use prefix-chain && sed -i '1s,^:$,#!/usr/bin/env perl,' Configure 
#141906
        sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
        # The config script does stupid stuff to prompt the user.  Kill it.
        sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
@@ -216,8 +211,9 @@ multilib_src_install_all() {
        # we provide a shell version via app-misc/c_rehash
        rm "${ED}"/usr/bin/c_rehash || die
 
-       dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
-       dohtml -r doc/*
+       local -a DOCS=( CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el 
)
+       einstalldocs
+
        use rfc3779 && dodoc engines/ccgost/README.gost
 
        # This is crappy in that the static archives are still built even

diff --git a/dev-libs/openssl/openssl-1.1.0f.ebuild 
b/dev-libs/openssl/openssl-1.1.0g-r2.ebuild
similarity index 80%
rename from dev-libs/openssl/openssl-1.1.0f.ebuild
rename to dev-libs/openssl/openssl-1.1.0g-r2.ebuild
index 2ae77799e5..6401834253 100644
--- a/dev-libs/openssl/openssl-1.1.0f.ebuild
+++ b/dev-libs/openssl/openssl-1.1.0g-r2.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI="6"
 
 inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
 
@@ -13,7 +13,7 @@ SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
 LICENSE="openssl"
 SLOT="0/1.1" # .so version of libssl/libcrypto
 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"
-IUSE="+asm bindist rfc3779 sctp cpu_flags_x86_sse2 static-libs test 
tls-heartbeat vanilla zlib"
+IUSE="+asm bindist elibc_musl rfc3779 sctp cpu_flags_x86_sse2 static-libs test 
tls-heartbeat vanilla zlib"
 RESTRICT="!bindist? ( bindist )"
 
 RDEPEND=">=app-misc/c_rehash-1.7-r1
@@ -27,6 +27,27 @@ DEPEND="${RDEPEND}
        )"
 PDEPEND="app-misc/ca-certificates"
 
+# This does not copy the entire Fedora patchset, but JUST the parts that
+# are needed to make it safe to use EC with RESTRICT=bindist.
+# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
+SOURCE1=hobble-openssl
+SOURCE12=ec_curve.c
+SOURCE13=ectest.c
+PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
+PATCH37=openssl-1.1.0-ec-curves.patch
+FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
+FEDORA_GIT_BRANCH='f27'
+FEDORA_SRC_URI=()
+FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
+FEDORA_PATCH=( $PATCH1 $PATCH37 )
+for i in "${FEDORA_SOURCE[@]}" ; do
+       FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> 
${P}_${i}" )
+done
+for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
+       FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> 
${i}" )
+done
+SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
+
 S="${WORKDIR}/${MY_P}"
 
 MULTILIB_WRAPPED_HEADERS=(
@@ -35,9 +56,27 @@ MULTILIB_WRAPPED_HEADERS=(
 
 PATCHES=(
        "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
+       "${FILESDIR}"/${PN}-1.1.0g-CVE-2017-3738.patch
 )
 
 src_prepare() {
+       if use bindist; then
+               # This just removes the prefix, and puts it into WORKDIR like 
the RPM.
+               for i in "${FEDORA_SOURCE[@]}" ; do
+                       cp -f "${DISTDIR}"/"${P}_${i}" "${WORKDIR}"/"${i}" || 
die
+               done
+               # .spec %prep
+               bash "${WORKDIR}"/"${SOURCE1}" || die
+               cp -f "${WORKDIR}"/"${SOURCE12}" "${S}"/crypto/ec/ || die
+               cp -f "${WORKDIR}"/"${SOURCE13}" "${S}"/test/ || die
+               for i in "${FEDORA_PATCH[@]}" ; do
+                       epatch "${DISTDIR}"/"${i}"
+               done
+               # Also see the configure parts below:
+               # enable-ec \
+               # $(use_ssl !bindist ec2m) \
+
+       fi
        # keep this in sync with app-misc/c_rehash
        SSL_CNF_DIR="/etc/ssl"
 
@@ -47,11 +86,12 @@ src_prepare() {
 
        if ! use vanilla ; then
                epatch "${PATCHES[@]}"
-               epatch_user #332661
        fi
 
        epatch "${FILESDIR}"/${PN}-1.1.0f-winnt.patch # parity
 
+       eapply_user #332661
+
        # make sure the man pages are suffixed #302165
        # don't bother building man pages if they're disabled
        # Make DOCDIR Gentoo compliant
@@ -134,6 +174,8 @@ multilib_src_configure() {
        local config="Configure"
        [[ -z ${sslout} ]] && config="config"
 
+       # Fedora hobbled-EC needs 'no-ec2m'
+       # 'srp' was restricted until early 2017 as well.
        echoit \
        ./${config} \
                ${sslout} \
@@ -141,7 +183,10 @@ multilib_src_configure() {
                $(use cpu_flags_x86_sse2 || echo "no-sse2") \
                enable-camellia \
                disable-deprecated \
-               $(use_ssl !bindist ec) \
+               enable-ec \
+               $(use_ssl !bindist ec2m) \
+               enable-srp \
+               $(use elibc_musl && echo "no-async") \
                ${ec_nistp_64_gcc_128} \
                enable-idea \
                enable-mdc2 \
@@ -195,7 +240,6 @@ multilib_src_install_all() {
        rm "${ED}"/usr/bin/c_rehash || die
 
        dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
-       dohtml -r doc/*
 
        # This is crappy in that the static archives are still built even
        # when USE=static-libs.  But this is due to a failing in the openssl

Reply via email to