aes-kw: add optional zeroize feature for wrappers#80
Conversation
Close RustCrypto#79 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
|
ZeroizeOnDrop is only a marker trait. Here you marked the objects as "pinky promise, this will be zerorized" but not actually zeroized. I think you wanted to |
|
I believe that the implementation is correct. The types just wrap |
|
That's true, but I'd rather have the explicit |
|
It's not possible. The block cipher implementations intentionally do not implement Meanwhile, |
|
A common case, we use KwAes256 which is #[derive(Clone)]
pub struct Aes256 {
encrypt: Aes256Enc,
decrypt: Aes256Dec,
}
...
#[cfg(feature = "zeroize")]
impl zeroize::ZeroizeOnDrop for Aes256 {}
...
#[derive(Clone)]
pub struct Aes256Enc {
backend: Aes256BackEnc,
}
impl Drop for Aes256Enc {
#[inline]
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
unsafe {
zeroize::zeroize_flat_type(&mut self.backend)
}
}
}That means Thus we do not need to impl explicitly the Not sure if I made anything wrong |
Close #79