summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Polatel <hawking@gentoo.org>2007-07-22 03:15:22 +0000
committerAli Polatel <hawking@gentoo.org>2007-07-22 03:15:22 +0000
commitc1e92e587d31074ad0e544448fcb213879740ee1 (patch)
treecbe27c24208d24d58b8678a941f408bece6197e3 /dev-python/pycrypto
parentstable on ppc64 (diff)
downloadgentoo-2-c1e92e587d31074ad0e544448fcb213879740ee1.tar.gz
gentoo-2-c1e92e587d31074ad0e544448fcb213879740ee1.tar.bz2
gentoo-2-c1e92e587d31074ad0e544448fcb213879740ee1.zip
Fix from upstream for SHA256 #164462
(Portage version: 2.1.3_rc8)
Diffstat (limited to 'dev-python/pycrypto')
-rw-r--r--dev-python/pycrypto/ChangeLog10
-rw-r--r--dev-python/pycrypto/files/digest-pycrypto-2.0.1-r63
-rw-r--r--dev-python/pycrypto/files/pycrypto-2.0.1-sha256-2.patch87
-rw-r--r--dev-python/pycrypto/pycrypto-2.0.1-r6.ebuild54
4 files changed, 152 insertions, 2 deletions
diff --git a/dev-python/pycrypto/ChangeLog b/dev-python/pycrypto/ChangeLog
index 8ba4793a6eb3..36fcb051109e 100644
--- a/dev-python/pycrypto/ChangeLog
+++ b/dev-python/pycrypto/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-python/pycrypto
-# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/ChangeLog,v 1.55 2006/10/17 07:12:24 uberlord Exp $
+# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/ChangeLog,v 1.56 2007/07/22 03:15:22 hawking Exp $
+
+*pycrypto-2.0.1-r6 (22 Jul 2007)
+
+ 22 Jul 2007; Ali Polatel <hawking@gentoo.org>
+ +files/pycrypto-2.0.1-sha256-2.patch, +pycrypto-2.0.1-r6.ebuild:
+ Fix from upstream for SHA256 #164462
17 Oct 2006; Roy Marples <uberlord@gentoo.org> pycrypto-2.0.1-r5.ebuild:
Added ~sparc-fbsd keyword.
diff --git a/dev-python/pycrypto/files/digest-pycrypto-2.0.1-r6 b/dev-python/pycrypto/files/digest-pycrypto-2.0.1-r6
new file mode 100644
index 000000000000..4e5b88462ffb
--- /dev/null
+++ b/dev-python/pycrypto/files/digest-pycrypto-2.0.1-r6
@@ -0,0 +1,3 @@
+MD5 4d5674f3898a573691ffb335e8d749cd pycrypto-2.0.1.tar.gz 154292
+RMD160 5ce938a24f77f414e42680c17ef9b6dc8de94a2e pycrypto-2.0.1.tar.gz 154292
+SHA256 b08d4ed54c9403c77778a3803e53a4f33f359b42d94f6f3e14abb1bf4941e6ea pycrypto-2.0.1.tar.gz 154292
diff --git a/dev-python/pycrypto/files/pycrypto-2.0.1-sha256-2.patch b/dev-python/pycrypto/files/pycrypto-2.0.1-sha256-2.patch
new file mode 100644
index 000000000000..92dca822c55f
--- /dev/null
+++ b/dev-python/pycrypto/files/pycrypto-2.0.1-sha256-2.patch
@@ -0,0 +1,87 @@
+http://bugs.gentoo.org/164462
+
+===================================================================
+RCS file: /cvsroot/pycrypto/crypto/src/SHA256.c,v
+retrieving revision 1.4
+retrieving revision 1.5
+diff -u -r1.4 -r1.5
+--- pycrypto/src/SHA256.c 29 Nov 2005 16:31:36 -0000 1.4
++++ pycrypto/src/SHA256.c 29 Nov 2005 18:16:22 -0000 1.5
+@@ -25,7 +25,8 @@
+ #endif
+
+ typedef struct {
+- U32 state[8], length, curlen;
++ U32 state[8], curlen;
++ U32 length_upper, length_lower;
+ unsigned char buf[64];
+ }
+ hash_state;
+@@ -100,7 +101,7 @@
+ /* init the SHA state */
+ void sha_init(hash_state * md)
+ {
+- md->curlen = md->length = 0;
++ md->curlen = md->length_upper = md->length_lower = 0;
+ md->state[0] = 0x6A09E667UL;
+ md->state[1] = 0xBB67AE85UL;
+ md->state[2] = 0x3C6EF372UL;
+@@ -119,8 +120,13 @@
+
+ /* is 64 bytes full? */
+ if (md->curlen == 64) {
++ U32 orig_length;
+ sha_compress(md);
+- md->length += 512;
++ orig_length = md->length_lower;
++ md->length_lower += 512;
++ if (orig_length > md->length_lower) {
++ md->length_upper++;
++ }
+ md->curlen = 0;
+ }
+ }
+@@ -129,17 +135,22 @@
+ void sha_done(hash_state * md, unsigned char *hash)
+ {
+ int i;
++ U32 orig_length;
+
+ /* increase the length of the message */
+- md->length += md->curlen * 8;
++ orig_length = md->length_lower;
++ md->length_lower += md->curlen * 8;
++ if (orig_length > md->length_lower) {
++ md->length_upper++;
++ }
+
+ /* append the '1' bit */
+ md->buf[md->curlen++] = 0x80;
+
+ /* if the length is currently above 56 bytes we append zeros
+- * then compress. Then we can fall back to padding zeros and length
+- * encoding like normal.
+- */
++ * then compress. Then we can fall back to padding zeros and length
++ * encoding like normal.
++ */
+ if (md->curlen > 56) {
+ for (; md->curlen < 64;)
+ md->buf[md->curlen++] = 0;
+@@ -151,13 +162,11 @@
+ for (; md->curlen < 56;)
+ md->buf[md->curlen++] = 0;
+
+- /* since all messages are under 2^32 bits we mark the top bits zero */
+- for (i = 56; i < 60; i++)
+- md->buf[i] = 0;
+-
+ /* append length */
++ for (i = 56; i < 60; i++)
++ md->buf[i] = (md->length_upper >> ((59 - i) * 8)) & 255;
+ for (i = 60; i < 64; i++)
+- md->buf[i] = (md->length >> ((63 - i) * 8)) & 255;
++ md->buf[i] = (md->length_lower >> ((63 - i) * 8)) & 255;
+ sha_compress(md);
+
+ /* copy output */
diff --git a/dev-python/pycrypto/pycrypto-2.0.1-r6.ebuild b/dev-python/pycrypto/pycrypto-2.0.1-r6.ebuild
new file mode 100644
index 000000000000..5ebd726f16d5
--- /dev/null
+++ b/dev-python/pycrypto/pycrypto-2.0.1-r6.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/pycrypto-2.0.1-r6.ebuild,v 1.1 2007/07/22 03:15:22 hawking Exp $
+
+inherit eutils distutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="Python Cryptography Toolkit"
+HOMEPAGE="http://www.amk.ca/python/code/crypto.html"
+SRC_URI="http://www.amk.ca/files/python/crypto/${P}.tar.gz"
+
+LICENSE="freedist"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="bindist gmp test"
+
+RDEPEND="virtual/python
+ gmp? ( dev-libs/gmp )"
+DEPEND="${RDEPEND}
+ test? ( =dev-python/sancho-0.11-r1 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ use bindist && epatch "${FILESDIR}"/${P}-bindist.patch
+ epatch "${FILESDIR}"/${P}-sha256.patch
+ epatch "${FILESDIR}"/${P}-sha256-2.patch
+ epatch "${FILESDIR}"/${P}-gmp.patch
+ epatch "${FILESDIR}"/${P}-uint32.patch
+ epatch "${FILESDIR}"/${P}-sancho-package-rename.patch
+}
+
+src_compile() {
+ use gmp \
+ && export USE_GMP=1 \
+ || export USE_GMP=0
+ # sha256 hashes occasionally trigger ssp when built with
+ # -finline-functions (implied by -O3).
+ gcc-specs-ssp && append-flags -fno-inline-functions
+ distutils_src_compile
+}
+
+src_test() {
+ export PYTHONPATH=$(ls -d "${S}"/build/lib.*/)
+ python ./test.py || die "test failed"
+ if use test ; then
+ local x
+ cd test
+ for x in test_*.py ; do
+ python ${x} || die "${x} failed"
+ done
+ fi
+}
+
+DOCS="ACKS ChangeLog PKG-INFO README TODO Doc/pycrypt.tex"