sasl: Bump getrandom to 0.3

Link Mauve created

They renamed getrandom::getrandom() to getrandom::fill().

Change summary

sasl/Cargo.toml                         | 2 +-
sasl/src/common/scram.rs                | 5 ++---
sasl/src/server/mechanisms/anonymous.rs | 4 +---
3 files changed, 4 insertions(+), 7 deletions(-)

Detailed changes

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 }

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<String, RngError> {
+pub fn generate_nonce() -> Result<String, getrandom::Error> {
     let mut data = [0u8; 32];
-    getrandom(&mut data)?;
+    getrandom::fill(&mut data)?;
     Ok(Base64.encode(data))
 }
 

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()))