[packages/python-pycryptodome] Build fixes
arekm
arekm at pld-linux.org
Mon Aug 10 21:01:42 CEST 2026
commit 6b7194324ff50a5eb471cd49ec7902edd2dfcbbd
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon Aug 10 21:01:23 2026 +0200
Build fixes
pycryptodome-disable-gmp.patch | 22 +++++++++++++
x32.patch | 71 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+)
---
diff --git a/pycryptodome-disable-gmp.patch b/pycryptodome-disable-gmp.patch
new file mode 100644
index 0000000..51ed9e6
--- /dev/null
+++ b/pycryptodome-disable-gmp.patch
@@ -0,0 +1,22 @@
+--- pycryptodome-3.23.0/lib/Crypto/Math/Numbers.py.orig 2026-08-10 18:19:27.342948842 +0200
++++ pycryptodome-3.23.0/lib/Crypto/Math/Numbers.py 2026-08-10 18:19:27.416075546 +0200
+@@ -33,7 +33,7 @@ __all__ = ["Integer"]
+ import os
+
+ try:
+- if os.getenv("PYCRYPTODOME_DISABLE_GMP"):
++ if True:
+ raise ImportError()
+
+ from Crypto.Math._IntegerGMP import IntegerGMP as Integer
+--- pycryptodome-3.23.0/lib/Crypto/SelfTest/Math/test_Numbers.py.orig 2026-08-10 18:19:27.346282175 +0200
++++ pycryptodome-3.23.0/lib/Crypto/SelfTest/Math/test_Numbers.py 2026-08-10 18:19:27.416416054 +0200
+@@ -806,7 +806,7 @@ def get_tests(config={}):
+ tests += list_test_cases(TestIntegerInt)
+
+ try:
+- from Crypto.Math._IntegerGMP import IntegerGMP
++ from Crypto.Math._IntegerGMPDisabled import IntegerGMP
+
+ class TestIntegerGMP(TestIntegerBase):
+ def setUp(self):
diff --git a/x32.patch b/x32.patch
new file mode 100644
index 0000000..240228b
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,71 @@
+--- pycryptodomex-3.21.0/src/libtom/tomcrypt_cfg.h~ 2024-10-01 20:38:19.000000000 +0200
++++ pycryptodomex-3.21.0/src/libtom/tomcrypt_cfg.h 2025-03-15 20:10:58.343318371 +0100
+@@ -56,7 +56,7 @@
+ */
+
+ /* detect x86-32 machines somewhat */
+-#if !defined(__STRICT_ANSI__) && (defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__))))
++#if !defined(__STRICT_ANSI__) && (defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__)))))
+ #define ENDIAN_LITTLE
+ #define ENDIAN_32BITWORD
+ #define LTC_FAST
+@@ -70,7 +70,7 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const
+ #endif
+
+ /* detect amd64 */
+-#if !defined(__STRICT_ANSI__) && defined(__x86_64__)
++#if !defined(__STRICT_ANSI__) && (defined(__x86_64__) && !defined(__ILP32__))
+ #define ENDIAN_LITTLE
+ #define ENDIAN_64BITWORD
+ #define LTC_FAST
+--- pycryptodomex-3.21.0/src/libtom/tomcrypt_macros.h~ 2024-10-01 20:38:19.000000000 +0200
++++ pycryptodomex-3.21.0/src/libtom/tomcrypt_macros.h 2025-03-15 20:17:39.763318304 +0100
+@@ -10,7 +10,7 @@
+ /* this is the "32-bit at least" data type
+ * Re-define it to suit your platform but it must be at least 32-bits
+ */
+-#if defined(__x86_64__) || (defined(__sparc__) && defined(__arch64__))
++#if (defined(__x86_64__) && !defined(__ILP32__)) || (defined(__sparc__) && defined(__arch64__))
+ typedef unsigned ulong32;
+ #else
+ typedef unsigned long ulong32;
+@@ -98,7 +98,7 @@
+
+
+ /* x86_64 processor */
+-#if !defined(LTC_NO_BSWAP) && (defined(__GNUC__) && defined(__x86_64__))
++#if !defined(LTC_NO_BSWAP) && (defined(__GNUC__) && (defined(__x86_64__) && !defined(__ILP32__)))
+
+ #define STORE64H(x, y) \
+ asm __volatile__ ( \
+@@ -341,7 +341,7 @@
+
+
+ /* 64-bit Rotates */
+-#if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(LTC_NO_ASM)
++#if !defined(__STRICT_ANSI__) && defined(__GNUC__) && (defined(__x86_64__) && !defined(__ILP32__)) && !defined(LTC_NO_ASM)
+
+ static inline unsigned long ROL64(unsigned long word, int i)
+ {
+--- pycryptodomex-3.21.0/src/multiply.h~ 2024-10-01 20:38:19.000000000 +0200
++++ pycryptodomex-3.21.0/src/multiply.h 2025-03-15 20:21:05.203318264 +0100
+@@ -15,7 +15,7 @@
+ oh = (uint64_t)(pr >> 64); \
+ } while (0)
+
+-#elif defined(_MSC_VER) && (defined(_M_X64) || defined(__x86_64__))
++#elif defined(_MSC_VER) && (defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)))
+
+ #include <intrin.h>
+ #define DP_MULT(a,b,ol,oh) do { ol = _umul128(a,b,&oh); } while (0)
+--- pycryptodomex-3.21.0/src/multiply_64.c~ 2024-10-01 20:38:19.000000000 +0200
++++ pycryptodomex-3.21.0/src/multiply_64.c 2025-03-15 20:21:49.423318250 +0100
+@@ -38,7 +38,7 @@
+ /**
+ * Add a 64-bit value x to y/sum_mid/sum_hi
+ */
+-#if defined(_MSC_VER) && (_MSC_VER>=1900) && (defined(_M_X64) || defined(__x86_64__))
++#if defined(_MSC_VER) && (_MSC_VER>=1900) && (defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)))
+
+ #include <intrin.h>
+ #define ADD192(y, x) do { \
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-pycryptodome.git/commitdiff/6b7194324ff50a5eb471cd49ec7902edd2dfcbbd
More information about the pld-cvs-commit
mailing list