Argyle-Software / kyber

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

Optimised Neon Arm-v8 #11

Open mberry opened 2 years ago

mberry commented 2 years ago

[Tracking issue]

There is an optimised C implementation for neon arm-v8 here: https://github.com/cothan/kyber/tree/master/neon

At the moment many of these platform specific intrinsics needed don't exist in core_arch::aarch64 so it's either build the C lib and use that or work on getting them into rust core.

faern commented 2 years ago

I'd personally love to see a pure Rust Kyber implementation. So that should IMHO be the goal here. If this is a concrete use case for having those intrinsics, that's a good ground for suggesting to introduce them to core.

mberry commented 2 years ago

Yeah I definitely agree. Still, a build script can be a simple fix for some depending on how long it takes to get them implemented. Had a fair bit of the neon rust code done anyway last year, probably should publish the branch even though it won't build.

Could also just strip out the non-existent intrinsic functions and put them back in as they drop into core_arch. Been a while, think there wasn't too many.

This is the issue covering neon intrinsics and also instructions for code generation:

https://github.com/rust-lang/stdarch/issues/148

There's also a spreadsheet of what's been done, it may or may not be maintained:

https://docs.google.com/spreadsheets/d/1MqW1g8c7tlhdRWQixgdWvR4uJHNZzCYAf4V0oHjZkwA/edit#gid=0

Guess I should make a list of what functions are blocking this here.

mberry commented 1 year ago

To update: moving forward on this, slowly...

Implementing the work by Becker et al.

https://github.com/neon-ntt/neon-ntt

https://eprint.iacr.org/2021/986