summaryrefslogtreecommitdiff
path: root/dev-python/pycryptodome/files/pycryptodome-3.19.1-gcc14-configure.patch
blob: ee87f615b8148365c3e192870d8e6e81dbc645d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
https://github.com/Legrandin/pycryptodome/issues/787
https://github.com/Legrandin/pycryptodome/commit/b4083688fde0580de6c2a4d36d84da31a2549a2c

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;
     }
     """