mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
curve: Use constant-time compressed edwards equality testing (#684)
This commit is contained in:
parent
d54b196d18
commit
9e4ec01fa2
1 changed files with 9 additions and 1 deletions
|
|
@ -170,7 +170,8 @@ use alloc::vec::Vec;
|
|||
///
|
||||
/// The first 255 bits of a `CompressedEdwardsY` represent the
|
||||
/// \\(y\\)-coordinate. The high bit of the 32nd byte gives the sign of \\(x\\).
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
|
||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||
#[derive(Copy, Clone, Hash)]
|
||||
pub struct CompressedEdwardsY(pub [u8; 32]);
|
||||
|
||||
impl ConstantTimeEq for CompressedEdwardsY {
|
||||
|
|
@ -179,6 +180,13 @@ impl ConstantTimeEq for CompressedEdwardsY {
|
|||
}
|
||||
}
|
||||
|
||||
impl Eq for CompressedEdwardsY {}
|
||||
impl PartialEq for CompressedEdwardsY {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.ct_eq(other).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for CompressedEdwardsY {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
write!(f, "CompressedEdwardsY: {:?}", self.as_bytes())
|
||||
|
|
|
|||
Loading…
Reference in a new issue