mupq / pqm4

Post-quantum crypto library for the ARM Cortex-M4
284 stars 72 forks source link

Add SNOVA #311

Closed mkannwischer closed 8 months ago

mkannwischer commented 10 months ago

Resolves https://github.com/mupq/pqm4/issues/291

This adds the SNOVA implementation from https://csrc.nist.gov/csrc/media/Projects/pqc-dig-sig/documents/round-1/submission-pkg/SNOVAnoKATs-submission.zip.

There is one things that is really ugly:

https://github.com/mupq/mupq/blob/97c1c0a3c42d9102384717510d1f5d22faf344b2/crypto_sign/snova-24-5-16-4-esk/ref/snova.c#L7-L32

It's using static pre-computed tables. The precomputation is done outside of the regular API functions with (1) feels like cheating, (2) does not work in pqm4. I have added a call to snova_init() to each of crypto_sign_keypair, crypto_sign, and crypto_sign_open: https://github.com/mupq/mupq/blob/97c1c0a3c42d9102384717510d1f5d22faf344b2/crypto_sign/snova-24-5-16-4-esk/ref/sign.c#L10 https://github.com/mupq/mupq/blob/97c1c0a3c42d9102384717510d1f5d22faf344b2/crypto_sign/snova-24-5-16-4-esk/ref/sign.c#L30 https://github.com/mupq/mupq/blob/97c1c0a3c42d9102384717510d1f5d22faf344b2/crypto_sign/snova-24-5-16-4-esk/ref/sign.c#L55

I guess those should all be pre-computed and placed in flash. But that requires a little more effort than I am willing to put in right now.