summaryrefslogtreecommitdiff
path: root/dev-python/pycryptodome
diff options
context:
space:
mode:
authorLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2024-01-05 17:40:16 +0000
committerLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2024-01-05 17:40:16 +0000
commite7acd8ed609ef7de957c1d01bb65281016772a3c (patch)
tree500390487cabe6933e98416c91777f98279dae14 /dev-python/pycryptodome
parenta19bd1c7eecc3ba68fb96e2207061e3dfc5179a5 (diff)
downloadbaldeagleos-repo-e7acd8ed609ef7de957c1d01bb65281016772a3c.tar.gz
baldeagleos-repo-e7acd8ed609ef7de957c1d01bb65281016772a3c.tar.xz
baldeagleos-repo-e7acd8ed609ef7de957c1d01bb65281016772a3c.zip
Adding metadata
Diffstat (limited to 'dev-python/pycryptodome')
-rw-r--r--dev-python/pycryptodome/files/pycryptodome-3.19.1-gcc14-configure.patch73
-rw-r--r--dev-python/pycryptodome/pycryptodome-3.19.1-r2.ebuild61
2 files changed, 134 insertions, 0 deletions
diff --git a/dev-python/pycryptodome/files/pycryptodome-3.19.1-gcc14-configure.patch b/dev-python/pycryptodome/files/pycryptodome-3.19.1-gcc14-configure.patch
new file mode 100644
index 000000000000..f2d24f9cf696
--- /dev/null
+++ b/dev-python/pycryptodome/files/pycryptodome-3.19.1-gcc14-configure.patch
@@ -0,0 +1,73 @@
+https://github.com/Legrandin/pycryptodome/issues/787
+https://github.com/Legrandin/pycryptodome/commit/b4083688fde0580de6c2a4d36d84da31a2549a2c
+https://github.com/Legrandin/pycryptodome/commit/3f6a86e072ef0e650f04eebf086940e6d8b33c03
+
+From b4083688fde0580de6c2a4d36d84da31a2549a2c Mon Sep 17 00:00:00 2001
+From: Helder Eijs <helderijs@gmail.com>
+Date: Fri, 29 Dec 2023 14:36:19 +0100
+Subject: [PATCH] Better autodetect of AES support, in case of aggressive
+ optimization
+
+--- a/compiler_opt.py
++++ b/compiler_opt.py
+@@ -140,7 +140,7 @@ def compiler_has_intrin_h():
+ {
+ int a, b[4];
+ __cpuid(b, a);
+- return 0;
++ return a;
+ }
+ """
+ return test_compilation(source, msg="intrin.h header")
+@@ -154,7 +154,7 @@ def compiler_has_cpuid_h():
+ {
+ unsigned int eax, ebx, ecx, edx;
+ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+- return 0;
++ return eax;
+ }
+ """
+ return test_compilation(source, msg="cpuid.h header")
+@@ -163,11 +163,16 @@ def compiler_has_cpuid_h():
+ def compiler_supports_aesni():
+ source = """
+ #include <wmmintrin.h>
++ #include <string.h>
+ __m128i f(__m128i x, __m128i y) {
+ return _mm_aesenc_si128(x, y);
+ }
+ int main(void) {
+- return 0;
++ int ret;
++ __m128i x = _mm_setzero_si128();
++ x = f(x, x);
++ memcpy(&ret, &x, sizeof(ret));
++ return ret;
+ }
+ """
+
+From 3f6a86e072ef0e650f04eebf086940e6d8b33c03 Mon Sep 17 00:00:00 2001
+From: Helder Eijs <helderijs@gmail.com>
+Date: Fri, 29 Dec 2023 14:52:15 +0100
+Subject: [PATCH] Use memset, to avoid emmintrin.h
+
+---
+ compiler_opt.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/compiler_opt.py b/compiler_opt.py
+index 57db0a6f..a2711c09 100644
+--- a/compiler_opt.py
++++ b/compiler_opt.py
+@@ -169,7 +169,8 @@ def compiler_supports_aesni():
+ }
+ int main(void) {
+ int ret;
+- __m128i x = _mm_setzero_si128();
++ __m128i x;
++ memset(&x, 0, sizeof(x));
+ x = f(x, x);
+ memcpy(&ret, &x, sizeof(ret));
+ return ret;
+
+
diff --git a/dev-python/pycryptodome/pycryptodome-3.19.1-r2.ebuild b/dev-python/pycryptodome/pycryptodome-3.19.1-r2.ebuild
new file mode 100644
index 000000000000..e7d24a15b9de
--- /dev/null
+++ b/dev-python/pycryptodome/pycryptodome-3.19.1-r2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2024 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_{8,9,10,11,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.1-gcc14-configure.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?
+}