Remove Monero as a dependency

Introduces missing CLSAG checks. The only difference now should be the 
additional rejection of torsioned points, which is relevant to 
https://github.com/serai-dex/serai/issues/25. Considering this is only 
currently used for FROST verification, this should be fine.

Closes https://github.com/serai-dex/serai/issues/19 by making it 
irrelevant.

Increases priority of https://github.com/serai-dex/serai/issues/68, as 
now it's used for the BP generators which are done at first-proof.

Also merges BP's stricter hash_to_point with the library's, since CLSAG 
has the same bound.
This commit is contained in:
Luke Parker
2022-07-26 03:25:57 -04:00
parent ee29f6d6d8
commit 696da8228e
14 changed files with 33 additions and 403 deletions

View File

@@ -28,13 +28,7 @@ fn random_scalar<R: RngCore + CryptoRng>(rng: &mut R) -> Scalar {
}
fn hash_to_scalar(data: &[u8]) -> Scalar {
let scalar = Scalar(dalek_hash(data));
// Monero will explicitly retry on these cases, as them occurring breaks the proof
// This library acknowledges their practical impossibility of them occurring, and doesn't bother
// to code in logic to handle it. That said, if they ever occur, something must happen in order
// to not generate a proof we believe to be valid when it isn't
assert!(!bool::from(scalar.is_zero()), "ZERO HASH: {:?}", data);
scalar
Scalar(dalek_hash(data))
}
fn generator(i: usize) -> EdwardsPoint {