aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--srp/Cargo.toml3
-rw-r--r--srp/src/client.rs3
-rw-r--r--srp/src/server.rs3
-rw-r--r--srp/src/tools.rs6
4 files changed, 6 insertions, 9 deletions
diff --git a/srp/Cargo.toml b/srp/Cargo.toml
index 3ade1b0..fdfea93 100644
--- a/srp/Cargo.toml
+++ b/srp/Cargo.toml
@@ -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"
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;