diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/pycrypto |
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/pycrypto')
-rw-r--r-- | dev-python/pycrypto/Manifest | 7 | ||||
-rw-r--r-- | dev-python/pycrypto/files/pycrypto-2.6.1-CVE-2013-7459.patch | 88 | ||||
-rw-r--r-- | dev-python/pycrypto/files/pycrypto-2.6.1-cross-compile.patch | 13 | ||||
-rw-r--r-- | dev-python/pycrypto/metadata.xml | 41 | ||||
-rw-r--r-- | dev-python/pycrypto/pycrypto-2.6.1-r2.ebuild | 74 |
5 files changed, 223 insertions, 0 deletions
diff --git a/dev-python/pycrypto/Manifest b/dev-python/pycrypto/Manifest new file mode 100644 index 000000000000..a73f34a39c48 --- /dev/null +++ b/dev-python/pycrypto/Manifest @@ -0,0 +1,7 @@ +AUX pycrypto-2.6.1-CVE-2013-7459.patch 3808 SHA256 71310698e88a7b960467ec2107e0aaed1cb106d0d7b8b4f381ee9cdf4d9a7c7a SHA512 b34a28fa886ad749878aee17459307fb3006f392304a368e9c80b9beac78b1bca2f35831664e504097996ae1be4e1e81eae5e68b211e47fbf11f2b05b2379fb8 WHIRLPOOL 5736f96de5cb33164ef4aa9cde2a9a8beb86e9a473af42883fc6efaea9c3a271859d12b998d5d5b4f57a91f1f8d15312f595b1aa02f7915d9327951924a20e58 +AUX pycrypto-2.6.1-cross-compile.patch 489 SHA256 6d304658a9df6af7b45726211232ece69a333af822e108d463e0aea7ff6f042a SHA512 fbf1f5b6d065725e84594c1493d0d795a9f8c73d9e873f28b473ebc6bf2f346330d5a92362e1dc09f465227f0bc839ccfaf8dc0011c21323ac80931f74b16fca WHIRLPOOL da5fe27384cc0b96f9644de68ccab3309344a4a8c6a52a1c1ba86782976a440e9114bd05df38bc32a35be33dacfe27451536158d748ceb212ef3b0f8ad68a6d7 +DIST pycrypto-2.6.1.tar.gz 446240 SHA256 f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c SHA512 20a4aed4dac4e9e61d773ebc1d48ea577e9870c33f396be53d075a9bf8487d93e75e200179882d81e452efd0f6751789bac434f6f431b3e7c1c8ef9dba392847 WHIRLPOOL b63734145729f75838357002956297d1ea9e51288939e6f481eaaa12c7da256ab95e4d80d19e618445224fb46a8e2cb1ef5ee0b4b817767d472e3a7c4707371b +EBUILD pycrypto-2.6.1-r2.ebuild 2105 SHA256 98b0a20fc2f3924008d257bdf083c3075d44696fb4a33842690ff25655bce378 SHA512 122808e523aa259994f6b729ff3fc51db168caa9c95ce30d09ee76ee647233ef0578bca6f6d099ac420828b3537152ac5ca309c2ada25a5ab27ab94f74a07fa4 WHIRLPOOL c722b7c22724b1263a1cc70f98fe2439e1536a3480730dba724b79744b13223506bef9f5e3e256cb52e3cc176719c575ee0817d3985afd087cc0669575fb9843 +MISC ChangeLog 3724 SHA256 a1f05938252306b3ecf0a60712adef6188f514507e51b1d9db77b0a9edd3a429 SHA512 7d71cb6bb8b4bab6a8d80ca955cac690771dfce0607fe8a9785fab3dd6370fda7d4f779f6266c9c02215106ea99880c0944a90043594246e88672103d172465e WHIRLPOOL b709e0564a10a3cf183adeae889c8e0cd9c1b5d185e3f614e37fdcd3370698cc76831f22909155b914f2131e996585a73f04987c680f31c1a734655b8f68ed57 +MISC ChangeLog-2015 20705 SHA256 df7e79d5b6c1f6f38766f62f93d2737a28716afcba9bbd4caf7df210d32761fe SHA512 7282245643d692809eabb17f7dc577e392e588205a18b0eca18ddf20b731cbe8d5aba62bd452f629af9c04be0a0ae65e4ff108d9a28eeadf3be13814331c37aa WHIRLPOOL 440dc71c24353b850e1fe75784e7c3db063b3146e586205f1f350ce0f4f7468b8235ceeedbf10db4845a4faf99b620a2fa462f218c2e771f59716314abcd1b27 +MISC metadata.xml 1865 SHA256 61a22d1f6be3749beb676da24b9e2312829be12f9e0d40075b1a832522358d2a SHA512 fea8edfeb21d9ebd9029a2a68b8612bc62aa5c7fb13b01c940ac9d0c45e60dcaec207cef6db6ad08c551a281daa133b7365e615346b8acf43613aeb40214e763 WHIRLPOOL c4dad89b2933c8179aa8abc50f5e06f08c2a8b313655e3309b8b9339985b22a74b591eccde70c26157f3e7816e9c747d373ac512dfb9b3bb4a458881f0cc3c5b diff --git a/dev-python/pycrypto/files/pycrypto-2.6.1-CVE-2013-7459.patch b/dev-python/pycrypto/files/pycrypto-2.6.1-CVE-2013-7459.patch new file mode 100644 index 000000000000..9850f0340510 --- /dev/null +++ b/dev-python/pycrypto/files/pycrypto-2.6.1-CVE-2013-7459.patch @@ -0,0 +1,88 @@ +From 8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 Mon Sep 17 00:00:00 2001 +From: Legrandin <helderijs@gmail.com> +Date: Sun, 22 Dec 2013 22:24:46 +0100 +Subject: [PATCH] Throw exception when IV is used with ECB or CTR + +The IV parameter is currently ignored when initializing +a cipher in ECB or CTR mode. + +For CTR mode, it is confusing: it takes some time to see +that a different parameter is needed (the counter). + +For ECB mode, it is outright dangerous. + +This patch forces an exception to be raised. +--- + lib/Crypto/SelfTest/Cipher/common.py | 31 +++++++++++++++++++++++-------- + src/block_template.c | 11 +++++++++++ + 2 files changed, 34 insertions(+), 8 deletions(-) + +diff --git a/lib/Crypto/SelfTest/Cipher/common.py b/lib/Crypto/SelfTest/Cipher/common.py +index 420b6ff..a5f8a88 100644 +--- a/lib/Crypto/SelfTest/Cipher/common.py ++++ b/lib/Crypto/SelfTest/Cipher/common.py +@@ -239,19 +239,34 @@ def shortDescription(self): + return """%s .decrypt() output of .encrypt() should not be garbled""" % (self.module_name,) + + def runTest(self): +- for mode in (self.module.MODE_ECB, self.module.MODE_CBC, self.module.MODE_CFB, self.module.MODE_OFB, self.module.MODE_OPENPGP): ++ ++ ## ECB mode ++ mode = self.module.MODE_ECB ++ encryption_cipher = self.module.new(a2b_hex(self.key), mode) ++ ciphertext = encryption_cipher.encrypt(self.plaintext) ++ decryption_cipher = self.module.new(a2b_hex(self.key), mode) ++ decrypted_plaintext = decryption_cipher.decrypt(ciphertext) ++ self.assertEqual(self.plaintext, decrypted_plaintext) ++ ++ ## OPENPGP mode ++ mode = self.module.MODE_OPENPGP ++ encryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) ++ eiv_ciphertext = encryption_cipher.encrypt(self.plaintext) ++ eiv = eiv_ciphertext[:self.module.block_size+2] ++ ciphertext = eiv_ciphertext[self.module.block_size+2:] ++ decryption_cipher = self.module.new(a2b_hex(self.key), mode, eiv) ++ decrypted_plaintext = decryption_cipher.decrypt(ciphertext) ++ self.assertEqual(self.plaintext, decrypted_plaintext) ++ ++ ## All other non-AEAD modes (but CTR) ++ for mode in (self.module.MODE_CBC, self.module.MODE_CFB, self.module.MODE_OFB): + encryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) + ciphertext = encryption_cipher.encrypt(self.plaintext) +- +- if mode != self.module.MODE_OPENPGP: +- decryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) +- else: +- eiv = ciphertext[:self.module.block_size+2] +- ciphertext = ciphertext[self.module.block_size+2:] +- decryption_cipher = self.module.new(a2b_hex(self.key), mode, eiv) ++ decryption_cipher = self.module.new(a2b_hex(self.key), mode, self.iv) + decrypted_plaintext = decryption_cipher.decrypt(ciphertext) + self.assertEqual(self.plaintext, decrypted_plaintext) + ++ + class PGPTest(unittest.TestCase): + def __init__(self, module, params): + unittest.TestCase.__init__(self) +diff --git a/src/block_template.c b/src/block_template.c +index f940e0e..d555ceb 100644 +--- a/src/block_template.c ++++ b/src/block_template.c +@@ -170,6 +170,17 @@ ALGnew(PyObject *self, PyObject *args, PyObject *kwdict) + "Key cannot be the null string"); + return NULL; + } ++ if (IVlen != 0 && mode == MODE_ECB) ++ { ++ PyErr_Format(PyExc_ValueError, "ECB mode does not use IV"); ++ return NULL; ++ } ++ if (IVlen != 0 && mode == MODE_CTR) ++ { ++ PyErr_Format(PyExc_ValueError, ++ "CTR mode needs counter parameter, not IV"); ++ return NULL; ++ } + if (IVlen != BLOCK_SIZE && mode != MODE_ECB && mode != MODE_CTR) + { + PyErr_Format(PyExc_ValueError, diff --git a/dev-python/pycrypto/files/pycrypto-2.6.1-cross-compile.patch b/dev-python/pycrypto/files/pycrypto-2.6.1-cross-compile.patch new file mode 100644 index 000000000000..2ce24a49cc71 --- /dev/null +++ b/dev-python/pycrypto/files/pycrypto-2.6.1-cross-compile.patch @@ -0,0 +1,13 @@ +do not hardcode -I/usr/include as it's useless and breaks cross-compiles + +--- a/setup.py ++++ b/setup.py +@@ -370,7 +370,7 @@ kw = {'name':"pycrypto", + 'ext_modules': plat_ext + [ + # _fastmath (uses GNU mp library) + Extension("Crypto.PublicKey._fastmath", +- include_dirs=['src/','/usr/include/'], ++ include_dirs=['src/'], + libraries=['gmp'], + sources=["src/_fastmath.c"]), + diff --git a/dev-python/pycrypto/metadata.xml b/dev-python/pycrypto/metadata.xml new file mode 100644 index 000000000000..e3ad12eae841 --- /dev/null +++ b/dev-python/pycrypto/metadata.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <longdescription> +The Python Cryptography Toolkit is a collection of cryptographic +algorithms and protocols, implemented for use from Python. Among +the contents of the package: + + * Hash functions: MD2, MD4, RIPEMD, SHA256. + * Block encryption algorithms: AES, ARC2, Blowfish, CAST, DES, + Triple-DES, IDEA, RC5. + * Stream encryption algorithms: ARC4, simple XOR. + * Public-key algorithms: RSA, DSA, ElGamal, qNEW. + * Protocols: All-or-nothing transforms, chaffing/winnowing. + * Miscellaneous: RFC1751 module for converting 128-key keys into + a set of English words, primality testing. + * Some demo programs (currently all quite old and outdated). + +</longdescription> + <longdescription lang="ja"> +このPython言語のクリプトグラフィー・ツールキットは、暗号手法のアルゴリズムとプロ +トコルの集合で、Python言語から利用されるための実装です。このパッケージ内容は以下 +です。 + + + * Hash ファンクション: MD2, MD4, RIPEMD, SHA256. + * ブロック・エンクリプション・アルゴリズム: AES, ARC2, Blowfish, CAST, DES, + Triple-DES, IDEA, RC5. + * ストリーム・エンクリプション・アルゴリズム: ARC4, simple XOR. + * 公開鍵アルゴリズム: RSA, DSA, ElGamal, qNEW. + * プロトコル: All-or-nothing transforms, chaffing/winnowing. + * その他: RFC1751 module for converting 128-key keys into + a set of English words, primality testing. + * デモ・プログラム(現在では完全に古く時代遅れなもの) + +</longdescription> +</pkgmetadata> diff --git a/dev-python/pycrypto/pycrypto-2.6.1-r2.ebuild b/dev-python/pycrypto/pycrypto-2.6.1-r2.ebuild new file mode 100644 index 000000000000..d5de62ef8300 --- /dev/null +++ b/dev-python/pycrypto/pycrypto-2.6.1-r2.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 flag-o-matic + +DESCRIPTION="Python Cryptography Toolkit" +HOMEPAGE="http://www.dlitz.net/software/pycrypto/ https://pypi.python.org/pypi/pycrypto" +SRC_URI="http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/${P}.tar.gz" + +LICENSE="PSF-2 public-domain" +SLOT="0" +KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x86-solaris" +IUSE="doc +gmp test" + +RDEPEND="gmp? ( dev-libs/gmp:0= )" +DEPEND="${RDEPEND} + doc? ( + dev-python/docutils[${PYTHON_USEDEP}] + $(python_gen_cond_dep '>=dev-python/epydoc-3[${PYTHON_USEDEP}]' 'python2*') + )" + +REQUIRED_USE="test? ( gmp )" + +DOCS=( ACKS ChangeLog README TODO ) +PATCHES=( + "${FILESDIR}"/${P}-cross-compile.patch + "${FILESDIR}"/${P}-CVE-2013-7459.patch +) + +python_prepare_all() { + # Fix Crypto.PublicKey.RSA._RSAobj.exportKey(format="OpenSSH") with Python 3 + # https://github.com/dlitz/pycrypto/commit/ab25c6fe95ee92fac3187dcd90e0560ccacb084a + sed \ + -e "/keyparts =/s/'ssh-rsa'/b('ssh-rsa')/" \ + -e "s/keystring = ''.join/keystring = b('').join/" \ + -e "s/return 'ssh-rsa '/return b('ssh-rsa ')/" \ + -i lib/Crypto/PublicKey/RSA.py || die + + distutils-r1_python_prepare_all +} + +python_configure_all() { + # the configure does not interact with python in any way, + # it just sets up the C header file. + econf \ + $(use_with gmp) \ + --without-mpir +} + +python_compile_all() { + if use doc; then + rst2html.py Doc/pycrypt.rst > Doc/index.html || die + epydoc --config=Doc/epydoc-config --exclude-introspect="^Crypto\.(Random\.OSRNG\.nt|Util\.winrandom)$" || die + HTML_DOCS=( Doc/apidoc/. Doc/index.html ) + fi +} + +python_compile() { + if ! python_is_python3; then + local -x CFLAGS="${CFLAGS}" + append-cflags -fno-strict-aliasing + fi + + distutils-r1_python_compile +} + +python_test() { + esetup.py test +} |