JamesTheAwesomeDude / pypqc

Attempt to expose Wiggers and Stebila's PQClean via Python CFFI
Other
0 stars 1 forks source link

Add optimized implementations #6

Open JamesTheAwesomeDude opened 5 months ago

JamesTheAwesomeDude commented 5 months ago

Fix whatever cursed compile errors are blocking that.

JamesTheAwesomeDude commented 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:

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.

JamesTheAwesomeDude commented 4 months ago

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.

JamesTheAwesomeDude commented 4 months ago

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']
JamesTheAwesomeDude commented 4 months ago

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.

JamesTheAwesomeDude commented 3 months ago