diff --git a/src/big_integer/poly1305.rs b/src/big_integer/poly1305.rs index eae3c016eaa..4602e6d9dc6 100644 --- a/src/big_integer/poly1305.rs +++ b/src/big_integer/poly1305.rs @@ -13,7 +13,7 @@ macro_rules! hex_uint { * This implementation is based on RFC8439. * Note that the Big Integer library we are using may not be suitable for * cryptographic applications due to non constant time operations. -*/ + */ pub struct Poly1305 { p: BigUint, r: BigUint, diff --git a/src/ciphers/diffie_hellman.rs b/src/ciphers/diffie_hellman.rs index 86b2c9d19b1..d749b3c4081 100644 --- a/src/ciphers/diffie_hellman.rs +++ b/src/ciphers/diffie_hellman.rs @@ -262,7 +262,7 @@ impl DiffieHellman { .unwrap_or_else(|_| BigUint::parse_bytes(b"0", 16).unwrap()); // Check if the other public key is valid based on NIST SP800-56 - if BigUint::from(2_u8) <= key + BigUint::from(2_u8) <= key && key <= &self.prime - BigUint::from(2_u8) && !key .modpow( @@ -270,10 +270,6 @@ impl DiffieHellman { &self.prime, ) .is_zero() - { - return true; - } - false } /// Generate the shared key