mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Create dedicated message structures for FROST messages (#140)
* Create message types for FROST key gen Taking in reader borrows absolutely wasn't feasible. Now, proper types which can be read (and then passed directly, without a mutable borrow) exist for key_gen. sign coming next. * Move FROST signing to messages, not Readers/Writers/Vec<u8> Also takes the nonce handling code and makes a dedicated file for it, aiming to resolve complex types and make the code more legible by replacing its previously inlined state. * clippy * Update FROST tests * read_signature_share * Update the Monero library to the new FROST packages * Update processor to latest FROST * Tweaks to terminology and documentation
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use std::io::Cursor;
|
||||
|
||||
use rand_core::OsRng;
|
||||
|
||||
use crate::{
|
||||
@@ -13,32 +11,31 @@ fn ed448_8032_vector() {
|
||||
let context = hex::decode("666f6f").unwrap();
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
let A = Ed448::read_G(&mut Cursor::new(
|
||||
hex::decode(
|
||||
let A = Ed448::read_G::<&[u8]>(
|
||||
&mut hex::decode(
|
||||
"43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c".to_owned() +
|
||||
"6798c0866aea01eb00742802b8438ea4cb82169c235160627b4c3a94" +
|
||||
"80",
|
||||
)
|
||||
.unwrap(),
|
||||
))
|
||||
.unwrap()
|
||||
.as_ref(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let msg = hex::decode("03").unwrap();
|
||||
|
||||
let mut sig = Cursor::new(
|
||||
hex::decode(
|
||||
"d4f8f6131770dd46f40867d6fd5d5055de43541f8c5e35abbcd001b3".to_owned() +
|
||||
"2a89f7d2151f7647f11d8ca2ae279fb842d607217fce6e042f6815ea" +
|
||||
"00" +
|
||||
"0c85741de5c8da1144a6a1aba7f96de42505d7a7298524fda538fccb" +
|
||||
"bb754f578c1cad10d54d0d5428407e85dcbc98a49155c13764e66c3c" +
|
||||
"00",
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
let sig = hex::decode(
|
||||
"d4f8f6131770dd46f40867d6fd5d5055de43541f8c5e35abbcd001b3".to_owned() +
|
||||
"2a89f7d2151f7647f11d8ca2ae279fb842d607217fce6e042f6815ea" +
|
||||
"00" +
|
||||
"0c85741de5c8da1144a6a1aba7f96de42505d7a7298524fda538fccb" +
|
||||
"bb754f578c1cad10d54d0d5428407e85dcbc98a49155c13764e66c3c" +
|
||||
"00",
|
||||
)
|
||||
.unwrap();
|
||||
#[allow(non_snake_case)]
|
||||
let R = Ed448::read_G(&mut sig).unwrap();
|
||||
let s = Ed448::read_F(&mut sig).unwrap();
|
||||
let R = Ed448::read_G::<&[u8]>(&mut sig.as_ref()).unwrap();
|
||||
let s = Ed448::read_F::<&[u8]>(&mut &sig[57 ..]).unwrap();
|
||||
|
||||
assert!(verify(
|
||||
A,
|
||||
|
||||
Reference in New Issue
Block a user