]> git.lizzy.rs Git - PAKEs.git/commitdiff
remove num_traits dep
authornewpavlov <newpavlov@gmail.com>
Thu, 7 Nov 2019 15:50:43 +0000 (18:50 +0300)
committernewpavlov <newpavlov@gmail.com>
Thu, 7 Nov 2019 15:50:43 +0000 (18:50 +0300)
srp/Cargo.toml
srp/src/client.rs
srp/src/server.rs
srp/src/tools.rs

index 3ade1b07a3abdfe3930751ed9f606fbe2f227485..fdfea93f60c701e5f02f2edbab5bbb76d501c150 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "srp"
-version = "0.4.1"
+version = "0.4.2"
 edition = "2018"
 authors = ["RustCrypto Developers"]
 license = "MIT OR Apache-2.0"
@@ -12,7 +12,6 @@ categories = ["cryptography", "authentication"]
 
 [dependencies]
 num-bigint = "0.2"
-num-traits = "0.2"
 generic-array = "0.12"
 digest = "0.8"
 lazy_static = "1.2"
index db4c5767d772a0fb06b02de014776925e00b0e25..a33f9b39dc1f36e847faebfd3954c62fbbbc0286 100644 (file)
@@ -61,7 +61,6 @@ use std::marker::PhantomData;
 use digest::Digest;
 use generic_array::GenericArray;
 use num_bigint::BigUint;
-use num_traits::Zero;
 
 use crate::tools::powm;
 use crate::types::{SrpAuthError, SrpGroup};
@@ -160,7 +159,7 @@ impl<'a, D: Digest> SrpClient<'a, D> {
         let b_pub = BigUint::from_bytes_be(b_pub);
 
         // Safeguard against malicious B
-        if &b_pub % &self.params.n == BigUint::zero() {
+        if &b_pub % &self.params.n == BigUint::default() {
             return Err(SrpAuthError {
                 description: "Malicious b_pub value",
             });
index 6e414046057275df19e3cc2ca3a4d3b9195f839e..f30608a34c2850bc0bcc23cb618f783684468d87 100644 (file)
@@ -39,7 +39,6 @@ use std::marker::PhantomData;
 use digest::Digest;
 use generic_array::GenericArray;
 use num_bigint::BigUint;
-use num_traits::Zero;
 
 use crate::tools::powm;
 use crate::types::{SrpAuthError, SrpGroup};
@@ -73,7 +72,7 @@ impl<D: Digest> SrpServer<D> {
     ) -> Result<Self, SrpAuthError> {
         let a_pub = BigUint::from_bytes_be(a_pub);
         // Safeguard against malicious A
-        if &a_pub % &params.n == BigUint::zero() {
+        if &a_pub % &params.n == BigUint::default() {
             return Err(SrpAuthError {
                 description: "Malicious a_pub value",
             });
index f761dca2e4eb0c51325c218654a84bf3bbdb4ea2..7f7da0f32b2cc77e7aaa2fed3b1438a2aa1fc3f0 100644 (file)
@@ -1,9 +1,9 @@
 use num_bigint::BigUint;
 
 pub fn powm(base: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUint {
-    let zero = BigUint::new(vec![0]);
-    let one = BigUint::new(vec![1]);
-    let two = BigUint::new(vec![2]);
+    let zero = BigUint::from(0u32);
+    let one = BigUint::from(1u32);
+    let two = BigUint::from(2u32);
     let mut exp = exp.clone();
     let mut result = one.clone();
     let mut base = base % modulus;