Skip to content

Commit 79ab6c2

Browse files
authored
curve: Implement ConditionallySelectable for MontgomeryPoint (#677)
1 parent a7a9fff commit 79ab6c2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

curve25519-dalek/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ff = { version = "0.13", default-features = false, optional = true }
5151
group = { version = "0.13", default-features = false, optional = true }
5252
rand_core = { version = "0.6.4", default-features = false, optional = true }
5353
digest = { version = "0.10", default-features = false, optional = true }
54-
subtle = { version = "2.6.0", default-features = false }
54+
subtle = { version = "2.6.0", default-features = false, features = ["const-generics"]}
5555
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
5656
zeroize = { version = "1", default-features = false, optional = true }
5757

curve25519-dalek/src/montgomery.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ impl ConstantTimeEq for MontgomeryPoint {
8484
}
8585
}
8686

87+
impl ConditionallySelectable for MontgomeryPoint {
88+
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self {
89+
Self(<[u8; 32]>::conditional_select(&a.0, &b.0, choice))
90+
}
91+
}
92+
8793
impl PartialEq for MontgomeryPoint {
8894
fn eq(&self, other: &MontgomeryPoint) -> bool {
8995
self.ct_eq(other).into()

0 commit comments

Comments
 (0)