mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
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:
@@ -24,7 +24,9 @@ zeroize = { version = "1", default-features = false }
|
||||
rand_core = { version = "0.6", default-features = false }
|
||||
|
||||
blake2 = "0.10"
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["ristretto", "secp256k1"] }
|
||||
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 }
|
||||
schnorrkel = "0.11"
|
||||
dkg = { path = "../../crypto/dkg", default-features = false }
|
||||
|
||||
|
||||
@@ -14,9 +14,10 @@ use rand_core::{RngCore, OsRng};
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
|
||||
use serai_client::primitives::ExternalNetworkId;
|
||||
|
||||
@@ -10,7 +10,10 @@ use blake2::{
|
||||
digest::{consts::U32, Digest},
|
||||
Blake2b,
|
||||
};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto, Secp256k1};
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use dkg::Participant;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
@@ -6,10 +6,12 @@ use std::{
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ristretto, Secp256k1,
|
||||
Ciphersuite,
|
||||
};
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use dkg::ThresholdParams;
|
||||
|
||||
use serai_client::{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use tokio::time::{sleep, Duration};
|
||||
|
||||
use ciphersuite::Secp256k1;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use serai_client::{
|
||||
primitives::{insecure_pair_from_name, NetworkId},
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use rand_core::{RngCore, OsRng};
|
||||
|
||||
use ciphersuite::Secp256k1;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use dkg::Participant;
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ hex = "0.4"
|
||||
zeroize = { version = "1", default-features = false }
|
||||
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["ristretto"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false }
|
||||
|
||||
serai-primitives = { path = "../../substrate/primitives" }
|
||||
serai-message-queue = { path = "../../message-queue" }
|
||||
|
||||
@@ -2,9 +2,10 @@ use std::collections::HashMap;
|
||||
|
||||
use rand_core::OsRng;
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
|
||||
use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS};
|
||||
|
||||
@@ -19,10 +19,11 @@ workspace = true
|
||||
[dependencies]
|
||||
flexible-transcript = { path = "../../crypto/transcript", default-features = false, features = ["recommended", "merlin"] }
|
||||
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false }
|
||||
minimal-ed448 = { path = "../../crypto/ed448", default-features = false }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["alloc"] }
|
||||
minimal-ed448 = { path = "../../crypto/ed448", default-features = false, features = ["alloc"] }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc", "secp256k1", "p256", "ed25519", "ristretto", "ed448"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc"] }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["alloc"] }
|
||||
|
||||
multiexp = { path = "../../crypto/multiexp", default-features = false, features = ["batch"] }
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ pub use dalek_ff_group;
|
||||
pub use minimal_ed448;
|
||||
|
||||
pub use ciphersuite;
|
||||
pub use ciphersuite_kp256;
|
||||
|
||||
pub use multiexp;
|
||||
|
||||
|
||||
@@ -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" }
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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, .. } => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::Ciphersuite;
|
||||
|
||||
use dockertest::DockerTest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user