mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add zeroize API to AES port
this was missed on an earlier pass
This commit is contained in:
parent
eb26e53e3b
commit
a3f8ff6371
3 changed files with 23 additions and 2 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -23,6 +23,7 @@ name = "aes"
|
|||
version = "0.8.3"
|
||||
dependencies = [
|
||||
"cipher",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1150,13 +1151,13 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
|||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"curve25519-dalek-derive",
|
||||
"digest 0.10.7",
|
||||
"engine-25519",
|
||||
"engine25519-as",
|
||||
"fiat-crypto 0.2.6",
|
||||
"platforms",
|
||||
"rustc_version 0.4.0",
|
||||
|
|
@ -1167,6 +1168,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "curve25519-dalek-derive"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ description = "AES library for Xous"
|
|||
# Dependency versions enforced by Cargo.lock.
|
||||
[dependencies]
|
||||
cipher = "0.4.2"
|
||||
zeroize = { version = "1.6.0", optional = true, default_features = false }
|
||||
|
||||
[features]
|
||||
hazmat = [] # Expose cryptographically hazardous APIs
|
||||
|
|
|
|||
|
|
@ -107,6 +107,17 @@ macro_rules! define_aes_impl {
|
|||
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(stringify!($name)) }
|
||||
}
|
||||
|
||||
impl Drop for $name {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
#[cfg(feature = "zeroize")]
|
||||
zeroize::Zeroize::zeroize(&mut self.keys);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "zeroize")]
|
||||
impl zeroize::ZeroizeOnDrop for $name {}
|
||||
|
||||
#[doc=$doc]
|
||||
///block cipher (encrypt-only)
|
||||
#[derive(Clone)]
|
||||
|
|
@ -155,6 +166,9 @@ macro_rules! define_aes_impl {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "zeroize")]
|
||||
impl zeroize::ZeroizeOnDrop for $name_enc {}
|
||||
|
||||
#[doc=$doc]
|
||||
///block cipher (decrypt-only)
|
||||
#[derive(Clone)]
|
||||
|
|
@ -213,6 +227,9 @@ macro_rules! define_aes_impl {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "zeroize")]
|
||||
impl zeroize::ZeroizeOnDrop for $name_dec {}
|
||||
|
||||
pub(crate) struct $name_back_enc<'a>(&'a $name);
|
||||
|
||||
impl<'a> BlockSizeUser for $name_back_enc<'a> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue