mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-08 21:00:40 +00:00
curve: Implement ConditionallySelectable for MontgomeryPoint (#677)
This commit is contained in:
parent
a7a9fffdc9
commit
79ab6c29bd
2 changed files with 7 additions and 1 deletions
|
|
@ -51,7 +51,7 @@ ff = { version = "0.13", default-features = false, optional = true }
|
||||||
group = { version = "0.13", default-features = false, optional = true }
|
group = { version = "0.13", default-features = false, optional = true }
|
||||||
rand_core = { version = "0.6.4", default-features = false, optional = true }
|
rand_core = { version = "0.6.4", default-features = false, optional = true }
|
||||||
digest = { version = "0.10", default-features = false, optional = true }
|
digest = { version = "0.10", default-features = false, optional = true }
|
||||||
subtle = { version = "2.6.0", default-features = false }
|
subtle = { version = "2.6.0", default-features = false, features = ["const-generics"]}
|
||||||
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
|
||||||
zeroize = { version = "1", default-features = false, optional = true }
|
zeroize = { version = "1", default-features = false, optional = true }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,12 @@ impl ConstantTimeEq for MontgomeryPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ConditionallySelectable for MontgomeryPoint {
|
||||||
|
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self {
|
||||||
|
Self(<[u8; 32]>::conditional_select(&a.0, &b.0, choice))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq for MontgomeryPoint {
|
impl PartialEq for MontgomeryPoint {
|
||||||
fn eq(&self, other: &MontgomeryPoint) -> bool {
|
fn eq(&self, other: &MontgomeryPoint) -> bool {
|
||||||
self.ct_eq(other).into()
|
self.ct_eq(other).into()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue