Smash Ciphersuite definitions into their own crates

Uses dalek-ff-group for Ed25519 and Ristretto. Uses minimal-ed448 for Ed448.
Adds ciphersuite-kp256 for Secp256k1 and P-256.
This commit is contained in:
Luke Parker
2025-08-20 04:50:37 -04:00
parent 8be03a8fc2
commit b63ef32864
95 changed files with 322 additions and 184 deletions

View File

@@ -23,7 +23,9 @@ zeroize = { version = "1", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
curve25519-dalek = "4"
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["secp256k1", "ristretto"] }
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false }
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false }
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false }
dkg = { path = "../../crypto/dkg", default-features = false }
bitcoin-serai = { path = "../../networks/bitcoin" }

View File

@@ -5,7 +5,8 @@ use std::sync::{OnceLock, Mutex};
use zeroize::Zeroizing;
use rand_core::{RngCore, OsRng};
use ciphersuite::{group::ff::PrimeField, Ciphersuite, Ristretto};
use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::PrimeField, Ciphersuite};
use serai_client::primitives::ExternalNetworkId;
use messages::{ProcessorMessage, CoordinatorMessage};

View File

@@ -90,7 +90,7 @@ pub enum Wallet {
},
Ethereum {
rpc_url: String,
key: <ciphersuite::Secp256k1 as Ciphersuite>::F,
key: <ciphersuite_kp256::Secp256k1 as Ciphersuite>::F,
nonce: u64,
},
Monero {
@@ -149,7 +149,8 @@ impl Wallet {
}
ExternalNetworkId::Ethereum => {
use ciphersuite::{group::ff::Field, Secp256k1};
use ciphersuite::group::ff::Field;
use ciphersuite_kp256::Secp256k1;
use ethereum_serai::alloy::{
primitives::{U256, Address},
simple_request_transport::SimpleRequest,
@@ -321,7 +322,7 @@ impl Wallet {
));
let to_as_key = PublicKey::new(
<ciphersuite::Secp256k1 as Ciphersuite>::read_G(&mut to.as_slice()).unwrap(),
<ciphersuite_kp256::Secp256k1 as Ciphersuite>::read_G(&mut to.as_slice()).unwrap(),
)
.unwrap();
let router_addr = {
@@ -502,7 +503,7 @@ impl Wallet {
.unwrap()
}
Wallet::Ethereum { key, .. } => ExternalAddress::new(
ethereum_serai::crypto::address(&(ciphersuite::Secp256k1::generator() * key)).into(),
ethereum_serai::crypto::address(&(ciphersuite_kp256::Secp256k1::generator() * key)).into(),
)
.unwrap(),
Wallet::Monero { view_pair, .. } => {

View File

@@ -1,6 +1,7 @@
use std::collections::HashMap;
use ciphersuite::{Ciphersuite, Ristretto};
use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use dockertest::DockerTest;