mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Add test for Montgomery ladder with a scalar with high bit set.
This commit is contained in:
parent
ca5b58c2b7
commit
9da24d8afa
1 changed files with 13 additions and 0 deletions
|
|
@ -545,6 +545,19 @@ mod test {
|
|||
|
||||
assert_eq!(result.compress(), expected.to_montgomery().compress());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "assertion failed: self[31] <= 127")]
|
||||
fn ladder_matches_scalarmult_with_scalar_high_bit_set() {
|
||||
let mut s: Scalar = Scalar::one();
|
||||
|
||||
s[31] = 255;
|
||||
|
||||
let result: MontgomeryPoint = &BASE_COMPRESSED_MONTGOMERY.decompress() * &s;
|
||||
let expected: ExtendedPoint = &constants::ED25519_BASEPOINT_TABLE * &s;
|
||||
|
||||
assert_eq!(result.compress(), expected.to_montgomery().compress())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "bench"))]
|
||||
|
|
|
|||
Loading…
Reference in a new issue