Legrandin / pycryptodome

A self-contained cryptographic library for Python
https://www.pycryptodome.org
Other
2.81k stars 502 forks source link

check for __cpuidex in intrin.h #757

Open jeremyd2019 opened 1 year ago

jeremyd2019 commented 1 year ago

This is what is actually used, rather than cpuid. Due to what I assume is a bug in mingw-w64, cpuid is prototyped on ARM64, even though there is no definition, which caused this check to succeed and compilation to later fail due to missing cpuidex (it would have failed at link time if cpuid was used instead)

jeremyd2019 commented 1 year ago

I have separately reported the most likely erroneous presence of __cpuid prototype on ARM64 to mingw-w64. I just thought it also made sense to test for the intrinsic actually used here.

jeremyd2019 commented 1 year ago

I think https://github.com/mingw-w64/mingw-w64/commit/69846cfb7f7fa33375eae40759d4ff29a4cadf9f would fix the build error on arm64, but I also think it would be more correct to check for __cpuidex since that is what will try to be used.