5 Commits

Author SHA1 Message Date
Luke Parker
758d422595 Have <ed448::Point as Zeroize>::zeroize yield a well-defined value 2025-08-20 08:14:00 -04:00
Luke Parker
9841061b49 Add missing feature in substrate/client 2025-08-20 06:38:25 -04:00
Luke Parker
4122a0135f Fix dirty Cargo.lock 2025-08-20 05:20:47 -04:00
Luke Parker
b63ef32864 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.
2025-08-20 05:12:36 -04:00
Luke Parker
8be03a8fc2 Fix dirty lockfile 2025-08-20 01:15:56 -04:00
96 changed files with 339 additions and 188 deletions

View File

@@ -32,6 +32,7 @@ jobs:
-p dalek-ff-group \ -p dalek-ff-group \
-p minimal-ed448 \ -p minimal-ed448 \
-p ciphersuite \ -p ciphersuite \
-p ciphersuite-kp256 \
-p multiexp \ -p multiexp \
-p schnorr-signatures \ -p schnorr-signatures \
-p dleq \ -p dleq \

47
Cargo.lock generated
View File

@@ -1529,22 +1529,30 @@ dependencies = [
name = "ciphersuite" name = "ciphersuite"
version = "0.4.2" version = "0.4.2"
dependencies = [ dependencies = [
"dalek-ff-group",
"digest 0.10.7", "digest 0.10.7",
"elliptic-curve",
"ff", "ff",
"ff-group-tests", "ff-group-tests",
"flexible-transcript", "flexible-transcript",
"group", "group",
"hex", "hex",
"rand_core",
"std-shims",
"subtle",
"zeroize",
]
[[package]]
name = "ciphersuite-kp256"
version = "0.4.0"
dependencies = [
"ciphersuite",
"elliptic-curve",
"ff-group-tests",
"hex",
"k256", "k256",
"minimal-ed448",
"p256", "p256",
"rand_core", "rand_core",
"sha2", "sha2",
"sha3",
"std-shims",
"subtle",
"zeroize", "zeroize",
] ]
@@ -1982,14 +1990,17 @@ dependencies = [
name = "dalek-ff-group" name = "dalek-ff-group"
version = "0.4.3" version = "0.4.3"
dependencies = [ dependencies = [
"ciphersuite",
"crypto-bigint", "crypto-bigint",
"curve25519-dalek", "curve25519-dalek",
"digest 0.10.7", "digest 0.10.7",
"ff", "ff",
"ff-group-tests", "ff-group-tests",
"group", "group",
"hex",
"rand_core", "rand_core",
"rustversion", "rustversion",
"sha2",
"subtle", "subtle",
"zeroize", "zeroize",
] ]
@@ -2237,6 +2248,7 @@ name = "dkg-musig"
version = "0.6.0" version = "0.6.0"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg", "dkg",
"dkg-recovery", "dkg-recovery",
"multiexp", "multiexp",
@@ -2252,6 +2264,7 @@ version = "0.6.0"
dependencies = [ dependencies = [
"chacha20", "chacha20",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg", "dkg",
"dleq", "dleq",
"flexible-transcript", "flexible-transcript",
@@ -2267,6 +2280,7 @@ name = "dkg-promote"
version = "0.6.1" version = "0.6.1"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg", "dkg",
"dkg-recovery", "dkg-recovery",
"dleq", "dleq",
@@ -2918,6 +2932,7 @@ name = "frost-schnorrkel"
version = "0.2.0" version = "0.2.0"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"flexible-transcript", "flexible-transcript",
"group", "group",
"modular-frost", "modular-frost",
@@ -4812,8 +4827,9 @@ dependencies = [
[[package]] [[package]]
name = "minimal-ed448" name = "minimal-ed448"
version = "0.4.1" version = "0.4.2"
dependencies = [ dependencies = [
"ciphersuite",
"crypto-bigint", "crypto-bigint",
"ff", "ff",
"ff-group-tests", "ff-group-tests",
@@ -4822,6 +4838,7 @@ dependencies = [
"hex", "hex",
"rand_core", "rand_core",
"rustversion", "rustversion",
"sha3",
"subtle", "subtle",
"zeroize", "zeroize",
] ]
@@ -4885,6 +4902,7 @@ name = "modular-frost"
version = "0.10.1" version = "0.10.1"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"ciphersuite-kp256",
"dalek-ff-group", "dalek-ff-group",
"digest 0.10.7", "digest 0.10.7",
"dkg", "dkg",
@@ -5118,7 +5136,7 @@ dependencies = [
[[package]] [[package]]
name = "multiexp" name = "multiexp"
version = "0.4.1" version = "0.4.2"
dependencies = [ dependencies = [
"dalek-ff-group", "dalek-ff-group",
"ff", "ff",
@@ -8049,6 +8067,7 @@ dependencies = [
"bitcoin", "bitcoin",
"blake2", "blake2",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg-musig", "dkg-musig",
"dockertest", "dockertest",
"frame-system", "frame-system",
@@ -8109,6 +8128,7 @@ dependencies = [
"blake2", "blake2",
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg-musig", "dkg-musig",
"env_logger", "env_logger",
"flexible-transcript", "flexible-transcript",
@@ -8142,6 +8162,8 @@ dependencies = [
"blake2", "blake2",
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"ciphersuite-kp256",
"dalek-ff-group",
"dkg", "dkg",
"dockertest", "dockertest",
"hex", "hex",
@@ -8349,6 +8371,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"env_logger", "env_logger",
"flexible-transcript", "flexible-transcript",
"hex", "hex",
@@ -8369,6 +8392,7 @@ name = "serai-message-queue-tests"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dockertest", "dockertest",
"hex", "hex",
"rand_core", "rand_core",
@@ -8385,6 +8409,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bitcoin-serai", "bitcoin-serai",
"ciphersuite", "ciphersuite",
"ciphersuite-kp256",
"dalek-ff-group", "dalek-ff-group",
"dkg", "dkg",
"dkg-dealer", "dkg-dealer",
@@ -8448,6 +8473,7 @@ name = "serai-orchestrator"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"flexible-transcript", "flexible-transcript",
"hex", "hex",
"home", "home",
@@ -8484,6 +8510,7 @@ dependencies = [
"blake2", "blake2",
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"ciphersuite-kp256",
"const-hex", "const-hex",
"dalek-ff-group", "dalek-ff-group",
"dkg-pedpop", "dkg-pedpop",
@@ -8536,7 +8563,9 @@ dependencies = [
"bitcoin-serai", "bitcoin-serai",
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"ciphersuite-kp256",
"curve25519-dalek", "curve25519-dalek",
"dalek-ff-group",
"dkg", "dkg",
"dockertest", "dockertest",
"ethereum-serai", "ethereum-serai",
@@ -8671,6 +8700,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"borsh", "borsh",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"dkg-musig", "dkg-musig",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@@ -10419,6 +10449,7 @@ dependencies = [
"async-trait", "async-trait",
"blake2", "blake2",
"ciphersuite", "ciphersuite",
"dalek-ff-group",
"flexible-transcript", "flexible-transcript",
"futures-channel", "futures-channel",
"futures-util", "futures-util",

View File

@@ -28,6 +28,7 @@ members = [
"crypto/dalek-ff-group", "crypto/dalek-ff-group",
"crypto/ed448", "crypto/ed448",
"crypto/ciphersuite", "crypto/ciphersuite",
"crypto/ciphersuite/kp256",
"crypto/multiexp", "crypto/multiexp",

View File

@@ -25,15 +25,6 @@ mod mutex_shim {
} }
pub use mutex_shim::{ShimMutex as Mutex, MutexGuard}; pub use mutex_shim::{ShimMutex as Mutex, MutexGuard};
#[cfg(not(feature = "std"))]
pub use spin::Once as OnceLock;
#[rustversion::before(1.70)]
#[cfg(feature = "std")]
pub use spin::Once as OnceLock;
#[rustversion::since(1.70)]
#[cfg(feature = "std")]
pub use std::sync::OnceLock;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
pub use spin::Lazy as LazyLock; pub use spin::Lazy as LazyLock;
#[rustversion::before(1.80)] #[rustversion::before(1.80)]

View File

@@ -25,6 +25,7 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
blake2 = { version = "0.10", default-features = false, features = ["std"] } blake2 = { version = "0.10", default-features = false, features = ["std"] }
transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] }
dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] } ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] } schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] }
dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] } dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] }

View File

@@ -8,12 +8,13 @@ use std::{
use zeroize::{Zeroize, Zeroizing}; use zeroize::{Zeroize, Zeroizing};
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ group::{
ff::{Field, PrimeField}, ff::{Field, PrimeField},
GroupEncoding, GroupEncoding,
}, },
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;
use frost::Participant; use frost::Participant;

View File

@@ -14,7 +14,8 @@
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use borsh::{BorshSerialize, BorshDeserialize}; use borsh::{BorshSerialize, BorshDeserialize};

View File

@@ -6,7 +6,8 @@ use std::{
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use serai_client::{ use serai_client::{
coins::CoinsEvent, coins::CoinsEvent,

View File

@@ -7,9 +7,10 @@ use zeroize::Zeroizing;
use rand_core::{RngCore, CryptoRng, OsRng}; use rand_core::{RngCore, CryptoRng, OsRng};
use futures_util::{task::Poll, poll}; use futures_util::{task::Poll, poll};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, GroupEncoding}, group::{ff::Field, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use sp_application_crypto::sr25519; use sp_application_crypto::sr25519;

View File

@@ -4,7 +4,8 @@ use std::collections::HashMap;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::{RngCore, OsRng}; use rand_core::{RngCore, OsRng};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use frost::Participant; use frost::Participant;
use sp_runtime::traits::Verify; use sp_runtime::traits::Verify;

View File

@@ -2,7 +2,8 @@ use core::fmt::Debug;
use rand_core::{RngCore, OsRng}; use rand_core::{RngCore, OsRng};
use ciphersuite::{group::Group, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::Group, Ciphersuite};
use scale::{Encode, Decode}; use scale::{Encode, Decode};
use serai_client::{ use serai_client::{

View File

@@ -3,7 +3,8 @@ use std::{sync::Arc, collections::HashSet};
use rand_core::OsRng; use rand_core::OsRng;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use tokio::{ use tokio::{
sync::{mpsc, broadcast}, sync::{mpsc, broadcast},

View File

@@ -3,7 +3,8 @@ use std::collections::HashMap;
use scale::Encode; use scale::Encode;
use borsh::{BorshSerialize, BorshDeserialize}; use borsh::{BorshSerialize, BorshDeserialize};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use frost::Participant; use frost::Participant;
use serai_client::validator_sets::primitives::{KeyPair, ExternalValidatorSet}; use serai_client::validator_sets::primitives::{KeyPair, ExternalValidatorSet};

View File

@@ -4,7 +4,8 @@ use std::collections::HashMap;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::OsRng; use rand_core::OsRng;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use frost::dkg::Participant; use frost::dkg::Participant;
use scale::{Encode, Decode}; use scale::{Encode, Decode};

View File

@@ -1,4 +1,5 @@
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use serai_client::validator_sets::primitives::ExternalValidatorSet; use serai_client::validator_sets::primitives::ExternalValidatorSet;

View File

@@ -3,7 +3,8 @@ use std::{sync::Arc, collections::HashSet};
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use tokio::sync::broadcast; use tokio::sync::broadcast;

View File

@@ -63,9 +63,10 @@ use rand_core::OsRng;
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::PrimeField, GroupEncoding}, group::{ff::PrimeField, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use dkg_musig::musig; use dkg_musig::musig;
use frost::{FrostError, dkg::Participant, ThresholdKeys, sign::*}; use frost::{FrostError, dkg::Participant, ThresholdKeys, sign::*};

View File

@@ -3,7 +3,8 @@ use std::{io, collections::HashMap};
use transcript::{Transcript, RecommendedTranscript}; use transcript::{Transcript, RecommendedTranscript};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use frost::Participant; use frost::Participant;
use scale::Encode; use scale::Encode;

View File

@@ -7,9 +7,10 @@ use rand_core::{RngCore, CryptoRng};
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use transcript::{Transcript, RecommendedTranscript}; use transcript::{Transcript, RecommendedTranscript};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, GroupEncoding}, group::{ff::Field, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;
use frost::Participant; use frost::Participant;

View File

@@ -27,7 +27,8 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] }
blake2 = { version = "0.10", default-features = false, features = ["std"] } blake2 = { version = "0.10", default-features = false, features = ["std"] }
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", default-features = false, features = ["std", "recommended"] } transcript = { package = "flexible-transcript", path = "../../crypto/transcript", default-features = false, features = ["std", "recommended"] }
ciphersuite = { package = "ciphersuite", path = "../../crypto/ciphersuite", default-features = false, features = ["std", "ristretto"] } dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
ciphersuite = { package = "ciphersuite", path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] } schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] }
hex = { version = "0.4", default-features = false, features = ["std"] } hex = { version = "0.4", default-features = false, features = ["std"] }

View File

@@ -1,6 +1,7 @@
use std::collections::{VecDeque, HashSet}; use std::collections::{VecDeque, HashSet};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use serai_db::{Get, DbTxn, Db}; use serai_db::{Get, DbTxn, Db};

View File

@@ -5,7 +5,8 @@ use async_trait::async_trait;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use scale::Decode; use scale::Decode;
use futures_channel::mpsc::UnboundedReceiver; use futures_channel::mpsc::UnboundedReceiver;

View File

@@ -1,6 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use serai_db::{DbTxn, Db}; use serai_db::{DbTxn, Db};

View File

@@ -11,12 +11,13 @@ use rand_chacha::ChaCha12Rng;
use transcript::{Transcript, RecommendedTranscript}; use transcript::{Transcript, RecommendedTranscript};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ group::{
GroupEncoding, GroupEncoding,
ff::{Field, PrimeField}, ff::{Field, PrimeField},
}, },
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::{ use schnorr::{
SchnorrSignature, SchnorrSignature,

View File

@@ -4,7 +4,8 @@ use scale::{Encode, Decode, IoReader};
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use crate::{ use crate::{
transaction::{Transaction, TransactionKind, TransactionError}, transaction::{Transaction, TransactionKind, TransactionError},

View File

@@ -1,9 +1,11 @@
use std::{sync::Arc, io, collections::HashMap, fmt::Debug}; use std::{sync::Arc, io, collections::HashMap, fmt::Debug};
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, Group}, group::{ff::Field, Group},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;

View File

@@ -10,7 +10,8 @@ use rand::rngs::OsRng;
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use ciphersuite::{group::ff::Field, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::Field, Ciphersuite};
use serai_db::{DbTxn, Db, MemDb}; use serai_db::{DbTxn, Db, MemDb};

View File

@@ -3,7 +3,8 @@ use std::{sync::Arc, collections::HashMap};
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand::{RngCore, rngs::OsRng}; use rand::{RngCore, rngs::OsRng};
use ciphersuite::{group::ff::Field, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::Field, Ciphersuite};
use tendermint::ext::Commit; use tendermint::ext::Commit;

View File

@@ -6,9 +6,10 @@ use rand::{RngCore, CryptoRng, rngs::OsRng};
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, Group}, group::{ff::Field, Group},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;

View File

@@ -2,7 +2,8 @@ use rand::rngs::OsRng;
use blake2::{Digest, Blake2s256}; use blake2::{Digest, Blake2s256};
use ciphersuite::{group::ff::Field, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::Field, Ciphersuite};
use crate::{ use crate::{
ReadWrite, ReadWrite,

View File

@@ -3,7 +3,8 @@ use std::sync::Arc;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand::{RngCore, rngs::OsRng}; use rand::{RngCore, rngs::OsRng};
use ciphersuite::{Ristretto, Ciphersuite, group::ff::Field}; use dalek_ff_group::Ristretto;
use ciphersuite::{Ciphersuite, group::ff::Field};
use scale::Encode; use scale::Encode;

View File

@@ -6,9 +6,10 @@ use thiserror::Error;
use blake2::{Digest, Blake2b512}; use blake2::{Digest, Blake2b512};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{Group, GroupEncoding}, group::{Group, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;

View File

@@ -26,20 +26,10 @@ subtle = { version = "^2.4", default-features = false }
digest = { version = "0.10", default-features = false, features = ["core-api"] } digest = { version = "0.10", default-features = false, features = ["core-api"] }
transcript = { package = "flexible-transcript", path = "../transcript", version = "^0.3.2", default-features = false } transcript = { package = "flexible-transcript", path = "../transcript", version = "^0.3.2", default-features = false }
sha2 = { version = "0.10", default-features = false, optional = true }
sha3 = { version = "0.10", default-features = false, optional = true }
ff = { version = "0.13", default-features = false, features = ["bits"] } ff = { version = "0.13", default-features = false, features = ["bits"] }
group = { version = "0.13", default-features = false } group = { version = "0.13", default-features = false }
dalek-ff-group = { path = "../dalek-ff-group", version = "0.4", default-features = false, optional = true }
elliptic-curve = { version = "0.13", default-features = false, features = ["hash2curve"], optional = true }
p256 = { version = "^0.13.1", default-features = false, features = ["arithmetic", "bits", "hash2curve"], optional = true }
k256 = { version = "^0.13.1", default-features = false, features = ["arithmetic", "bits", "hash2curve"], optional = true }
minimal-ed448 = { path = "../ed448", version = "0.4", default-features = false, optional = true }
[dev-dependencies] [dev-dependencies]
hex = { version = "0.4", default-features = false, features = ["std"] } hex = { version = "0.4", default-features = false, features = ["std"] }
@@ -59,27 +49,8 @@ std = [
"digest/std", "digest/std",
"transcript/std", "transcript/std",
"sha2?/std",
"sha3?/std",
"ff/std", "ff/std",
"dalek-ff-group?/std",
"elliptic-curve?/std",
"p256?/std",
"k256?/std",
"minimal-ed448?/std",
] ]
dalek = ["sha2", "dalek-ff-group"]
ed25519 = ["dalek"]
ristretto = ["dalek"]
kp256 = ["sha2", "elliptic-curve"]
p256 = ["kp256", "dep:p256"]
secp256k1 = ["kp256", "k256"]
ed448 = ["sha3", "minimal-ed448"]
default = ["std"] default = ["std"]

View File

@@ -21,6 +21,8 @@ Their `hash_to_F` is the
[IETF's hash to curve](https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html), [IETF's hash to curve](https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html),
yet applied to their scalar field. yet applied to their scalar field.
Please see the [`ciphersuite-kp256`](https://docs.rs/ciphersuite-kp256) crate for more info.
### Ed25519/Ristretto ### Ed25519/Ristretto
Ed25519/Ristretto are offered via Ed25519/Ristretto are offered via
@@ -33,6 +35,8 @@ the draft
[RFC-RISTRETTO](https://www.ietf.org/archive/id/draft-irtf-cfrg-ristretto255-decaf448-05.html). [RFC-RISTRETTO](https://www.ietf.org/archive/id/draft-irtf-cfrg-ristretto255-decaf448-05.html).
The domain-separation tag is naively prefixed to the message. The domain-separation tag is naively prefixed to the message.
Please see the [`dalek-ff-group`](https://docs.rs/dalek-ff-group) crate for more info.
### Ed448 ### Ed448
Ed448 is offered via [minimal-ed448](https://crates.io/crates/minimal-ed448), an Ed448 is offered via [minimal-ed448](https://crates.io/crates/minimal-ed448), an
@@ -42,3 +46,5 @@ to its prime-order subgroup.
Its `hash_to_F` is the wide reduction of SHAKE256, with a 114-byte output, as Its `hash_to_F` is the wide reduction of SHAKE256, with a 114-byte output, as
used in [RFC-8032](https://www.rfc-editor.org/rfc/rfc8032). The used in [RFC-8032](https://www.rfc-editor.org/rfc/rfc8032). The
domain-separation tag is naively prefixed to the message. domain-separation tag is naively prefixed to the message.
Please see the [`minimal-ed448`](https://docs.rs/minimal-ed448) crate for more info.

View File

@@ -0,0 +1,55 @@
[package]
name = "ciphersuite-kp256"
version = "0.4.0"
description = "Ciphersuites built around ff/group"
license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ciphersuite/kp256"
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = ["ciphersuite", "ff", "group"]
edition = "2021"
rust-version = "1.66"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[lints]
workspace = true
[dependencies]
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["derive"] }
sha2 = { version = "0.10", default-features = false }
elliptic-curve = { version = "0.13", default-features = false, features = ["hash2curve"] }
p256 = { version = "^0.13.1", default-features = false, features = ["arithmetic", "bits", "hash2curve"] }
k256 = { version = "^0.13.1", default-features = false, features = ["arithmetic", "bits", "hash2curve"] }
ciphersuite = { path = "../", version = "0.4", default-features = false }
[dev-dependencies]
hex = { version = "0.4", default-features = false, features = ["std"] }
rand_core = { version = "0.6", default-features = false, features = ["std"] }
ff-group-tests = { version = "0.13", path = "../../ff-group-tests" }
[features]
alloc = ["ciphersuite/alloc"]
std = [
"rand_core/std",
"zeroize/std",
"sha2/std",
"elliptic-curve/std",
"p256/std",
"k256/std",
"ciphersuite/std",
]
default = ["std"]

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-2023 Luke Parker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,3 @@
# Ciphersuite {k, p}256
SECP256k1 and P-256 Ciphersuites around k256 and p256.

View File

@@ -1,16 +1,17 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
use zeroize::Zeroize; use zeroize::Zeroize;
use sha2::Sha256; use sha2::Sha256;
use group::ff::PrimeField;
use elliptic_curve::{ use elliptic_curve::{
generic_array::GenericArray, generic_array::GenericArray,
bigint::{NonZero, CheckedAdd, Encoding, U384}, bigint::{NonZero, CheckedAdd, Encoding, U384},
hash2curve::{Expander, ExpandMsg, ExpandMsgXmd}, hash2curve::{Expander, ExpandMsg, ExpandMsgXmd},
}; };
use crate::Ciphersuite; use ciphersuite::{group::ff::PrimeField, Ciphersuite};
macro_rules! kp_curve { macro_rules! kp_curve {
( (
@@ -107,12 +108,9 @@ fn test_oversize_dst<C: Ciphersuite>() {
/// Ciphersuite for Secp256k1. /// Ciphersuite for Secp256k1.
/// ///
/// hash_to_F is implemented via the IETF draft for hash to curve's hash_to_field (v16). /// hash_to_F is implemented via the IETF draft for hash to curve's hash_to_field (v16).
#[cfg(feature = "secp256k1")]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
pub struct Secp256k1; pub struct Secp256k1;
#[cfg(feature = "secp256k1")]
kp_curve!("secp256k1", k256, Secp256k1, b"secp256k1"); kp_curve!("secp256k1", k256, Secp256k1, b"secp256k1");
#[cfg(feature = "secp256k1")]
#[test] #[test]
fn test_secp256k1() { fn test_secp256k1() {
ff_group_tests::group::test_prime_group_bits::<_, k256::ProjectivePoint>(&mut rand_core::OsRng); ff_group_tests::group::test_prime_group_bits::<_, k256::ProjectivePoint>(&mut rand_core::OsRng);
@@ -145,12 +143,9 @@ fn test_secp256k1() {
/// Ciphersuite for P-256. /// Ciphersuite for P-256.
/// ///
/// hash_to_F is implemented via the IETF draft for hash to curve's hash_to_field (v16). /// hash_to_F is implemented via the IETF draft for hash to curve's hash_to_field (v16).
#[cfg(feature = "p256")]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
pub struct P256; pub struct P256;
#[cfg(feature = "p256")]
kp_curve!("p256", p256, P256, b"P-256"); kp_curve!("p256", p256, P256, b"P-256");
#[cfg(feature = "p256")]
#[test] #[test]
fn test_p256() { fn test_p256() {
ff_group_tests::group::test_prime_group_bits::<_, p256::ProjectivePoint>(&mut rand_core::OsRng); ff_group_tests::group::test_prime_group_bits::<_, p256::ProjectivePoint>(&mut rand_core::OsRng);

View File

@@ -2,7 +2,7 @@
Ciphersuites for elliptic curves premised on ff/group. Ciphersuites for elliptic curves premised on ff/group.
This library, except for the not recommended Ed448 ciphersuite, was This library was
[audited by Cypher Stack in March 2023](https://github.com/serai-dex/serai/raw/e1bb2c191b7123fd260d008e31656d090d559d21/audits/Cypher%20Stack%20crypto%20March%202023/Audit.pdf), [audited by Cypher Stack in March 2023](https://github.com/serai-dex/serai/raw/e1bb2c191b7123fd260d008e31656d090d559d21/audits/Cypher%20Stack%20crypto%20March%202023/Audit.pdf),
culminating in commit culminating in commit
[669d2dbffc1dafb82a09d9419ea182667115df06](https://github.com/serai-dex/serai/tree/669d2dbffc1dafb82a09d9419ea182667115df06). [669d2dbffc1dafb82a09d9419ea182667115df06](https://github.com/serai-dex/serai/tree/669d2dbffc1dafb82a09d9419ea182667115df06).

View File

@@ -26,25 +26,6 @@ use group::{
#[cfg(any(feature = "alloc", feature = "std"))] #[cfg(any(feature = "alloc", feature = "std"))]
use group::GroupEncoding; use group::GroupEncoding;
#[cfg(feature = "dalek")]
mod dalek;
#[cfg(feature = "ristretto")]
pub use dalek::Ristretto;
#[cfg(feature = "ed25519")]
pub use dalek::Ed25519;
#[cfg(feature = "kp256")]
mod kp256;
#[cfg(feature = "secp256k1")]
pub use kp256::Secp256k1;
#[cfg(feature = "p256")]
pub use kp256::P256;
#[cfg(feature = "ed448")]
mod ed448;
#[cfg(feature = "ed448")]
pub use ed448::*;
/// Unified trait defining a ciphersuite around an elliptic curve. /// Unified trait defining a ciphersuite around an elliptic curve.
pub trait Ciphersuite: pub trait Ciphersuite:
'static + Send + Sync + Clone + Copy + PartialEq + Eq + Debug + Zeroize 'static + Send + Sync + Clone + Copy + PartialEq + Eq + Debug + Zeroize

View File

@@ -25,18 +25,22 @@ subtle = { version = "^2.4", default-features = false }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
digest = { version = "0.10", default-features = false } digest = { version = "0.10", default-features = false }
sha2 = { version = "0.10", default-features = false }
ff = { version = "0.13", default-features = false, features = ["bits"] } ff = { version = "0.13", default-features = false, features = ["bits"] }
group = { version = "0.13", default-features = false } group = { version = "0.13", default-features = false }
ciphersuite = { path = "../ciphersuite", default-features = false }
crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] } crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] }
curve25519-dalek = { version = ">= 4.0, < 4.2", default-features = false, features = ["alloc", "zeroize", "digest", "group", "precomputed-tables"] } curve25519-dalek = { version = ">= 4.0, < 4.2", default-features = false, features = ["alloc", "zeroize", "digest", "group", "precomputed-tables"] }
[dev-dependencies] [dev-dependencies]
hex = "0.4"
rand_core = { version = "0.6", default-features = false, features = ["std"] } rand_core = { version = "0.6", default-features = false, features = ["std"] }
ff-group-tests = { path = "../ff-group-tests" } ff-group-tests = { path = "../ff-group-tests" }
[features] [features]
std = ["zeroize/std", "subtle/std", "rand_core/std", "digest/std"] alloc = ["zeroize/alloc", "ciphersuite/alloc"]
std = ["alloc", "zeroize/std", "subtle/std", "rand_core/std", "digest/std", "sha2/std", "ciphersuite/std"]
default = ["std"] default = ["std"]

View File

@@ -3,9 +3,9 @@ use zeroize::Zeroize;
use sha2::{Digest, Sha512}; use sha2::{Digest, Sha512};
use group::Group; use group::Group;
use dalek_ff_group::Scalar; use crate::Scalar;
use crate::Ciphersuite; use ciphersuite::Ciphersuite;
macro_rules! dalek_curve { macro_rules! dalek_curve {
( (
@@ -15,7 +15,7 @@ macro_rules! dalek_curve {
$Point: ident, $Point: ident,
$ID: literal $ID: literal
) => { ) => {
use dalek_ff_group::$Point; use crate::$Point;
impl Ciphersuite for $Ciphersuite { impl Ciphersuite for $Ciphersuite {
type F = Scalar; type F = Scalar;
@@ -40,12 +40,9 @@ macro_rules! dalek_curve {
/// hash_to_F is implemented with a naive concatenation of the dst and data, allowing transposition /// hash_to_F is implemented with a naive concatenation of the dst and data, allowing transposition
/// between the two. This means `dst: b"abc", data: b"def"`, will produce the same scalar as /// between the two. This means `dst: b"abc", data: b"def"`, will produce the same scalar as
/// `dst: "abcdef", data: b""`. Please use carefully, not letting dsts be substrings of each other. /// `dst: "abcdef", data: b""`. Please use carefully, not letting dsts be substrings of each other.
#[cfg(any(test, feature = "ristretto"))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
pub struct Ristretto; pub struct Ristretto;
#[cfg(any(test, feature = "ristretto"))]
dalek_curve!("ristretto", Ristretto, RistrettoPoint, b"ristretto"); dalek_curve!("ristretto", Ristretto, RistrettoPoint, b"ristretto");
#[cfg(any(test, feature = "ristretto"))]
#[test] #[test]
fn test_ristretto() { fn test_ristretto() {
ff_group_tests::group::test_prime_group_bits::<_, RistrettoPoint>(&mut rand_core::OsRng); ff_group_tests::group::test_prime_group_bits::<_, RistrettoPoint>(&mut rand_core::OsRng);
@@ -71,12 +68,9 @@ fn test_ristretto() {
/// hash_to_F is implemented with a naive concatenation of the dst and data, allowing transposition /// hash_to_F is implemented with a naive concatenation of the dst and data, allowing transposition
/// between the two. This means `dst: b"abc", data: b"def"`, will produce the same scalar as /// between the two. This means `dst: b"abc", data: b"def"`, will produce the same scalar as
/// `dst: "abcdef", data: b""`. Please use carefully, not letting dsts be substrings of each other. /// `dst: "abcdef", data: b""`. Please use carefully, not letting dsts be substrings of each other.
#[cfg(feature = "ed25519")]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
pub struct Ed25519; pub struct Ed25519;
#[cfg(feature = "ed25519")]
dalek_curve!("ed25519", Ed25519, EdwardsPoint, b"edwards25519"); dalek_curve!("ed25519", Ed25519, EdwardsPoint, b"edwards25519");
#[cfg(feature = "ed25519")]
#[test] #[test]
fn test_ed25519() { fn test_ed25519() {
ff_group_tests::group::test_prime_group_bits::<_, EdwardsPoint>(&mut rand_core::OsRng); ff_group_tests::group::test_prime_group_bits::<_, EdwardsPoint>(&mut rand_core::OsRng);

View File

@@ -38,6 +38,9 @@ use group::{
mod field; mod field;
pub use field::FieldElement; pub use field::FieldElement;
mod ciphersuite;
pub use crate::ciphersuite::{Ed25519, Ristretto};
// Use black_box when possible // Use black_box when possible
#[rustversion::since(1.66)] #[rustversion::since(1.66)]
mod black_box { mod black_box {

View File

@@ -27,9 +27,6 @@ borsh = { version = "1", default-features = false, features = ["derive", "de_str
ciphersuite = { path = "../ciphersuite", version = "^0.4.1", default-features = false, features = ["alloc"] } ciphersuite = { path = "../ciphersuite", version = "^0.4.1", default-features = false, features = ["alloc"] }
[dev-dependencies]
ciphersuite = { path = "../ciphersuite", default-features = false, features = ["ristretto"] }
[features] [features]
std = [ std = [
"thiserror/std", "thiserror/std",

View File

@@ -31,7 +31,7 @@ dkg = { path = "../", version = "0.6", default-features = false }
[dev-dependencies] [dev-dependencies]
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
ciphersuite = { path = "../../ciphersuite", default-features = false, features = ["ristretto"] } dalek-ff-group = { path = "../../dalek-ff-group" }
dkg-recovery = { path = "../recovery", default-features = false, features = ["std"] } dkg-recovery = { path = "../recovery", default-features = false, features = ["std"] }
[features] [features]

View File

@@ -3,7 +3,8 @@ use std::collections::HashMap;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::OsRng; use rand_core::OsRng;
use ciphersuite::{group::ff::Field, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::Field, Ciphersuite};
use dkg_recovery::recover_key; use dkg_recovery::recover_key;
use crate::*; use crate::*;

View File

@@ -34,4 +34,4 @@ dkg = { path = "../", version = "0.6", default-features = false, features = ["st
[dev-dependencies] [dev-dependencies]
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
ciphersuite = { path = "../../ciphersuite", default-features = false, features = ["ristretto"] } dalek-ff-group = { path = "../../dalek-ff-group", default-features = false }

View File

@@ -2,7 +2,8 @@ use std::collections::HashMap;
use rand_core::{RngCore, CryptoRng, OsRng}; use rand_core::{RngCore, CryptoRng, OsRng};
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use crate::*; use crate::*;

View File

@@ -30,5 +30,5 @@ dkg = { path = "../", version = "0.6.1", default-features = false, features = ["
[dev-dependencies] [dev-dependencies]
zeroize = { version = "^1.5", default-features = false, features = ["std", "zeroize_derive"] } zeroize = { version = "^1.5", default-features = false, features = ["std", "zeroize_derive"] }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
ciphersuite = { path = "../../ciphersuite", default-features = false, features = ["ristretto"] } dalek-ff-group = { path = "../../dalek-ff-group" }
dkg-recovery = { path = "../recovery", default-features = false, features = ["std"] } dkg-recovery = { path = "../recovery", default-features = false, features = ["std"] }

View File

@@ -4,9 +4,10 @@ use std::collections::HashMap;
use zeroize::{Zeroize, Zeroizing}; use zeroize::{Zeroize, Zeroizing};
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, Group}, group::{ff::Field, Group},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use dkg::*; use dkg::*;

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "minimal-ed448" name = "minimal-ed448"
version = "0.4.1" version = "0.4.2"
description = "Unaudited, inefficient implementation of Ed448 in Rust" description = "Unaudited, inefficient implementation of Ed448 in Rust"
license = "MIT" license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448"
@@ -24,8 +24,11 @@ rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
subtle = { version = "^2.4", default-features = false } subtle = { version = "^2.4", default-features = false }
sha3 = { version = "0.10", default-features = false }
ff = { version = "0.13", default-features = false, features = ["bits"] } ff = { version = "0.13", default-features = false, features = ["bits"] }
group = { version = "0.13", default-features = false } group = { version = "0.13", default-features = false }
ciphersuite = { path = "../ciphersuite", default-features = false }
generic-array = { version = "1", default-features = false } generic-array = { version = "1", default-features = false }
crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] } crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] }
@@ -38,5 +41,6 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
ff-group-tests = { path = "../ff-group-tests" } ff-group-tests = { path = "../ff-group-tests" }
[features] [features]
std = ["rand_core/std", "zeroize/std", "subtle/std", "ff/std"] alloc = ["zeroize/alloc", "ciphersuite/alloc"]
std = ["alloc", "rand_core/std", "zeroize/std", "subtle/std", "sha3/std", "ff/std", "ciphersuite/std"]
default = ["std"] default = ["std"]

View File

@@ -1,15 +1,17 @@
use zeroize::Zeroize; use zeroize::Zeroize;
use digest::{ use sha3::{
digest::{
typenum::U114, core_api::BlockSizeUser, Update, Output, OutputSizeUser, FixedOutput, typenum::U114, core_api::BlockSizeUser, Update, Output, OutputSizeUser, FixedOutput,
ExtendableOutput, XofReader, HashMarker, Digest, ExtendableOutput, XofReader, HashMarker, Digest,
},
Shake256,
}; };
use sha3::Shake256;
use group::Group; use group::Group;
use minimal_ed448::{Scalar, Point}; use crate::{Scalar, Point};
use crate::Ciphersuite; use ciphersuite::Ciphersuite;
/// Shake256, fixed to a 114-byte output, as used by Ed448. /// Shake256, fixed to a 114-byte output, as used by Ed448.
#[derive(Clone, Default)] #[derive(Clone, Default)]

View File

@@ -14,3 +14,6 @@ pub use field::FieldElement;
mod point; mod point;
pub use point::Point; pub use point::Point;
mod ciphersuite;
pub use crate::ciphersuite::Ed448;

View File

@@ -50,13 +50,25 @@ fn recover_x(y: FieldElement) -> CtOption<FieldElement> {
} }
/// Ed448 point. /// Ed448 point.
#[derive(Clone, Copy, Debug, Zeroize)] #[derive(Clone, Copy, Debug)]
pub struct Point { pub struct Point {
x: FieldElement, x: FieldElement,
y: FieldElement, y: FieldElement,
z: FieldElement, z: FieldElement,
} }
impl Zeroize for Point {
fn zeroize(&mut self) {
self.x.zeroize();
self.y.zeroize();
self.z.zeroize();
let identity = Self::identity();
self.x = identity.x;
self.y = identity.y;
self.z = identity.z;
}
}
const G: Point = Point { x: G_X, y: G_Y, z: FieldElement::ONE }; const G: Point = Point { x: G_X, y: G_Y, z: FieldElement::ONE };
impl ConstantTimeEq for Point { impl ConstantTimeEq for Point {

View File

@@ -34,6 +34,7 @@ dalek-ff-group = { path = "../dalek-ff-group", version = "0.4", default-features
minimal-ed448 = { path = "../ed448", version = "0.4", default-features = false, features = ["std"], optional = true } minimal-ed448 = { path = "../ed448", version = "0.4", default-features = false, features = ["std"], optional = true }
ciphersuite = { path = "../ciphersuite", version = "^0.4.1", default-features = false, features = ["std"] } ciphersuite = { path = "../ciphersuite", version = "^0.4.1", default-features = false, features = ["std"] }
ciphersuite-kp256 = { path = "../ciphersuite/kp256", version = "0.4", default-features = false, features = ["std"], optional = true }
multiexp = { path = "../multiexp", version = "0.4", default-features = false, features = ["std", "batch"] } multiexp = { path = "../multiexp", version = "0.4", default-features = false, features = ["std", "batch"] }
@@ -52,12 +53,12 @@ dkg-recovery = { path = "../dkg/recovery", default-features = false, features =
dkg-dealer = { path = "../dkg/dealer", default-features = false, features = ["std"] } dkg-dealer = { path = "../dkg/dealer", default-features = false, features = ["std"] }
[features] [features]
ed25519 = ["dalek-ff-group", "ciphersuite/ed25519"] ed25519 = ["dalek-ff-group"]
ristretto = ["dalek-ff-group", "ciphersuite/ristretto"] ristretto = ["dalek-ff-group"]
secp256k1 = ["ciphersuite/secp256k1"] secp256k1 = ["ciphersuite-kp256"]
p256 = ["ciphersuite/p256"] p256 = ["ciphersuite-kp256"]
ed448 = ["minimal-ed448", "ciphersuite/ed448"] ed448 = ["minimal-ed448"]
tests = ["hex", "rand_core/getrandom", "dkg-dealer" ,"dkg-recovery"] tests = ["hex", "rand_core/getrandom", "dkg-dealer", "dkg-recovery"]

View File

@@ -16,7 +16,7 @@ macro_rules! dalek_curve {
$CONTEXT: literal, $CONTEXT: literal,
$chal: literal $chal: literal
) => { ) => {
pub use ciphersuite::$Curve; pub use dalek_ff_group::$Curve;
impl Curve for $Curve { impl Curve for $Curve {
const CONTEXT: &'static [u8] = $CONTEXT; const CONTEXT: &'static [u8] = $CONTEXT;

View File

@@ -1,7 +1,8 @@
use digest::Digest; use digest::Digest;
use minimal_ed448::{Scalar, Point}; use minimal_ed448::{Scalar, Point};
pub use ciphersuite::{group::GroupEncoding, Shake256_114, Ed448}; pub use minimal_ed448::Ed448;
pub use ciphersuite::{group::GroupEncoding, Ciphersuite};
use crate::{curve::Curve, algorithm::Hram}; use crate::{curve::Curve, algorithm::Hram};
@@ -18,7 +19,7 @@ impl Ietf8032Ed448Hram {
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub(crate) fn hram(context: &[u8], R: &Point, A: &Point, m: &[u8]) -> Scalar { pub(crate) fn hram(context: &[u8], R: &Point, A: &Point, m: &[u8]) -> Scalar {
Scalar::wide_reduce( Scalar::wide_reduce(
Shake256_114::digest( <Ed448 as Ciphersuite>::H::digest(
[ [
&[b"SigEd448".as_ref(), &[0, u8::try_from(context.len()).unwrap()]].concat(), &[b"SigEd448".as_ref(), &[0, u8::try_from(context.len()).unwrap()]].concat(),
context, context,

View File

@@ -11,7 +11,7 @@ macro_rules! kp_curve {
$CONTEXT: literal $CONTEXT: literal
) => { ) => {
pub use ciphersuite::$Curve; pub use ciphersuite_kp256::$Curve;
impl Curve for $Curve { impl Curve for $Curve {
const CONTEXT: &'static [u8] = $CONTEXT; const CONTEXT: &'static [u8] = $CONTEXT;

View File

@@ -36,7 +36,7 @@ rand_core = { version = "0.6", features = ["std"] }
sha2 = "0.10" sha2 = "0.10"
dalek-ff-group = { path = "../dalek-ff-group" } dalek-ff-group = { path = "../dalek-ff-group" }
ciphersuite = { path = "../ciphersuite", features = ["ed25519"] } ciphersuite = { path = "../ciphersuite" }
[features] [features]
aggregate = ["transcript"] aggregate = ["transcript"]

View File

@@ -3,9 +3,10 @@ use core::ops::Deref;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ed25519;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, Group}, group::{ff::Field, Group},
Ciphersuite, Ed25519, Ciphersuite,
}; };
use multiexp::BatchVerifier; use multiexp::BatchVerifier;

View File

@@ -5,8 +5,8 @@
use sha2::{Digest, Sha512}; use sha2::{Digest, Sha512};
use dalek_ff_group::Scalar; use dalek_ff_group::{Scalar, Ed25519};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ed25519}; use ciphersuite::{group::GroupEncoding, Ciphersuite};
use crate::SchnorrSignature; use crate::SchnorrSignature;

View File

@@ -24,7 +24,8 @@ transcript = { package = "flexible-transcript", path = "../transcript", version
group = "0.13" group = "0.13"
ciphersuite = { path = "../ciphersuite", version = "^0.4.1", features = ["std", "ristretto"] } dalek-ff-group = { path = "../dalek-ff-group" }
ciphersuite = { path = "../ciphersuite", version = "^0.4.1", features = ["std"] }
schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "^0.5.1" } schnorr = { package = "schnorr-signatures", path = "../schnorr", version = "^0.5.1" }
frost = { path = "../frost", package = "modular-frost", version = "^0.10.0", features = ["ristretto"] } frost = { path = "../frost", package = "modular-frost", version = "^0.10.0", features = ["ristretto"] }

View File

@@ -9,8 +9,11 @@ use zeroize::Zeroizing;
use transcript::{Transcript, MerlinTranscript}; use transcript::{Transcript, MerlinTranscript};
use group::{ff::PrimeField, GroupEncoding}; use dalek_ff_group::Ristretto;
use ciphersuite::{Ciphersuite, Ristretto}; use ciphersuite::{
group::{ff::PrimeField, GroupEncoding},
Ciphersuite,
};
use schnorr::SchnorrSignature; use schnorr::SchnorrSignature;
use ::frost::{ use ::frost::{

View File

@@ -30,7 +30,8 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
# Cryptography # Cryptography
transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std", "ristretto"] } dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
schnorr-signatures = { path = "../crypto/schnorr", default-features = false, features = ["std"] } schnorr-signatures = { path = "../crypto/schnorr", default-features = false, features = ["std"] }
# Application # Application

View File

@@ -3,9 +3,10 @@ use core::ops::Deref;
use zeroize::{Zeroize, Zeroizing}; use zeroize::{Zeroize, Zeroizing};
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::ff::{Field, PrimeField}, group::ff::{Field, PrimeField},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use schnorr_signatures::SchnorrSignature; use schnorr_signatures::SchnorrSignature;

View File

@@ -3,7 +3,8 @@ pub(crate) use std::{
collections::HashMap, collections::HashMap,
}; };
pub(crate) use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
pub(crate) use ciphersuite::{group::GroupEncoding, Ciphersuite};
pub(crate) use schnorr_signatures::SchnorrSignature; pub(crate) use schnorr_signatures::SchnorrSignature;
pub(crate) use serai_primitives::ExternalNetworkId; pub(crate) use serai_primitives::ExternalNetworkId;

View File

@@ -1,5 +1,6 @@
use transcript::{Transcript, RecommendedTranscript}; use transcript::{Transcript, RecommendedTranscript};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use borsh::{BorshSerialize, BorshDeserialize}; use borsh::{BorshSerialize, BorshDeserialize};

View File

@@ -23,7 +23,8 @@ rand_core = { version = "0.6", default-features = false, features = ["std", "get
rand_chacha = { version = "0.3", default-features = false, features = ["std"] } rand_chacha = { version = "0.3", default-features = false, features = ["std"] }
transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std", "recommended"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std", "ristretto"] } dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
zalloc = { path = "../common/zalloc" } zalloc = { path = "../common/zalloc" }

View File

@@ -2,7 +2,8 @@ use std::path::Path;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{group::ff::PrimeField, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::PrimeField, Ciphersuite};
use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile}; use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile};

View File

@@ -18,12 +18,13 @@ use rand_chacha::ChaCha20Rng;
use transcript::{Transcript, RecommendedTranscript}; use transcript::{Transcript, RecommendedTranscript};
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ group::{
ff::{Field, PrimeField}, ff::{Field, PrimeField},
GroupEncoding, GroupEncoding,
}, },
Ciphersuite, Ristretto, Ciphersuite,
}; };
mod mimalloc; mod mimalloc;

View File

@@ -1,6 +1,7 @@
use std::path::Path; use std::path::Path;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile}; use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile};

View File

@@ -2,7 +2,8 @@ use std::path::Path;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{group::ff::PrimeField, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::PrimeField, Ciphersuite};
use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile}; use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile};

View File

@@ -1,7 +1,8 @@
use std::path::Path; use std::path::Path;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{group::ff::PrimeField, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::ff::PrimeField, Ciphersuite};
use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile}; use crate::{Network, Os, mimalloc, os, build_serai_service, write_dockerfile};

View File

@@ -35,7 +35,8 @@ serde_json = { version = "1", default-features = false, features = ["std"] }
# Cryptography # Cryptography
blake2 = { version = "0.10", default-features = false, features = ["std"] } blake2 = { version = "0.10", default-features = false, features = ["std"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std", "ristretto"] } dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std"] } transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std"] }
dkg-pedpop = { path = "../crypto/dkg/pedpop", default-features = false } dkg-pedpop = { path = "../crypto/dkg/pedpop", default-features = false }
@@ -50,10 +51,10 @@ secp256k1 = { version = "0.29", default-features = false, features = ["std", "gl
bitcoin-serai = { path = "../networks/bitcoin", default-features = false, features = ["std"], optional = true } bitcoin-serai = { path = "../networks/bitcoin", default-features = false, features = ["std"], optional = true }
# Ethereum # Ethereum
ciphersuite-kp256 = { path = "../crypto/ciphersuite/kp256", default-features = false, features = ["std"], optional = true }
ethereum-serai = { path = "../networks/ethereum", default-features = false, optional = true } ethereum-serai = { path = "../networks/ethereum", default-features = false, optional = true }
# Monero # Monero
dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"], optional = true }
monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", default-features = false, optional = true } monero-simple-request-rpc = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", default-features = false, optional = true }
monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", default-features = false, features = ["std", "multisig", "compile-time-generators"], optional = true } monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", default-features = false, features = ["std", "multisig", "compile-time-generators"], optional = true }
@@ -86,9 +87,9 @@ serai-docker-tests = { path = "../tests/docker" }
secp256k1 = ["k256", "frost/secp256k1"] secp256k1 = ["k256", "frost/secp256k1"]
bitcoin = ["dep:secp256k1", "secp256k1", "bitcoin-serai", "serai-client/bitcoin"] bitcoin = ["dep:secp256k1", "secp256k1", "bitcoin-serai", "serai-client/bitcoin"]
ethereum = ["secp256k1", "ethereum-serai/tests"] ethereum = ["secp256k1", "ciphersuite-kp256", "ethereum-serai/tests"]
ed25519 = ["dalek-ff-group", "frost/ed25519"] ed25519 = ["frost/ed25519"]
monero = ["ed25519", "monero-simple-request-rpc", "monero-wallet", "serai-client/monero"] monero = ["ed25519", "monero-simple-request-rpc", "monero-wallet", "serai-client/monero"]
binaries = ["env_logger", "serai-env", "message-queue"] binaries = ["env_logger", "serai-env", "message-queue"]

View File

@@ -7,7 +7,8 @@ use std::{
use async_trait::async_trait; use async_trait::async_trait;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1}; use ciphersuite::{group::GroupEncoding, Ciphersuite};
use ciphersuite_kp256::Secp256k1;
use frost::ThresholdKeys; use frost::ThresholdKeys;
use ethereum_serai::{ use ethereum_serai::{

View File

@@ -286,7 +286,8 @@ mod monero {
mod ethereum { mod ethereum {
use super::*; use super::*;
use ciphersuite::{Ciphersuite, Secp256k1}; use ciphersuite::Ciphersuite;
use ciphersuite_kp256::Secp256k1;
use serai_client::validator_sets::primitives::Session; use serai_client::validator_sets::primitives::Session;

View File

@@ -38,6 +38,7 @@ simple-request = { path = "../../common/request", version = "0.1", optional = tr
bitcoin = { version = "0.32", optional = true } bitcoin = { version = "0.32", optional = true }
dalek-ff-group = { path = "../../crypto/dalek-ff-group", optional = true }
ciphersuite = { path = "../../crypto/ciphersuite", version = "0.4", optional = true } ciphersuite = { path = "../../crypto/ciphersuite", version = "0.4", optional = true }
monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", version = "0.1.0", default-features = false, features = ["std"], optional = true } monero-wallet = { git = "https://github.com/monero-oxide/monero-oxide", rev = "a74f41c2270707e340a9cb57fcd97a762d04975b", version = "0.1.0", default-features = false, features = ["std"], optional = true }
@@ -47,7 +48,8 @@ hex = "0.4"
blake2 = "0.10" blake2 = "0.10"
ciphersuite = { path = "../../crypto/ciphersuite", features = ["ristretto"] } dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
ciphersuite = { path = "../../crypto/ciphersuite" }
dkg-musig = { path = "../../crypto/dkg/musig" } dkg-musig = { path = "../../crypto/dkg/musig" }
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["tests"] } frost = { package = "modular-frost", path = "../../crypto/frost", features = ["tests"] }
schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" } schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" }
@@ -63,7 +65,7 @@ borsh = ["serai-abi/borsh"]
networks = [] networks = []
bitcoin = ["networks", "dep:bitcoin"] bitcoin = ["networks", "dep:bitcoin"]
monero = ["networks", "ciphersuite/ed25519", "monero-wallet"] monero = ["networks", "dalek-ff-group", "ciphersuite", "monero-wallet"]
# Assumes the default usage is to use Serai as a DEX, which doesn't actually # Assumes the default usage is to use Serai as a DEX, which doesn't actually
# require connecting to a Serai node # require connecting to a Serai node

View File

@@ -2,7 +2,8 @@ use core::{str::FromStr, fmt};
use scale::{Encode, Decode}; use scale::{Encode, Decode};
use ciphersuite::{Ciphersuite, Ed25519}; use dalek_ff_group::Ed25519;
use ciphersuite::Ciphersuite;
use monero_wallet::address::{AddressError, Network, AddressType, MoneroAddress}; use monero_wallet::address::{AddressError, Network, AddressType, MoneroAddress};

View File

@@ -3,7 +3,8 @@ use std::collections::HashMap;
use rand_core::{RngCore, OsRng}; use rand_core::{RngCore, OsRng};
use zeroize::Zeroizing; use zeroize::Zeroizing;
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use dkg_musig::musig; use dkg_musig::musig;
use schnorrkel::Schnorrkel; use schnorrkel::Schnorrkel;

View File

@@ -9,7 +9,8 @@ use sp_core::{
Pair as PairTrait, Pair as PairTrait,
}; };
use ciphersuite::{Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::Ciphersuite;
use dkg_musig::musig; use dkg_musig::musig;
use schnorrkel::Schnorrkel; use schnorrkel::Schnorrkel;

View File

@@ -18,7 +18,8 @@ workspace = true
[dependencies] [dependencies]
zeroize = { version = "^1.5", features = ["derive"], optional = true } zeroize = { version = "^1.5", features = ["derive"], optional = true }
ciphersuite = { path = "../../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["alloc", "ristretto"] } dalek-ff-group = { path = "../../../crypto/dalek-ff-group", default-features = false, features = ["alloc"] }
ciphersuite = { path = "../../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["alloc"] }
dkg-musig = { path = "../../../crypto/dkg/musig", default-features = false } dkg-musig = { path = "../../../crypto/dkg/musig", default-features = false }
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"], optional = true } borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"], optional = true }

View File

@@ -3,7 +3,8 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
use zeroize::Zeroize; use zeroize::Zeroize;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use dalek_ff_group::Ristretto;
use ciphersuite::{group::GroupEncoding, Ciphersuite};
use scale::{Encode, Decode, MaxEncodedLen}; use scale::{Encode, Decode, MaxEncodedLen};
use scale_info::TypeInfo; use scale_info::TypeInfo;

View File

@@ -24,7 +24,9 @@ zeroize = { version = "1", default-features = false }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
blake2 = "0.10" 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" schnorrkel = "0.11"
dkg = { path = "../../crypto/dkg", default-features = false } dkg = { path = "../../crypto/dkg", default-features = false }

View File

@@ -14,9 +14,10 @@ use rand_core::{RngCore, OsRng};
use zeroize::Zeroizing; use zeroize::Zeroizing;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::PrimeField, GroupEncoding}, group::{ff::PrimeField, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use serai_client::primitives::ExternalNetworkId; use serai_client::primitives::ExternalNetworkId;

View File

@@ -10,7 +10,10 @@ use blake2::{
digest::{consts::U32, Digest}, digest::{consts::U32, Digest},
Blake2b, 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 dkg::Participant;
use scale::Encode; use scale::Encode;

View File

@@ -6,10 +6,12 @@ use std::{
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, GroupEncoding}, group::{ff::Field, GroupEncoding},
Ciphersuite, Ristretto, Secp256k1, Ciphersuite,
}; };
use ciphersuite_kp256::Secp256k1;
use dkg::ThresholdParams; use dkg::ThresholdParams;
use serai_client::{ use serai_client::{

View File

@@ -1,6 +1,6 @@
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use ciphersuite::Secp256k1; use ciphersuite_kp256::Secp256k1;
use serai_client::{ use serai_client::{
primitives::{insecure_pair_from_name, NetworkId}, primitives::{insecure_pair_from_name, NetworkId},

View File

@@ -5,7 +5,7 @@ use std::{
use rand_core::{RngCore, OsRng}; use rand_core::{RngCore, OsRng};
use ciphersuite::Secp256k1; use ciphersuite_kp256::Secp256k1;
use dkg::Participant; use dkg::Participant;

View File

@@ -22,7 +22,8 @@ hex = "0.4"
zeroize = { version = "1", default-features = false } zeroize = { version = "1", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } 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-primitives = { path = "../../substrate/primitives" }
serai-message-queue = { path = "../../message-queue" } serai-message-queue = { path = "../../message-queue" }

View File

@@ -2,9 +2,10 @@ use std::collections::HashMap;
use rand_core::OsRng; use rand_core::OsRng;
use dalek_ff_group::Ristretto;
use ciphersuite::{ use ciphersuite::{
group::{ff::Field, GroupEncoding}, group::{ff::Field, GroupEncoding},
Ciphersuite, Ristretto, Ciphersuite,
}; };
use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS}; use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS};

View File

@@ -19,10 +19,11 @@ workspace = true
[dependencies] [dependencies]
flexible-transcript = { path = "../../crypto/transcript", default-features = false, features = ["recommended", "merlin"] } flexible-transcript = { path = "../../crypto/transcript", default-features = false, features = ["recommended", "merlin"] }
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false } dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["alloc"] }
minimal-ed448 = { path = "../../crypto/ed448", default-features = false } 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"] } multiexp = { path = "../../crypto/multiexp", default-features = false, features = ["batch"] }

View File

@@ -6,6 +6,7 @@ pub use dalek_ff_group;
pub use minimal_ed448; pub use minimal_ed448;
pub use ciphersuite; pub use ciphersuite;
pub use ciphersuite_kp256;
pub use multiexp; pub use multiexp;

View File

@@ -23,7 +23,9 @@ zeroize = { version = "1", default-features = false }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
curve25519-dalek = "4" 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 } dkg = { path = "../../crypto/dkg", default-features = false }
bitcoin-serai = { path = "../../networks/bitcoin" } bitcoin-serai = { path = "../../networks/bitcoin" }

View File

@@ -5,7 +5,8 @@ use std::sync::{OnceLock, Mutex};
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::{RngCore, OsRng}; 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 serai_client::primitives::ExternalNetworkId;
use messages::{ProcessorMessage, CoordinatorMessage}; use messages::{ProcessorMessage, CoordinatorMessage};

View File

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

View File

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