aboutsummaryrefslogtreecommitdiff
path: root/srp/src
diff options
context:
space:
mode:
Diffstat (limited to 'srp/src')
-rw-r--r--srp/src/client.rs3
-rw-r--r--srp/src/server.rs3
-rw-r--r--srp/src/tools.rs6
3 files changed, 5 insertions, 7 deletions
diff --git a/srp/src/client.rs b/srp/src/client.rs
index db4c576..a33f9b3 100644
--- a/srp/src/client.rs
+++ b/srp/src/client.rs
@@ -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",
});
diff --git a/srp/src/server.rs b/srp/src/server.rs
index 6e41404..f30608a 100644
--- a/srp/src/server.rs
+++ b/srp/src/server.rs
@@ -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",
});
diff --git a/srp/src/tools.rs b/srp/src/tools.rs
index f761dca..7f7da0f 100644
--- a/srp/src/tools.rs
+++ b/srp/src/tools.rs
@@ -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;