Permalink
Browse files

FL-396: add masked openssl-1.0.1d with upstream patch

  • Loading branch information...
1 parent 089c4c3 commit 76a479c918155993968ef0b3a2efd7efb986e07b @angryvincent angryvincent committed Feb 8, 2013
@@ -4,4 +4,5 @@ DIST openssl-1.0.0j.tar.gz 4047852 SHA256 626fb8fcb3eb7e966edbe71553ff993d137f6e
DIST openssl-1.0.1a.tar.gz 4456456 SHA256 d3487e09d891c772cf946273a3bb0ca47479e7941be6d822274320e7cfcc361b SHA512 ceebecbe60201ebb2c600f97e4e0ed38638789189dc2fae85997d5903eda7884ad6190e21b75c453c28ab36ab9262c30f2732945e78bcecc3090542dd4dafd02 WHIRLPOOL 8448ef79710410a2f2b8a7b7b80798c032273d39a3c3f5c1389a1c45a24dd63a3a5a6ce8902a6d0669f0f2643cd5321e969417d01e5194283a159d1773896a50
DIST openssl-1.0.1b.tar.gz 4456651 SHA256 1187bf2d5cdf0b286b951bf5c777aa97855cd7db24fdb9604cb557c8b1d7364b SHA512 d0cfec093b1a27a14ee6d6dc5da0c19c14b77edf8ba558e909be7cf8c5e29023061ed7ac3c54ffe08ea0c21bb859781c63257e26423a66a117c5887bc65051d2 WHIRLPOOL 552d99cdecba10f208933d5fd2055125769c67576af76c8a50f0d33a4d64cc3165913cddcf5e9a1bed0dec51efbd055beaa8bfdcb079fb8337b22534da741540
DIST openssl-1.0.1c.tar.gz 4457113 SHA256 2a9eb3cd4e8b114eb9179c0d3884d61658e7d8e8bf4984798a5f5bd48e325ebe SHA512 14f766daab0828a2f07c65d6da8469a4a5a2b839ff3da188538c4e2db3e3e2f37217fb37e269617fb438463b75fb77dab0b155f36831ff48edbc9e7f2903ebd3 WHIRLPOOL 15f90cd981ed82cb1891a2e4179a15882f34aa0ecfff7e6a4fa435b9ea021168228504e7cd9e201c8ada1207942784558f2696f5d45293fa876cf143d8826bf7
+DIST openssl-1.0.1d.tar.gz 4459791 SHA256 88a423f9b08a994054583691b968815875580e12df754e881d7cfe9f1bd1f49d SHA512 333c915501cc4998ab1d16251790eeb471ee6cbf30afcba9b7eefd3cec6a50e061b4347e60b751fa4afea15700ef629503931f22cec3ed64723ac3372ca7735e WHIRLPOOL c7045355d2df7cffe69c24002aa4a17bca76454ab9829741b6d54e74367e9e32dbe7c68b0da8cab2e2a4107b4fe9f93fdcea3c4c0d770fd8c6edebc5a9cc64cc
DIST openssl-c_rehash.sh.1.7 4167 SHA256 4999ee79892f52bd6a4a7baba9fac62262454d573bbffd72685d3aae9e48cee0 SHA512 55e8c2e827750a4f375cb83c86bfe2d166c01ffa5d7e9b16657b72b38b747c8985dd2c98f854c911dfbbee2ff3e92aff39fdf089d979b2e3534b7685ee8b80da WHIRLPOOL c88f06a3b8651f76b6289552cccceb64e13f6697c5f0ce3ff114c781ce1c218912b8ee308af9d087cd76a9600fdacda1953175bff07d7d3eb21b0c0b7f4f1ce1
@@ -0,0 +1,76 @@
+https://bugs.gentoo.org/456108
+
+taken from upstream
+
+From 32cc2479b473c49ce869e57fded7e9a77b695c0d Mon Sep 17 00:00:00 2001
+From: "Dr. Stephen Henson" <steve@openssl.org>
+Date: Thu, 7 Feb 2013 21:06:37 +0000
+Subject: [PATCH] Fix IV check and padding removal.
+
+Fix the calculation that checks there is enough room in a record
+after removing padding and optional explicit IV. (by Steve)
+
+For AEAD remove the correct number of padding bytes (by Andy)
+---
+ ssl/s3_cbc.c | 33 ++++++++++++---------------------
+ 1 file changed, 12 insertions(+), 21 deletions(-)
+
+diff --git a/ssl/s3_cbc.c b/ssl/s3_cbc.c
+index ce77acd..0f60507 100644
+--- a/ssl/s3_cbc.c
++++ b/ssl/s3_cbc.c
+@@ -139,31 +139,22 @@ int tls1_cbc_remove_padding(const SSL* s,
+ unsigned mac_size)
+ {
+ unsigned padding_length, good, to_check, i;
+- const char has_explicit_iv =
+- s->version >= TLS1_1_VERSION || s->version == DTLS1_VERSION;
+- const unsigned overhead = 1 /* padding length byte */ +
+- mac_size +
+- (has_explicit_iv ? block_size : 0);
+-
+- /* These lengths are all public so we can test them in non-constant
+- * time. */
+- if (overhead > rec->length)
+- return 0;
+-
+- /* We can always safely skip the explicit IV. We check at the beginning
+- * of this function that the record has at least enough space for the
+- * IV, MAC and padding length byte. (These can be checked in
+- * non-constant time because it's all public information.) So, if the
+- * padding was invalid, then we didn't change |rec->length| and this is
+- * safe. If the padding was valid then we know that we have at least
+- * overhead+padding_length bytes of space and so this is still safe
+- * because overhead accounts for the explicit IV. */
+- if (has_explicit_iv)
++ const unsigned overhead = 1 /* padding length byte */ + mac_size;
++ /* Check if version requires explicit IV */
++ if (s->version >= TLS1_1_VERSION || s->version == DTLS1_VERSION)
+ {
++ /* These lengths are all public so we can test them in
++ * non-constant time.
++ */
++ if (overhead + block_size > rec->length)
++ return 0;
++ /* We can now safely skip explicit IV */
+ rec->data += block_size;
+ rec->input += block_size;
+ rec->length -= block_size;
+ }
++ else if (overhead > rec->length)
++ return 0;
+
+ padding_length = rec->data[rec->length-1];
+
+@@ -190,7 +181,7 @@ int tls1_cbc_remove_padding(const SSL* s,
+ if (EVP_CIPHER_flags(s->enc_read_ctx->cipher)&EVP_CIPH_FLAG_AEAD_CIPHER)
+ {
+ /* padding is already verified */
+- rec->length -= padding_length;
++ rec->length -= padding_length + 1;
+ return 1;
+ }
+
+--
+1.8.0.2
+
@@ -0,0 +1,219 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="4"
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+REV="1.7"
+DESCRIPTION="full-strength general purpose cryptography library (including SSL v2/v3 and TLS v1)"
+HOMEPAGE="http://www.openssl.org/"
+SRC_URI="mirror://openssl/source/${P}.tar.gz
+ http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/${PN}/${PN}-c_rehash.sh?rev=${REV} -> ${PN}-c_rehash.sh.${REV}"
+
+LICENSE="openssl"
+SLOT="0"
+KEYWORDS="~*"
+IUSE="bindist gmp kerberos rfc3779 sse2 static-libs test vanilla zlib"
+
+# Have the sub-libs in RDEPEND with [static-libs] since, logically,
+# our libssl.a depends on libz.a/etc... at runtime.
+LIB_DEPEND="gmp? ( dev-libs/gmp[static-libs(+)] )
+ zlib? ( sys-libs/zlib[static-libs(+)] )
+ kerberos? ( app-crypt/mit-krb5 )"
+# The blocks are temporary just to make sure people upgrade to a
+# version that lack runtime version checking. We'll drop them in
+# the future.
+RDEPEND="static-libs? ( ${LIB_DEPEND} )
+ !static-libs? ( ${LIB_DEPEND//\[static-libs(+)]} )
+ !<net-misc/openssh-5.9_p1-r4
+ !<net-libs/neon-0.29.6-r1"
+DEPEND="${RDEPEND}
+ sys-apps/diffutils
+ >=dev-lang/perl-5
+ test? ( sys-devel/bc )"
+PDEPEND="app-misc/ca-certificates"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ SSL_CNF_DIR="/etc/ssl"
+ sed \
+ -e "/^DIR=/s:=.*:=${SSL_CNF_DIR}:" \
+ "${DISTDIR}"/${PN}-c_rehash.sh.${REV} \
+ > "${WORKDIR}"/c_rehash || die #416717
+}
+
+src_prepare() {
+ # 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
+
+ epatch "${FILESDIR}"/${PN}-1.0.1d-s3-packet.patch
+ if ! use vanilla ; then
+ epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
+ epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743
+ epatch "${FILESDIR}"/${PN}-1.0.0h-pkg-config.patch
+ epatch "${FILESDIR}"/${PN}-1.0.1-parallel-build.patch
+ epatch "${FILESDIR}"/${PN}-1.0.1-x32.patch
+ epatch "${FILESDIR}"/${PN}-1.0.1-ipv6.patch
+ epatch_user #332661
+ 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:=.*:=/usr/share/man:') \
+ Makefile.org \
+ || die
+ # show the actual commands in the log
+ sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
+
+ # allow openssl to be cross-compiled
+ cp "${FILESDIR}"/gentoo.config-1.0.0 gentoo.config || die
+ chmod a+rx gentoo.config
+
+ append-flags -fno-strict-aliasing
+ append-flags $(test-flags-CC -Wa,--noexecstack)
+
+ sed -i '1s,^:$,#!/usr/bin/perl,' Configure #141906
+ ./config --test-sanity || die "I AM NOT SANE"
+}
+
+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: 5,724,428 03/03/2015 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")
+
+ local sslout=$(./gentoo.config)
+ einfo "Use configuration ${sslout:-(openssl knows best)}"
+ local config="Configure"
+ [[ -z ${sslout} ]] && config="config"
+ echoit \
+ ./${config} \
+ ${sslout} \
+ $(use sse2 || echo "no-sse2") \
+ enable-camellia \
+ $(use_ssl !bindist ec) \
+ enable-idea \
+ enable-mdc2 \
+ $(use_ssl !bindist rc5) \
+ enable-tlsext \
+ $(use_ssl gmp gmp -lgmp) \
+ $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
+ $(use_ssl rfc3779) \
+ $(use_ssl zlib) \
+ --prefix=/usr \
+ --openssldir=${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
+}
+
+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
+}
+
+src_test() {
+ emake -j1 test
+}
+
+src_install() {
+ emake INSTALL_PREFIX="${D}" install
+ dobin "${WORKDIR}"/c_rehash #333117
+ 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 || rm -f "${D}"/usr/lib*/lib*.a
+
+ # create the certs directory
+ dodir ${SSL_CNF_DIR}/certs
+ cp -RP certs/* "${D}"${SSL_CNF_DIR}/certs/ || die
+ rm -r "${D}"${SSL_CNF_DIR}/certs/{demo,expired}
+
+ # Namespace openssl programs to prevent conflicts with other man pages
+ cd "${D}"/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"' > "${D}"/etc/sandbox.d/10openssl
+
+ diropts -m0700
+ keepdir ${SSL_CNF_DIR}/private
+}
+
+pkg_preinst() {
+ has_version ${CATEGORY}/${PN}:0.9.8 && return 0
+ preserve_old_lib /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
+}
+
+pkg_postinst() {
+ ebegin "Running 'c_rehash ${ROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
+ c_rehash "${ROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
+ eend $?
+
+ has_version ${CATEGORY}/${PN}:0.9.8 && return 0
+ preserve_old_lib_notify /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
+}
@@ -1,6 +1,10 @@
# Keep the most recent masks in a reverse chrono order
# newest on top
+# Oleg Vinichenko (8 Feb 2013)
+# add masked openssl-1.0.1d with patch, FL-396, openvpn
+>=dev-libs/openssl-1.0.1d-r1
+
# Daniel Molik ( 6 Feb 2013 )
# FL-382, bison-2.7 for testing
=sys-devel/bison-2.7

0 comments on commit 76a479c

Please sign in to comment.