Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a dedicated crate for the DKG #141

Merged
merged 25 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
387f5ef
Add dkg crate
kayabaNerve Oct 27, 2022
b089bc0
Remove F_len and G_len
kayabaNerve Oct 27, 2022
4c892d9
Replace hash_to_vec with a provided method around associated type H: …
kayabaNerve Oct 27, 2022
5543f80
Encrypt secret shares within the FROST library
kayabaNerve Oct 27, 2022
e451c85
Update usage of Zeroize within FROST
kayabaNerve Oct 27, 2022
c2d51c3
Inline functions in key_gen
kayabaNerve Oct 28, 2022
603d6b0
Add a ciphersuite package which provides hash_to_F
kayabaNerve Oct 29, 2022
2b4513c
Set the Ciphersuite version to something valid
kayabaNerve Oct 29, 2022
c632e3c
Have ed448 export Scalar/FieldElement/Point at the top level
kayabaNerve Oct 29, 2022
ee4fb41
Move FROST over to Ciphersuite
kayabaNerve Oct 29, 2022
bccea83
Correct usage of ff in ciphersuite
kayabaNerve Oct 29, 2022
4d47ec5
Correct documentation handling
kayabaNerve Oct 29, 2022
87d6690
Move Schnorr signatures to their own crate
kayabaNerve Oct 29, 2022
bb46bd0
Remove unused feature from schnorr
kayabaNerve Oct 29, 2022
66a5752
Fix Schnorr tests
kayabaNerve Oct 29, 2022
3462d01
Split DKG into a separate crate
kayabaNerve Oct 29, 2022
daa5f65
Add serialize to Commitments and SecretShare
kayabaNerve Oct 29, 2022
bf0828f
Move FROST over to the new dkg crate
kayabaNerve Oct 29, 2022
239657c
Update Monero lib to latest FROST
kayabaNerve Oct 29, 2022
2662ad4
Correct ethereum's usage of features
kayabaNerve Oct 29, 2022
4ae143a
Add serialize to GeneratorProof
kayabaNerve Oct 29, 2022
8420d9b
Add serialize helper function to FROST
kayabaNerve Oct 29, 2022
a778465
Rename AddendumSerialize to WriteAddendum
kayabaNerve Oct 29, 2022
9eb5df2
Update processor
kayabaNerve Oct 29, 2022
63ff6a6
Slight fix to processor
kayabaNerve Oct 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 104 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ members = [

"crypto/dalek-ff-group",
"crypto/ed448",
"crypto/ciphersuite",

"crypto/multiexp",

"crypto/schnorr",
"crypto/dleq",
"crypto/dkg",
"crypto/frost",

"coins/ethereum",
Expand Down
2 changes: 1 addition & 1 deletion coins/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sha3 = "0.10"

group = "0.12"
k256 = { version = "0.11", features = ["arithmetic", "keccak256", "ecdsa"] }
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["secp256k1"] }
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["secp256k1", "tests"] }

eyre = "0.6"

Expand Down
12 changes: 6 additions & 6 deletions coins/monero/src/ringct/clsag/multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use dalek_ff_group as dfg;
use dleq::DLEqProof;
use frost::{
curve::Ed25519,
FrostError, FrostView,
algorithm::{AddendumSerialize, Algorithm},
FrostError, ThresholdView,
algorithm::{WriteAddendum, Algorithm},
};

use crate::ringct::{
Expand Down Expand Up @@ -80,7 +80,7 @@ pub struct ClsagAddendum {
dleq: DLEqProof<dfg::EdwardsPoint>,
}

impl AddendumSerialize for ClsagAddendum {
impl WriteAddendum for ClsagAddendum {
fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
writer.write_all(self.key_image.compress().to_bytes().as_ref())?;
self.dleq.serialize(writer)
Expand Down Expand Up @@ -154,7 +154,7 @@ impl Algorithm<Ed25519> for ClsagMultisig {
fn preprocess_addendum<R: RngCore + CryptoRng>(
&mut self,
rng: &mut R,
view: &FrostView<Ed25519>,
view: &ThresholdView<Ed25519>,
) -> ClsagAddendum {
ClsagAddendum {
key_image: dfg::EdwardsPoint(self.H * view.secret_share().0),
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Algorithm<Ed25519> for ClsagMultisig {

fn process_addendum(
&mut self,
view: &FrostView<Ed25519>,
view: &ThresholdView<Ed25519>,
l: u16,
addendum: ClsagAddendum,
) -> Result<(), FrostError> {
Expand Down Expand Up @@ -223,7 +223,7 @@ impl Algorithm<Ed25519> for ClsagMultisig {

fn sign_share(
&mut self,
view: &FrostView<Ed25519>,
view: &ThresholdView<Ed25519>,
nonce_sums: &[Vec<dfg::EdwardsPoint>],
nonces: &[dfg::Scalar],
msg: &[u8],
Expand Down
4 changes: 2 additions & 2 deletions coins/monero/src/wallet/send/multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use curve25519_dalek::{traits::Identity, scalar::Scalar, edwards::EdwardsPoint};
use transcript::{Transcript, RecommendedTranscript};
use frost::{
curve::Ed25519,
FrostError, FrostKeys,
FrostError, ThresholdKeys,
sign::{
Writable, Preprocess, SignatureShare, PreprocessMachine, SignMachine, SignatureMachine,
AlgorithmMachine, AlgorithmSignMachine, AlgorithmSignatureMachine,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl SignableTransaction {
pub async fn multisig(
self,
rpc: &Rpc,
keys: FrostKeys<Ed25519>,
keys: ThresholdKeys<Ed25519>,
mut transcript: RecommendedTranscript,
height: usize,
mut included: Vec<u16>,
Expand Down
49 changes: 49 additions & 0 deletions crypto/ciphersuite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
name = "ciphersuite"
version = "0.1.1"
description = "Ciphersuites built around ff/group"
license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ciphersuite"
authors = ["Luke Parker <[email protected]>"]
keywords = ["ciphersuite", "ff", "group"]
edition = "2021"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
rand_core = "0.6"

zeroize = { version = "1.5", features = ["zeroize_derive"] }
subtle = "2"

digest = "0.10"
sha2 = { version = "0.10", optional = true }
sha3 = { version = "0.10", optional = true }

ff = { version = "0.12", features = ["bits"] }
group = "0.12"

dalek-ff-group = { path = "../dalek-ff-group", version = "^0.1.2", optional = true }

elliptic-curve = { version = "0.12", features = ["hash2curve"], optional = true }
p256 = { version = "0.11", features = ["arithmetic", "bits", "hash2curve"], optional = true }
k256 = { version = "0.11", features = ["arithmetic", "bits", "hash2curve"], optional = true }

minimal-ed448 = { path = "../ed448", version = "0.1", optional = true }

[features]
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"]
21 changes: 21 additions & 0 deletions crypto/ciphersuite/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-2022 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.
3 changes: 3 additions & 0 deletions crypto/ciphersuite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ciphersuite

Ciphersuites for elliptic curves premised on ff/group.
Loading