From 74d9903f6955f9f9e57b5cab8d05a64983d6cb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Mon, 27 Jan 2025 09:26:38 +0100 Subject: [PATCH] Upgrade the getrandom crate --- Cargo.toml | 2 +- src/ikm.rs | 2 +- src/scheme/aes.rs | 2 +- src/scheme/xchacha20poly1305.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 36b3372..1c1c3db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ benchmark = ["criterion"] [dependencies] base64ct = { version = "1.6.0", default-features = false, features = ["std"] } -getrandom = { version = "0.2.12", default-features = false } +getrandom = { version = "0.3.0", default-features = false } thiserror = { version = "2.0.3", default-features = false } # chacha feature: diff --git a/src/ikm.rs b/src/ikm.rs index 99deb14..8eec65c 100644 --- a/src/ikm.rs +++ b/src/ikm.rs @@ -243,7 +243,7 @@ impl InputKeyMaterialList { ) -> Result { let ikm_len = scheme.get_ikm_size(); let mut content: Vec = vec![0; ikm_len]; - getrandom::getrandom(content.as_mut_slice())?; + getrandom::fill(content.as_mut_slice())?; self.id_counter += 1; self.ikm_lst.push(InputKeyMaterial { id: self.id_counter, diff --git a/src/scheme/aes.rs b/src/scheme/aes.rs index b224124..9a62f96 100644 --- a/src/scheme/aes.rs +++ b/src/scheme/aes.rs @@ -13,7 +13,7 @@ const NONCE_SIZE: usize = 12; pub(crate) fn aes128gcm_gen_nonce() -> Result> { let mut nonce: [u8; NONCE_SIZE] = [0; NONCE_SIZE]; - getrandom::getrandom(&mut nonce)?; + getrandom::fill(&mut nonce)?; Ok(nonce.to_vec()) } diff --git a/src/scheme/xchacha20poly1305.rs b/src/scheme/xchacha20poly1305.rs index d041eda..af132a0 100644 --- a/src/scheme/xchacha20poly1305.rs +++ b/src/scheme/xchacha20poly1305.rs @@ -9,7 +9,7 @@ const NONCE_SIZE: usize = 24; pub(crate) fn xchacha20poly1305_gen_nonce() -> Result> { let mut nonce: [u8; NONCE_SIZE] = [0; NONCE_SIZE]; - getrandom::getrandom(&mut nonce)?; + getrandom::fill(&mut nonce)?; Ok(nonce.to_vec()) }