Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions wrapper/rust/wolfssl-wolfcrypt/src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ impl AeadCore for Aes128Ccm {
#[cfg(all(aes_ccm, feature = "aead"))]
impl KeyInit for Aes128Ccm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 16];
k.copy_from_slice(key.as_ref());
Aes128Ccm { key: k }
let mut out = Aes128Ccm { key: [0u8; 16] };
out.key.copy_from_slice(key.as_ref());
out
}
Comment thread
holtrop-wolfssl marked this conversation as resolved.
}

Expand Down Expand Up @@ -576,9 +576,9 @@ impl AeadCore for Aes192Ccm {
#[cfg(all(aes_ccm, feature = "aead"))]
impl KeyInit for Aes192Ccm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 24];
k.copy_from_slice(key.as_ref());
Aes192Ccm { key: k }
let mut out = Aes192Ccm { key: [0u8; 24] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down Expand Up @@ -628,9 +628,9 @@ impl AeadCore for Aes256Ccm {
#[cfg(all(aes_ccm, feature = "aead"))]
impl KeyInit for Aes256Ccm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 32];
k.copy_from_slice(key.as_ref());
Aes256Ccm { key: k }
let mut out = Aes256Ccm { key: [0u8; 32] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down Expand Up @@ -1740,9 +1740,9 @@ impl AeadCore for Aes128Gcm {
#[cfg(all(aes_gcm, feature = "aead"))]
impl KeyInit for Aes128Gcm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 16];
k.copy_from_slice(key.as_ref());
Aes128Gcm { key: k }
let mut out = Aes128Gcm { key: [0u8; 16] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down Expand Up @@ -1792,9 +1792,9 @@ impl AeadCore for Aes192Gcm {
#[cfg(all(aes_gcm, feature = "aead"))]
impl KeyInit for Aes192Gcm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 24];
k.copy_from_slice(key.as_ref());
Aes192Gcm { key: k }
let mut out = Aes192Gcm { key: [0u8; 24] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down Expand Up @@ -1844,9 +1844,9 @@ impl AeadCore for Aes256Gcm {
#[cfg(all(aes_gcm, feature = "aead"))]
impl KeyInit for Aes256Gcm {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 32];
k.copy_from_slice(key.as_ref());
Aes256Gcm { key: k }
let mut out = Aes256Gcm { key: [0u8; 32] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down
12 changes: 6 additions & 6 deletions wrapper/rust/wolfssl-wolfcrypt/src/chacha20_poly1305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ impl aead::AeadCore for ChaCha20Poly1305Aead {
#[cfg(feature = "aead")]
impl aead::KeyInit for ChaCha20Poly1305Aead {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 32];
k.copy_from_slice(key.as_ref());
ChaCha20Poly1305Aead { key: k }
let mut out = ChaCha20Poly1305Aead { key: [0u8; 32] };
out.key.copy_from_slice(key.as_ref());
out
}
Comment thread
holtrop-wolfssl marked this conversation as resolved.
}

Expand Down Expand Up @@ -526,9 +526,9 @@ impl aead::AeadCore for XChaCha20Poly1305Aead {
#[cfg(all(xchacha20_poly1305, feature = "aead"))]
impl aead::KeyInit for XChaCha20Poly1305Aead {
fn new(key: &aead::Key<Self>) -> Self {
let mut k = [0u8; 32];
k.copy_from_slice(key.as_ref());
XChaCha20Poly1305Aead { key: k }
let mut out = XChaCha20Poly1305Aead { key: [0u8; 32] };
out.key.copy_from_slice(key.as_ref());
out
}
}

Expand Down
Loading