mupq / pqm4

Post-quantum crypto library for the ARM Cortex-M4
280 stars 68 forks source link

Add perk m4 #318

Closed marco-palumbi closed 6 months ago

marco-palumbi commented 7 months ago

This pull request adds PERK for all NIST levels.

Implementation is compliant with version v1.1 of 2023/10/16 https://pqc-perk.org

main features:

marco-palumbi commented 7 months ago

This version is not compatible with the current version in mupq (that is taken from the first release submitted to NIST). I can help to fix this too.

To run the testvectors.py I added in mupq the code from the submitted package at https://pqc-perk.org/assets/downloads/perk_2023_10_16.zip

This code uses the gmp library and can be run only on the host but may be used to generate the vectors and have a more confident result. To do this I added "-lgmp" to mupq/mk/host-crypto.mk and edited the skiplist.py to request 6 mega bytes memory for all the PERK reference implementations. This implies that gmp must be present on the host running the tests.

If you agree with this I can PR on mupq this version. If you don't like to add the gmp dependency I can contribute with a version close to the one submitted to NIST but with a different bn implementation.

mkannwischer commented 7 months ago

Hi Macro,

Thank you for all the work! Great to see PERK on the M4.

Yes, please remove the old implementations from mupq. You could add the gmp flag only for this scheme since pqm4 now supports implementation-specific flags. See, e.g., https://github.com/mupq/mupq/blob/master/crypto_sign/ov-Ip/ref/config.mk But I would really like to avoid the gmp dependency. If it is not too much work, could you please open a PR with that? Please do make sure locally that the testvectors are consistent with the gmp implementation.

rpls commented 6 months ago

I was able to run the code on platform and emulator. Code looks good so far, but as with the mupq version: please use symlinks (see my comment in mupq/mupq#132).

marco-palumbi commented 6 months ago

updated the code to use symlinks