Skip to content

Commit

Permalink
crypto: avoid using std::mem::uninitialized()
Browse files Browse the repository at this point in the history
  • Loading branch information
ghedo committed Jan 22, 2019
1 parent 6468df1 commit f454acc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Seal {

pub fn derive_initial_key_material(cid: &[u8], is_server: bool)
-> Result<(Open, Seal)> {
let mut secret: [u8; 32] = unsafe { std::mem::uninitialized() };
let mut secret: [u8; 32] = [0; 32];

let aead = Algorithm::AES128_GCM;

Expand Down Expand Up @@ -334,7 +334,7 @@ fn hkdf_expand_label(prk: &hmac::SigningKey, label: &[u8], out: &mut [u8])
-> Result<()> {
const LABEL_PREFIX: &[u8] = b"tls13 ";

let mut info: [u8; 256] = unsafe { std::mem::uninitialized() };
let mut info: [u8; 24] = [0; 24];

let info_len = {
let mut b = octets::Octets::with_slice(&mut info);
Expand Down

0 comments on commit f454acc

Please sign in to comment.