sasl: Bump getrandom to 0.3
They renamed getrandom::getrandom() to getrandom::fill().
This commit is contained in:
parent
e3b167687f
commit
4f270bff7a
3 changed files with 4 additions and 7 deletions
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue