mirror of
https://github.com/saymrwulf/anza-cryptography-source.git
synced 2026-09-08 21:00:37 +00:00
Compare commits
1 commit
ca701d2e7b
...
e57e51ba68
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e57e51ba68 |
1 changed files with 2 additions and 7 deletions
|
|
@ -121,6 +121,7 @@ use {
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
|
|
||||||
use subtle::Choice;
|
use subtle::Choice;
|
||||||
|
use subtle::ConditionallyNegatable;
|
||||||
use subtle::ConditionallySelectable;
|
use subtle::ConditionallySelectable;
|
||||||
use subtle::ConstantTimeEq;
|
use subtle::ConstantTimeEq;
|
||||||
|
|
||||||
|
|
@ -245,13 +246,7 @@ mod decompress {
|
||||||
// FieldElement::sqrt_ratio_i always returns the nonnegative square root,
|
// FieldElement::sqrt_ratio_i always returns the nonnegative square root,
|
||||||
// so we negate according to the supplied sign bit.
|
// so we negate according to the supplied sign bit.
|
||||||
let compressed_sign_bit = Choice::from(repr.as_bytes()[31] >> 7);
|
let compressed_sign_bit = Choice::from(repr.as_bytes()[31] >> 7);
|
||||||
// AENEAS-COMPAT: negate-then-conditional-assign instead of
|
X.conditional_negate(compressed_sign_bit);
|
||||||
// `X.conditional_negate(...)` — semantically identical and still
|
|
||||||
// constant-time, but avoids subtle's `ConditionallyNegatable`
|
|
||||||
// blanket impl which breaks the verification toolchain (the same
|
|
||||||
// documented rewrite as in `FieldElement::sqrt_ratio_i`).
|
|
||||||
let X_neg = -&X;
|
|
||||||
X.conditional_assign(&X_neg, compressed_sign_bit);
|
|
||||||
|
|
||||||
EdwardsPoint {
|
EdwardsPoint {
|
||||||
X,
|
X,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue