Skip to content

Commit

Permalink
chore: bump getrandom (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
louib authored Feb 1, 2025
1 parent ec8e7e8 commit 6e50300
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ challenge_response = { version = "0.5", optional = true }

uuid = { version = "1.2", features = ["v4", "serde"] }
hex = { version = "0.4" }
getrandom = { version = "0.2", features = ["std"] }
getrandom = { version = "0.3", features = ["std"] }
zeroize = { version = "1", features = ["zeroize_derive"] }

# dependencies for command-line utilities
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl KdfConfig {
#[cfg(feature = "save_kdbx4")]
pub(crate) fn get_kdf_and_seed(&self) -> Result<(Box<dyn kdf::Kdf>, Vec<u8>), getrandom::Error> {
let mut kdf_seed = vec![0; self.seed_size()];
getrandom::getrandom(&mut kdf_seed)?;
getrandom::fill(&mut kdf_seed)?;

let kdf = self.get_kdf_seeded(&kdf_seed);

Expand Down
6 changes: 3 additions & 3 deletions src/format/kdbx4/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub fn dump_kdbx4(

// generate encryption keys and seeds on the fly when saving
let mut master_seed = vec![0; HEADER_MASTER_SEED_SIZE];
getrandom::getrandom(&mut master_seed)?;
getrandom::fill(&mut master_seed)?;

let mut outer_iv = vec![0; db.config.outer_cipher_config.get_iv_size()];
getrandom::getrandom(&mut outer_iv)?;
getrandom::fill(&mut outer_iv)?;

let mut inner_random_stream_key = vec![0; db.config.inner_cipher_config.get_key_size()];
getrandom::getrandom(&mut inner_random_stream_key)?;
getrandom::fill(&mut inner_random_stream_key)?;

let (kdf, kdf_seed) = db.config.kdf_config.get_kdf_and_seed()?;

Expand Down
4 changes: 2 additions & 2 deletions src/format/kdbx4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod kdbx4_tests {
let mut password_bytes: Vec<u8> = vec![];
let mut password: String = "".to_string();
password_bytes.resize(40, 0);
getrandom::getrandom(&mut password_bytes).unwrap();
getrandom::fill(&mut password_bytes).unwrap();
for random_char in password_bytes {
password += &std::char::from_u32(random_char as u32).unwrap().to_string();
}
Expand Down Expand Up @@ -122,7 +122,7 @@ mod kdbx4_tests {
let mut password_bytes: Vec<u8> = vec![];
let mut password: String = "".to_string();
password_bytes.resize(40, 0);
getrandom::getrandom(&mut password_bytes).unwrap();
getrandom::fill(&mut password_bytes).unwrap();
for random_char in password_bytes {
password += &std::char::from_u32(random_char as u32).unwrap().to_string();
}
Expand Down
2 changes: 1 addition & 1 deletion src/xml_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod tests {
let mut password_bytes: Vec<u8> = vec![];
let mut password: String = "".to_string();
password_bytes.resize(40, 0);
getrandom::getrandom(&mut password_bytes).unwrap();
getrandom::fill(&mut password_bytes).unwrap();
for random_char in password_bytes {
password += &std::char::from_u32(random_char as u32).unwrap().to_string();
}
Expand Down

0 comments on commit 6e50300

Please sign in to comment.