Bump all hash crates

Emmanuel Gil Peyrot created

Change summary

sasl/Cargo.toml          |  8 ++++----
sasl/src/client/mod.rs   |  8 ++++----
sasl/src/common/scram.rs | 12 ++++++------
sasl/src/server/mod.rs   |  6 +++---
4 files changed, 17 insertions(+), 17 deletions(-)

Detailed changes

sasl/Cargo.toml 🔗

@@ -21,7 +21,7 @@ scram = ["base64", "getrandom", "sha-1", "sha2", "hmac", "pbkdf2"]
 [dependencies]
 base64 = { version = "0.13", optional = true }
 getrandom = { version = "0.2", optional = true }
-sha-1 = { version = "0.9", optional = true }
-sha2 = { version = "0.9", optional = true }
-hmac = { version = "0.10", optional = true }
-pbkdf2 = { version = "0.6", default-features = false, optional = true }
+sha-1 = { version = "0.10", optional = true }
+sha2 = { version = "0.10", optional = true }
+hmac = { version = "0.12", optional = true }
+pbkdf2 = { version = "0.10", default-features = false, optional = true }

sasl/src/client/mod.rs 🔗

@@ -1,6 +1,6 @@
 use crate::common::scram::DeriveError;
 use crate::common::Credentials;
-use hmac::crypto_mac::InvalidKeyLength;
+use hmac::digest::InvalidLength;
 use std::fmt;
 
 #[derive(Debug, PartialEq)]
@@ -19,7 +19,7 @@ pub enum MechanismError {
     NoServerSalt,
     NoServerIterations,
     DeriveError(DeriveError),
-    InvalidKeyLength(InvalidKeyLength),
+    InvalidKeyLength(InvalidLength),
     InvalidState,
 
     CannotDecodeSuccessResponse,
@@ -33,8 +33,8 @@ impl From<DeriveError> for MechanismError {
     }
 }
 
-impl From<InvalidKeyLength> for MechanismError {
-    fn from(err: InvalidKeyLength) -> MechanismError {
+impl From<InvalidLength> for MechanismError {
+    fn from(err: InvalidLength) -> MechanismError {
         MechanismError::InvalidKeyLength(err)
     }
 }

sasl/src/common/scram.rs 🔗

@@ -1,5 +1,5 @@
 use getrandom::{getrandom, Error as RngError};
-use hmac::{crypto_mac::InvalidKeyLength, Hmac, Mac, NewMac};
+use hmac::{digest::InvalidLength, Hmac, Mac};
 use pbkdf2::pbkdf2;
 use sha1::{Digest, Sha1 as Sha1_hash};
 use sha2::Sha256 as Sha256_hash;
@@ -52,7 +52,7 @@ pub trait ScramProvider {
     fn hash(data: &[u8]) -> Vec<u8>;
 
     /// A function which performs an HMAC using the hash function.
-    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidKeyLength>;
+    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidLength>;
 
     /// A function which does PBKDF2 key derivation using the hash function.
     fn derive(data: &Password, salt: &[u8], iterations: u32) -> Result<Vec<u8>, DeriveError>;
@@ -75,9 +75,9 @@ impl ScramProvider for Sha1 {
         vec
     }
 
-    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidKeyLength> {
+    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidLength> {
         type HmacSha1 = Hmac<Sha1_hash>;
-        let mut mac = HmacSha1::new_varkey(key)?;
+        let mut mac = HmacSha1::new_from_slice(key)?;
         mac.update(data);
         let result = mac.finalize();
         let mut vec = Vec::with_capacity(Sha1_hash::output_size());
@@ -135,9 +135,9 @@ impl ScramProvider for Sha256 {
         vec
     }
 
-    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidKeyLength> {
+    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidLength> {
         type HmacSha256 = Hmac<Sha256_hash>;
-        let mut mac = HmacSha256::new_varkey(key)?;
+        let mut mac = HmacSha256::new_from_slice(key)?;
         mac.update(data);
         let result = mac.finalize();
         let mut vec = Vec::with_capacity(Sha256_hash::output_size());

sasl/src/server/mod.rs 🔗

@@ -61,7 +61,7 @@ pub enum MechanismError {
     ProviderError(ProviderError),
 
     CannotDecodeResponse,
-    InvalidKeyLength(hmac::crypto_mac::InvalidKeyLength),
+    InvalidKeyLength(hmac::digest::InvalidLength),
     NoProof,
     CannotDecodeProof,
     AuthenticationFailed,
@@ -92,8 +92,8 @@ impl From<ValidatorError> for MechanismError {
     }
 }
 
-impl From<hmac::crypto_mac::InvalidKeyLength> for MechanismError {
-    fn from(err: hmac::crypto_mac::InvalidKeyLength) -> MechanismError {
+impl From<hmac::digest::InvalidLength> for MechanismError {
+    fn from(err: hmac::digest::InvalidLength) -> MechanismError {
         MechanismError::InvalidKeyLength(err)
     }
 }