Argyle-Software / kyber

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

Zeroisation #67

Open mberry opened 1 year ago

mberry commented 1 year ago

This is an unfinished baseline for full zeroisation of secrets. Transient data like the secretkey polynomials are zeroed.

For now it just does the internals and requires Pin to ensure the same behaviour regardless of the copy on return semantics of platforms/compilers.

mberry commented 1 year ago

Due to a squash and merge policy never playing well with github this has a lot of already mainlined code.

The meaningful changes are in:

zero is a helper macro to remove all the conditional compilation clutter that was building up:

macro_rules! zero {
  ($target: ident) => {
    #[cfg(feature = "zeroize")]
    $target.zeroize(); 
  };
}