mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Implement CTEq for ExtendedPoint.
This commit is contained in:
parent
b1afdf5204
commit
3eb5dcaae7
1 changed files with 14 additions and 0 deletions
14
src/curve.rs
14
src/curve.rs
|
|
@ -986,6 +986,20 @@ mod test {
|
|||
assert_eq!( bp_added.compress(), BASE2_CMPRSSD);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extended_point_equality() {
|
||||
let two = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
|
||||
let id1 = ExtendedPoint::identity();
|
||||
let id2 = ExtendedPoint{
|
||||
X: FieldElement::zero(),
|
||||
Y: FieldElement::from_bytes(&two),
|
||||
Z: FieldElement::from_bytes(&two),
|
||||
T: FieldElement::zero()};
|
||||
|
||||
assert!(id1.ct_eq(&id2) == 1u8);
|
||||
}
|
||||
|
||||
/// Sanity check for conversion to precomputed points
|
||||
#[test]
|
||||
fn test_convert_to_precomputed() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue