summaryrefslogtreecommitdiff
path: root/dev-python/pycryptodome
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-11-14 22:34:48 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-11-14 22:34:48 +0000
commitcc83ac38154440239f732731b8df86ce322c615e (patch)
tree18fc63c9dac77b03150b94ffd85b724863187af3 /dev-python/pycryptodome
parentdfd7c8230bca447ee0b09dc11150181b0b3148e2 (diff)
gentoo auto-resync : 14:11:2023 - 22:34:48
Diffstat (limited to 'dev-python/pycryptodome')
-rw-r--r--dev-python/pycryptodome/Manifest3
-rw-r--r--dev-python/pycryptodome/files/pycryptodome-3.19.0-fix-verbosity-in-tests.patch120
-rw-r--r--dev-python/pycryptodome/pycryptodome-3.19.0.ebuild61
3 files changed, 184 insertions, 0 deletions
diff --git a/dev-python/pycryptodome/Manifest b/dev-python/pycryptodome/Manifest
index 1211769829ff..00b1906b37f1 100644
--- a/dev-python/pycryptodome/Manifest
+++ b/dev-python/pycryptodome/Manifest
@@ -1,5 +1,8 @@
AUX pycryptodome-3.10.1-system-libtomcrypt.patch 1729 BLAKE2B 57a2022ef17e0b86e98b085336f5ce815304e326a5a2bd5cc8ff5d33b6efba440505767517b79c2f0bba39ab33f04d7434a3f0ee529b880ff7552aee2805dab5 SHA512 d53677c0ad96f161f9aed14b8f353a8cc12c92f31de9733789f9c4151710376d33e974fd611b763de94c631796d7a57cd8787656e3c1e985696e20537b34760e
AUX pycryptodome-3.18.0-python3.12-unittest.patch 974 BLAKE2B ceffed2878cbaa96ffeb500ecf2a855ef0e1f22b5e2f762241b3fe920b3e9117f1e4c7b7179bccdbcfd65ea12ec17a21cd697f5842610e368fc2e7b5275a40a4 SHA512 9db569a809048007eb4ef6e34426f70535a23e64e7037871eef1a65af8809022155ca31efb2eefac83f4221f03d82328645ff87b313714711d53b661c160eebf
+AUX pycryptodome-3.19.0-fix-verbosity-in-tests.patch 4023 BLAKE2B a2e93417ef67b38e4b9b938ad1b233e1e7fa1935b5363b46e35d8977e9aef4471db578cf77c93d56e41f98b9644f4e1b7e3475352a7211073fc2ae74d8dc51a7 SHA512 ae32efc54c9c4342f123814f3c80800fee480dba7076ebd37205bb83caef5e4d1d4a45d0fddb4d8ddbf86f3e239c9ac7ab1924bd576317aa8551a0069388a9d1
DIST pycryptodome-3.18.0.gh.tar.gz 16720227 BLAKE2B dfdc3a7cc0b1aea1e7b7d8f6e8bcf651ca92f0020e2c51849512d00e716283537feb884cacdc655d99a6b992305db9b899172d022bc9ff65d6349ee40b40c4d5 SHA512 a30a6b406bfd1d4288169924924636246c36999ca1e14c5cb70bd2f71ce25739dae04726ca97bdaebf7a8b36927cc6f617fbe2599fad48512a2c5e016a528247
+DIST pycryptodome-3.19.0.gh.tar.gz 17153954 BLAKE2B 5ecaacce490e5eec052d632b1427a4e36ba19a863c28934f53f247b945bb32a1367aeaf1b8669018978bd19d53c28a00f711158c6be014779c47c48f263b2e8c SHA512 1afa71336da38efb32f79d87b442a1d50537a6908ec153be7a087027a8540cebabab12922557c92e501f2d6da5c2f35466d3bbe6a3de44540de7278069691290
EBUILD pycryptodome-3.18.0.ebuild 1451 BLAKE2B 325731accff1f84d62f7cac266f448dfc634d8c2f86d74a8e619b950d45c0a4fa412652dbe15eb8954bd414cd4218f2bb4c314927667f4e62672f924f22ea785 SHA512 eaff84a17c372dd8dfa67b933b37a55987073c7c31439effc095c0b187f6f1ca937fe2bfb7b2e03d4cb25c182d9e5893b4102c39183d6d7e86f6be1c6945171b
+EBUILD pycryptodome-3.19.0.ebuild 1439 BLAKE2B 8022463703b062d4f8da02d1b8c75b356b971a726ade530e91607003f103405d7014aa5972c687abb0eb6c6d18a214be474a5151cdb93eebbeaf3b76ea984567 SHA512 bd20990d91061c6db92e01162ab92663e8741a53f641a33fddff127221213853e1ca21e161ff124e61e4e5544c3c65b0d09725e272d6807f51995c1ea97e0bc4
MISC metadata.xml 386 BLAKE2B 1ec04c0cb752414f063177e637f1fc3e3c401db0c1f245cb33a3690e25597098b25fb2cd5f3ab99838a8bf8339906e2b23e325af5c7248fd880563c872c6fb60 SHA512 f19e2537c5a985389182860eaa45ae68a37ef1167c4b76b452513987fae6fcfb3534d102a079a003770372bbdb4f1997460c982b355f76d09f2387996e18091b
diff --git a/dev-python/pycryptodome/files/pycryptodome-3.19.0-fix-verbosity-in-tests.patch b/dev-python/pycryptodome/files/pycryptodome-3.19.0-fix-verbosity-in-tests.patch
new file mode 100644
index 000000000000..7d54e5e4c2a7
--- /dev/null
+++ b/dev-python/pycryptodome/files/pycryptodome-3.19.0-fix-verbosity-in-tests.patch
@@ -0,0 +1,120 @@
+https://github.com/Legrandin/pycryptodome/issues/765
+https://github.com/Legrandin/pycryptodome/commit/87ff66373a5b80cddc9b0dd76e9bb8c15f6a8e50
+
+From 87ff66373a5b80cddc9b0dd76e9bb8c15f6a8e50 Mon Sep 17 00:00:00 2001
+From: Helder Eijs <helderijs@gmail.com>
+Date: Sun, 17 Sep 2023 23:32:02 +0200
+Subject: [PATCH] Fix verbosity problem in tests
+
+--- a/lib/Crypto/SelfTest/Protocol/test_ecdh.py
++++ b/lib/Crypto/SelfTest/Protocol/test_ecdh.py
+@@ -72,6 +72,8 @@ def ecdh_test_rev(self,
+
+ class TestVectorsECDHWycheproof(unittest.TestCase):
+
++ desc = "Wycheproof ECDH tests"
++
+ def add_tests(self, filename):
+
+ def curve(g):
+@@ -107,7 +109,6 @@ def shortDescription(self):
+ return self.desc
+
+ def test_verify(self, tv):
+- self._id = "Wycheproof ECDH Verify Test #%d (%s, %s)" % (tv.id, tv.comment, tv.filename)
+
+ if len(tv.public) == 0:
+ return
+@@ -138,7 +139,7 @@ def test_verify(self, tv):
+
+ def runTest(self):
+ for tv in self.tv:
+- self.desc = "Test #%d (%s) - %s" % (tv.id, tv.filename, tv.comment)
++ self.desc = "Wycheproof ECDH Verify Test #%d (%s, %s)" % (tv.id, tv.comment, tv.filename)
+ self.test_verify(tv)
+
+
+--- a/lib/Crypto/SelfTest/__init__.py
++++ b/lib/Crypto/SelfTest/__init__.py
+@@ -28,18 +28,19 @@
+ application runs.
+ """
+
+-__revision__ = "$Id$"
+-
+ import sys
+ import unittest
++from importlib import import_module
+ from Crypto.Util.py3compat import StringIO
+
++
+ class SelfTestError(Exception):
+ def __init__(self, message, result):
+ Exception.__init__(self, message, result)
+ self.message = message
+ self.result = result
+
++
+ def run(module=None, verbosity=0, stream=None, tests=None, config=None, **kwargs):
+ """Execute self-tests.
+
+@@ -77,21 +78,25 @@ def run(module=None, verbosity=0, stream=None, tests=None, config=None, **kwargs
+ raise SelfTestError("Self-test failed", result)
+ return result
+
++
+ def get_tests(config={}):
+ tests = []
+- from Crypto.SelfTest import Cipher; tests += Cipher.get_tests(config=config)
+- from Crypto.SelfTest import Hash; tests += Hash.get_tests(config=config)
+- from Crypto.SelfTest import Protocol; tests += Protocol.get_tests(config=config)
+- from Crypto.SelfTest import PublicKey; tests += PublicKey.get_tests(config=config)
+- from Crypto.SelfTest import Random; tests += Random.get_tests(config=config)
+- from Crypto.SelfTest import Util; tests += Util.get_tests(config=config)
+- from Crypto.SelfTest import Signature; tests += Signature.get_tests(config=config)
+- from Crypto.SelfTest import IO; tests += IO.get_tests(config=config)
+- from Crypto.SelfTest import Math; tests += Math.get_tests(config=config)
++
++ module_names = [
++ "Cipher", "Hash", "Protocol", "PublicKey", "Random",
++ "Util", "Signature", "IO", "Math",
++ ]
++
++ for name in module_names:
++ module = import_module("Crypto.SelfTest." + name)
++ tests += module.get_tests(config=config)
++
+ return tests
+
++
+ if __name__ == '__main__':
+- suite = lambda: unittest.TestSuite(get_tests())
++ def suite():
++ return unittest.TestSuite(get_tests())
+ unittest.main(defaultTest='suite')
+
+ # vim:set ts=4 sw=4 sts=4 expandtab:
+--- a/lib/Crypto/SelfTest/__main__.py
++++ b/lib/Crypto/SelfTest/__main__.py
+@@ -26,7 +26,7 @@
+
+ from Crypto import SelfTest
+
+-slow_tests = not "--skip-slow-tests" in sys.argv
++slow_tests = not ("--skip-slow-tests" in sys.argv)
+ if not slow_tests:
+ print("Skipping slow tests")
+
+@@ -34,5 +34,10 @@
+ if wycheproof_warnings:
+ print("Printing Wycheproof warnings")
+
+-config = {'slow_tests' : slow_tests, 'wycheproof_warnings' : wycheproof_warnings }
+-SelfTest.run(stream=sys.stdout, verbosity=1, config=config)
++if "-v" in sys.argv:
++ verbosity=2
++else:
++ verbosity=1
++
++config = {'slow_tests': slow_tests, 'wycheproof_warnings': wycheproof_warnings}
++SelfTest.run(stream=sys.stdout, verbosity=verbosity, config=config)
diff --git a/dev-python/pycryptodome/pycryptodome-3.19.0.ebuild b/dev-python/pycryptodome/pycryptodome-3.19.0.ebuild
new file mode 100644
index 000000000000..f7c07f2ea6a3
--- /dev/null
+++ b/dev-python/pycryptodome/pycryptodome-3.19.0.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} pypy3 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="A self-contained cryptographic library for Python"
+HOMEPAGE="
+ https://www.pycryptodome.org/
+ https://github.com/Legrandin/pycryptodome/
+ https://pypi.org/project/pycryptodome/
+"
+SRC_URI="
+ https://github.com/Legrandin/pycryptodome/archive/v${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="BSD-2 Unlicense"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+
+DEPEND="
+ dev-libs/gmp:=
+ >=dev-libs/libtomcrypt-1.18.2-r1:=
+"
+BDEPEND="
+ $(python_gen_cond_dep 'dev-python/cffi[${PYTHON_USEDEP}]' 'python*')
+"
+RDEPEND="
+ ${DEPEND}
+ ${BDEPEND}
+"
+
+PATCHES=(
+ "${FILESDIR}/pycryptodome-3.10.1-system-libtomcrypt.patch"
+ "${FILESDIR}/pycryptodome-3.19.0-fix-verbosity-in-tests.patch"
+)
+
+python_prepare_all() {
+ # make sure we're unbundling it correctly
+ rm -r src/libtom || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ local -x PYTHONPATH=${S}/test_vectors:${PYTHONPATH}
+ "${EPYTHON}" - <<-EOF || die
+ import sys
+ from Crypto import SelfTest
+ SelfTest.run(verbosity=2, stream=sys.stdout)
+ EOF
+
+ # TODO: run cmake tests from src/test?
+}