Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/big_integer/poly1305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions src/ciphers/diffie_hellman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,14 @@ 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(
&((&self.prime - BigUint::from(1_u8)) / BigUint::from(2_u8)),
&self.prime,
)
.is_zero()
{
return true;
}
false
}

/// Generate the shared key
Expand Down