Open JamesTheAwesomeDude opened 5 months ago
Also, this will require adding some logic to choose the best implementation.
I think import
-time is the way to go for this, though there seem to be a few ways to approach it:
py-cpuinfo
To avoid the pain trilemma of "reinvent a wheel, poorly; or torture users with Hellfire by pinning a dependency version; or risk breakage by using a non-pinned dependency", I think that vendoring might be a good choice.
Fix whatever cursed compile errors are blocking that.
according to the OpenQuantumSafe Wiki, those implementations aren't for Windows anyway: https://openquantumsafe.org/liboqs/algorithms/kem/classic_mceliece.html#classic-mceliece-6960119f-implementation-characteristics
god knows if they're correct. might be worth asking upstream.
As an aside, it looks like py-cpuinfo
has retained the same API from version 0.2.3 (8 years ago) – version 9.0.0 (current), though AVX2 didn't arrive till later (version 4.0.0).
So at least
risk breakage by using a non-pinned dependency
isn't so great.
from cpuinfo import get_cpu_info # pip install "py-cpuinfo >= 4"
HAS_AVX2 = 'avx2' in get_cpu_info()['flags']
https://github.com/PQClean/PQClean/discussions/532#discussioncomment-7886429
(Emphasis added:)
[SPHINCS+ AVX2] implementations support Windows … [however,] most AVX2 implementations rely on assembly code, and assembler syntax is not portable: gas syntax is not understood by Microsoft's assembler.
As always, we're open to contributions to improve this situation for algorithms that are currently not supporting Windows.
Fix whatever cursed compile errors are blocking that.