mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +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:
@@ -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 }
|
||||
|
||||
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"] }
|
||||
|
||||
@@ -52,12 +53,12 @@ dkg-recovery = { path = "../dkg/recovery", default-features = false, features =
|
||||
dkg-dealer = { path = "../dkg/dealer", default-features = false, features = ["std"] }
|
||||
|
||||
[features]
|
||||
ed25519 = ["dalek-ff-group", "ciphersuite/ed25519"]
|
||||
ristretto = ["dalek-ff-group", "ciphersuite/ristretto"]
|
||||
ed25519 = ["dalek-ff-group"]
|
||||
ristretto = ["dalek-ff-group"]
|
||||
|
||||
secp256k1 = ["ciphersuite/secp256k1"]
|
||||
p256 = ["ciphersuite/p256"]
|
||||
secp256k1 = ["ciphersuite-kp256"]
|
||||
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"]
|
||||
|
||||
@@ -16,7 +16,7 @@ macro_rules! dalek_curve {
|
||||
$CONTEXT: literal,
|
||||
$chal: literal
|
||||
) => {
|
||||
pub use ciphersuite::$Curve;
|
||||
pub use dalek_ff_group::$Curve;
|
||||
|
||||
impl Curve for $Curve {
|
||||
const CONTEXT: &'static [u8] = $CONTEXT;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use digest::Digest;
|
||||
|
||||
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};
|
||||
|
||||
@@ -18,7 +19,7 @@ impl Ietf8032Ed448Hram {
|
||||
#[allow(non_snake_case)]
|
||||
pub(crate) fn hram(context: &[u8], R: &Point, A: &Point, m: &[u8]) -> Scalar {
|
||||
Scalar::wide_reduce(
|
||||
Shake256_114::digest(
|
||||
<Ed448 as Ciphersuite>::H::digest(
|
||||
[
|
||||
&[b"SigEd448".as_ref(), &[0, u8::try_from(context.len()).unwrap()]].concat(),
|
||||
context,
|
||||
|
||||
@@ -11,7 +11,7 @@ macro_rules! kp_curve {
|
||||
|
||||
$CONTEXT: literal
|
||||
) => {
|
||||
pub use ciphersuite::$Curve;
|
||||
pub use ciphersuite_kp256::$Curve;
|
||||
|
||||
impl Curve for $Curve {
|
||||
const CONTEXT: &'static [u8] = $CONTEXT;
|
||||
|
||||
Reference in New Issue
Block a user