diff --git a/sasl/Cargo.toml b/sasl/Cargo.toml index a1a2e41b..724a60d2 100644 --- a/sasl/Cargo.toml +++ b/sasl/Cargo.toml @@ -21,7 +21,7 @@ anonymous = ["getrandom"] [dependencies] base64 = { version = "0.22", optional = true } -getrandom = { version = "0.2", optional = true } +getrandom = { version = "0.3", optional = true } sha1 = { version = "0.10", optional = true } sha2 = { version = "0.10", optional = true } hmac = { version = "0.12", optional = true } diff --git a/sasl/src/common/scram.rs b/sasl/src/common/scram.rs index 5747ed10..813d37b6 100644 --- a/sasl/src/common/scram.rs +++ b/sasl/src/common/scram.rs @@ -2,7 +2,6 @@ use alloc::string::{String, ToString}; use alloc::vec; use alloc::vec::Vec; use core::fmt; -use getrandom::{getrandom, Error as RngError}; use hmac::{digest::InvalidLength, Hmac, Mac}; use pbkdf2::pbkdf2; use sha1::{Digest, Sha1 as Sha1_hash}; @@ -15,9 +14,9 @@ use crate::secret; use base64::{engine::general_purpose::STANDARD as Base64, Engine}; /// Generate a nonce for SCRAM authentication. -pub fn generate_nonce() -> Result { +pub fn generate_nonce() -> Result { let mut data = [0u8; 32]; - getrandom(&mut data)?; + getrandom::fill(&mut data)?; Ok(Base64.encode(data)) } diff --git a/sasl/src/server/mechanisms/anonymous.rs b/sasl/src/server/mechanisms/anonymous.rs index c171f25d..4a503c1e 100644 --- a/sasl/src/server/mechanisms/anonymous.rs +++ b/sasl/src/server/mechanisms/anonymous.rs @@ -3,8 +3,6 @@ use crate::server::{Mechanism, MechanismError, Response}; use alloc::format; use alloc::vec::Vec; -use getrandom::getrandom; - pub struct Anonymous; impl Anonymous { @@ -24,7 +22,7 @@ impl Mechanism for Anonymous { return Err(MechanismError::FailedToDecodeMessage); } let mut rand = [0u8; 16]; - getrandom(&mut rand)?; + getrandom::fill(&mut rand)?; let username = format!("{:02x?}", rand); let ident = Identity::Username(username); Ok(Response::Success(ident, Vec::new()))