]> git.lizzy.rs Git - PAKEs.git/commitdiff
Clippy updates
authorАртём Павлов [Artyom Pavlov] <newpavlov@gmail.com>
Thu, 17 Aug 2017 22:29:21 +0000 (01:29 +0300)
committerАртём Павлов [Artyom Pavlov] <newpavlov@gmail.com>
Thu, 17 Aug 2017 22:29:21 +0000 (01:29 +0300)
srp/src/client.rs
srp/tests/mod.rs

index 4348f4f2d9227414d4d376e0d67924bf877862a1..a47bb284e16b0dee12a0cabfb4b7a62531e4838d 100644 (file)
@@ -48,8 +48,8 @@
 //! 
 //! For user registration on the server first generate salt (e.g. 32 bytes long)
 //! and get password verifier which depends on private key. Send useranme, salt
-//! and password verifier over protected channel to protect against MitM for
-//! registration.
+//! and password verifier over protected channel to protect against
+//! Man-in-the-middle (MITM) attack for registration.
 //! 
 //! ```ignore
 //! let pwd_verifier = client.get_password_verifier(&private_key);
@@ -112,7 +112,7 @@ impl<'a, D: Digest> SrpClient<'a, D> {
 
     /// Get password verfier for user registration on the server
     pub fn get_password_verifier(&self, private_key: &[u8]) -> Vec<u8> {
-        let x = BigUint::from_bytes_be(&private_key);
+        let x = BigUint::from_bytes_be(private_key);
         let v = self.params.powm(&x);
         v.to_bytes_be()
     }
@@ -152,7 +152,7 @@ impl<'a, D: Digest> SrpClient<'a, D> {
             return Err(SrpAuthError{ description: "Malicious b_pub value" })
         }
 
-        let x = BigUint::from_bytes_be(&private_key);
+        let x = BigUint::from_bytes_be(private_key);
         let key = self.calc_key(&b_pub, &x, &u);
         // M1 = H(A, B, K)
         let proof = {
index 24d911d095a989d80c5472f22a5b286537266192..4389f8211e091dda42cc636c5ff2211b2758b292 100644 (file)
@@ -12,7 +12,7 @@ use srp::server::{SrpServer, UserRecord};
 
 fn auth_test(reg_pwd: &[u8], auth_pwd: &[u8]) {
     let mut rng = rand::os::OsRng::new().unwrap();
-    let username = "alice".as_bytes();
+    let username = b"alice";
 
     // Client instance creation
     let a = rng.gen_iter::<u8>().take(64).collect::<Vec<u8>>();
@@ -34,7 +34,7 @@ fn auth_test(reg_pwd: &[u8], auth_pwd: &[u8]) {
     let (salt, b_pub) = (&user.salt, server.get_b_pub());
 
     // Client processes handshake reply
-    let auth_priv_key = srp_private_key::<Sha256>(username, auth_pwd, &salt);
+    let auth_priv_key = srp_private_key::<Sha256>(username, auth_pwd, salt);
     let client2 = client.process_reply(&auth_priv_key, &b_pub).unwrap();
     let proof = client2.get_proof();
 
@@ -51,11 +51,11 @@ fn auth_test(reg_pwd: &[u8], auth_pwd: &[u8]) {
 
 #[test]
 fn good_password() {
-    auth_test("password".as_bytes(), "password".as_bytes());
+    auth_test(b"password", b"password");
 }
 
 #[test]
 #[should_panic]
 fn bad_password() {
-    auth_test("password".as_bytes(), "paSsword".as_bytes());
+    auth_test(b"password", b"paSsword");
 }