From d597c62367000e00125ed5aa376ba268717da69a Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Fri, 17 Feb 2023 22:42:04 +0100 Subject: [PATCH] include salt in client proof --- srp/src/client.rs | 1 + srp/src/server.rs | 3 +++ srp/src/utils.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/srp/src/client.rs b/srp/src/client.rs index 845c6f8..dd21982 100644 --- a/srp/src/client.rs +++ b/srp/src/client.rs @@ -209,6 +209,7 @@ impl<'a, D: Digest> SrpClient<'a, D> { let m1 = compute_m1::( self.params, username_hash.as_slice(), + salt, &a_pub.to_bytes_be(), &b_pub.to_bytes_be(), &key.to_bytes_be(), diff --git a/srp/src/server.rs b/srp/src/server.rs index 08c0475..e48c8e8 100644 --- a/srp/src/server.rs +++ b/srp/src/server.rs @@ -121,11 +121,13 @@ impl<'a, D: Digest> SrpServer<'a, D> { /// Process client reply to the handshake. /// b is a random value, + /// s is the salt, /// v is the provided during initial user registration pub fn process_reply( &self, username: &str, b: &[u8], + s: &[u8], v: &[u8], a_pub: &[u8], ) -> Result, SrpAuthError> { @@ -152,6 +154,7 @@ impl<'a, D: Digest> SrpServer<'a, D> { let m1 = compute_m1::( self.params, username_hash.as_slice(), + s, &a_pub.to_bytes_be(), &b_pub.to_bytes_be(), &key.to_bytes_be(), diff --git a/srp/src/utils.rs b/srp/src/utils.rs index d053f5d..5258c7a 100644 --- a/srp/src/utils.rs +++ b/srp/src/utils.rs @@ -29,6 +29,7 @@ pub fn compute_k(params: &SrpGroup) -> BigUint { pub fn compute_m1( params: &SrpGroup, identity_hash: &[u8], + salt: &[u8], a_pub: &[u8], b_pub: &[u8], key: &[u8], @@ -46,6 +47,7 @@ pub fn compute_m1( let mut d = D::new(); d.update(ng_xor); d.update(identity_hash); + d.update(salt); d.update(a_pub); d.update(b_pub); d.update(key); -- 2.44.0