Commit Graph

20 Commits

Author SHA1 Message Date
Luke Parker
60254a0171 Reorganize FROST's handling of curves 2022-06-24 19:47:19 -04:00
Luke Parker
1caa6a9606 Enforce FROST StateMachine progression via the type system
A comment on the matter was made in 
https://github.com/serai-dex/serai/issues/12. While I do believe the API 
is slightly worse, I appreciate the explicitness.
2022-06-24 08:40:14 -04:00
Luke Parker
382ff75455 Replace FROST's ff/group usage with just group 2022-06-19 06:36:47 -04:00
Luke Parker
fdb1929ba4 Move to Arc/RwLock 2022-06-05 07:33:15 -04:00
Luke Parker
3617ed4eb7 Use const values for our traits where we can 2022-06-03 23:22:08 -04:00
Luke Parker
b4cd29f49a Finish implementing FROST v5
Identity check for P256 and H4 was all that was needed.
2022-06-03 02:00:38 -04:00
Luke Parker
44452d9bfe Verify being FROST v5 compliant
No functional changes have been made to signing, with solely slight API 
changes being made.

Technically not actually FROST v5 compatible, due to differing on zero 
checks and randomness, yet the vectors do confirm the core algorithm. 
For any valid FROST implementation, this will be interoperable if they 
can successfully communicate. For any devious FROST implementation, this 
will be fingerprintable, yet should still be valid.

Relevant to https://github.com/serai-dex/serai/issues/9 as any curve can 
now specify vectors for itself and be tested against them.

Moves the FROST testing curve from k256 to p256. Does not expose p256 
despite being compliant. It's not at a point I'm happy with it, notably 
regarding hash to curve, and I'm not sure I care to support p256. If it 
has value to the larger FROST ecosystem...
2022-06-03 01:25:46 -04:00
Luke Parker
ce4c899422 Remove "as", except for floats as needed
Also updates Bulletproofs from C to not be length prefixed, yet rather 
have Rust calculate their length.

Corrects an error in key_gen where self was blamed, instead of the 
faulty participant.
2022-05-30 02:14:34 -04:00
Luke Parker
614badfef7 Lint FROST key gen and optimize sign for the success path 2022-05-30 01:46:30 -04:00
Luke Parker
244d1b6b68 Clarify FROST's hash functions
Updates the keygen challenge to a format not vulnerable to collisions 
due to having multiple variable length elements.
2022-05-28 20:34:44 -04:00
Luke Parker
d67d6f2f98 Add PartialEq to structs 2022-05-25 00:21:01 -04:00
Luke Parker
d10c6e16dc Move FROST to HashMaps
Honestly, the borrowed keys are frustrating, and this probably reduces 
performance while no longer offering an order when iterating. That said, 
they enable full u16 indexing and should mildly improve the API.

Cleans the Proof of Knowledge handling present in key gen.
2022-05-24 21:41:14 -04:00
Luke Parker
5ff65bd268 Move the DLEQProof to a Transcript 2022-05-23 03:24:33 -04:00
Luke Parker
90fccc444b Remove .is_some() unwraps for if let Some 2022-05-18 01:08:54 -04:00
Luke Parker
fd0fd77cf5 Simplify Monero key image handling 2022-05-17 19:15:53 -04:00
Luke Parker
3dab26cd94 Correct discrepancies with the IETF draft
While all the transcript/extension code works as expected, which means, 
they don't cause any conflicts, n was still capped at u64::MAX at 
creation when it needs to be u16. Furthermore, participant index and 
scalars/points were little endian instead of big endian/curve dependent.
2022-05-06 07:49:18 -04:00
Luke Parker
964cb357e6 Use a global transcript 2022-05-06 07:33:08 -04:00
Luke Parker
cc9c2e0d40 Use dom-sep tags in the transcripts
Also simplifies form in some places
2022-05-06 01:35:23 -04:00
Luke Parker
bf257b3a1f Transcript crate with both a merlin backend and a basic label len value backend
Moves binding factor/seeded RNGs over to the transcripts.
2022-05-03 07:20:24 -04:00
Luke Parker
87f38cafe4 Rename sign folder to crypto
Inspired by #3 and #5.
2022-05-03 00:46:50 -04:00