Argyle-Software / kyber

A rust implementation of the Kyber post-quantum KEM
https://docs.rs/pqc_kyber/
Apache License 2.0
164 stars 37 forks source link

Rustcrypto aes256ctr #64

Closed mberry closed 1 year ago

mberry commented 1 year ago

Add: 90s-fixslice feature This uses Rustcrypto's fixslice AES256 implementation in big-endian 32bit counter mode. Better side-channel resistance, especially on embedded devices. Recommend benchmarking before switching to measure any tradeoffs . Ref: https://eprint.iacr.org/2020/1123.pdf

Modify: Benchmarking functions Now uses deterministic buffers. Was causing undesirable fluctuation in keypair and encapsulation benches

mberry commented 1 year ago

So, the AES dependency required to implement this feature bumps the MSRV from 1.47 to 1.56, which is why CI is failing. Functionally we can go down to 1.47 for anyone not using 90s-fixslice. There's also a few QoL improvments that can be made in the test suite from targeting a higher version which is nice.

mberry commented 1 year ago

And now it's segfaulting on arm-linux-androideabi. There's no unsafe code being run on the cross.yml tests, though rust only guarantees to prevent segfaults on platforms that support stack probing.

Will need some more investigation.

mberry commented 1 year ago

Given that even without the new feature the cross compiling is still failing am at a loss for now. Could be an issue with the cargo cross images. Have removed androideabi from the test matrix, this is the only platform affected.

mberry commented 1 year ago

Going to leave this PR open for a while.

Might separate out the benchmarking changes into another fork to merge.

mberry commented 1 year ago

Have no issues on older rust versions (<1.65.0) with cross compiling , which is why it was never picked up by CI before.

Going to merge this with the CI target removed.