rustpq / pqcrypto

Rust Post-Quantum cryptography
212 stars 38 forks source link

Add AArch64 support for selected schemes #32

Closed RW-sec closed 2 years ago

RW-sec commented 2 years ago

Hi Thom, this PR adds support for AArch64 builds and changes the naming scheme of some variables for the x86 builds. The adjustment reflects now which architecture and which feature is selected. There is at the moment no suitable runtime detection (see template scheme.rs.js) for Neon support, with Rust nightly it is possible, but I think it is not really needed, as AArch64 supports the Neon instructions out of the box (see also the deletion in cpufeatures by tarcieri https://github.com/RustCrypto/utils/pull/406/commits/45a39900dd5a6788643ed9c808fec52994692496). This change was tested on my RaspberryPi 4 and all tests were successful.

RW-sec commented 2 years ago

Testing the AArch64 code in a CI is a great idea. The link you posted seems promising that we can test it with Github Actions. I must admit, that I have to look a little bit more into it and when I figure it out I will make a PR.

RW-sec commented 2 years ago

Regarding testing the code on an AArch64 architecture, I think that it is not feasible at the moment as the AArch64 architecture will be emulated on an x86 with QEMU. I added a workflow, but it is slow. I mean really slow: https://github.com/uraimo/run-on-arch-action/issues/4 As some algorithms are very heavy, it will take several hours only to build. Running "cargo test" will then take again several hours. I canceled on build after three hours (it was with cargo fmt, cargo build, and cargo test), but I started a new one only with "cargo build" to see how long it will need to complete. The best option would be, if Github finally adds support for AArch64 architectures for their runners.

thomwiggers commented 2 years ago

Yeah I guess that was to be expected. PQClean also takes forever to run, that's why we split all CI runs per individual implementation there. Thanks for the effort though!