Skip to content

Commit 2b1505a

Browse files
committed
testing version of crate
1 parent be6e974 commit 2b1505a

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ reddsa = { path = "../reddsa", features = ["frost", "alloc"], default-features
1919
frost-core = { git = "https://github.com/ZcashFoundation/frost.git", rev = "c6c3f2f", package = "frost-core", features = ["serialization", "serde", "cheater-detection"], default-features = false }
2020
frost-rerandomized = { git = "https://github.com/ZcashFoundation/frost.git", rev = "c6c3f2f", package = "frost-rerandomized", features = ["serialization", "cheater-detection"], default-features = false }
2121
siphasher = { version = "1.0.0", default-features = false }
22-
x25519-dalek = { version = "2.0.0", features = ["reusable_secrets", "static_secrets"], default-features = false }
22+
x25519-dalek = { version = "2.0.0", features = ["reusable_secrets", "static_secrets", "getrandom"], default-features = false }
2323

2424
[dev-dependencies]
2525
hex-literal = "0.4.1"
2626
rand = "0.8.5"
2727

2828
[features]
29-
default = ["dkg"]
29+
default = ["dkg","signing"]
3030

3131
std = []
3232
signing = ["dep:blake3", "dep:rand_chacha", "std"]

src/dkg/round1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl PublicPackage {
200200
participants: &[I],
201201
frost_package: Package,
202202
group_secret_key_shard: GroupSecretKeyShard,
203-
csrng: R,
203+
mut csrng: R,
204204
) -> Self
205205
where
206206
I: Borrow<Identity>,
@@ -211,7 +211,7 @@ impl PublicPackage {
211211
let group_secret_key_shard_encrypted = multienc::encrypt(
212212
&group_secret_key_shard.serialize(),
213213
participants.iter().map(Borrow::borrow),
214-
csrng,
214+
&mut csrng,
215215
);
216216

217217
PublicPackage {

src/dkg/round3.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ extern crate alloc;
3232
#[cfg(not(feature = "std"))]
3333
use alloc::collections::BTreeMap;
3434
#[cfg(not(feature = "std"))]
35-
use alloc::string::ToString;
36-
#[cfg(not(feature = "std"))]
3735
use alloc::vec::Vec;
3836

3937
#[derive(Clone, Eq, PartialEq, Debug)]

src/participant.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ pub struct Secret {
7070
identity: OnceCell<Identity>,
7171
}
7272

73+
pub struct Secret2 {
74+
decryption_key: StaticSecret,
75+
identity: OnceCell<Identity>,
76+
}
77+
78+
impl Secret2 {
79+
#[must_use]
80+
pub fn random<T: RngCore + CryptoRng>(mut csprng: T) -> Self {
81+
Self {
82+
decryption_key: StaticSecret::random_from_rng(&mut csprng),
83+
identity: OnceCell::new(),
84+
}
85+
}
86+
}
87+
7388
impl Secret {
7489
#[must_use]
7590
pub fn random<T: RngCore + CryptoRng>(mut csprng: T) -> Self {
@@ -237,7 +252,7 @@ impl Identity {
237252
let mut verification_key = [0u8; VERIFICATION_KEY_LEN];
238253
reader.read_exact(&mut verification_key)?;
239254
let verification_key =
240-
VerifyingKey::from_bytes(&verification_key).map_err(io::Error::other)?;
255+
VerifyingKey::from_bytes(&verification_key).map_err(|_| io::Error::other("verification key from bytes failed"))?;
241256

242257
let mut encryption_key = [0u8; ENCRYPTION_KEY_LEN];
243258
reader.read_exact(&mut encryption_key)?;
@@ -247,7 +262,7 @@ impl Identity {
247262
reader.read_exact(&mut signature)?;
248263
let signature = Signature::from(signature);
249264

250-
Self::new(verification_key, encryption_key, signature).map_err(io::Error::other)
265+
Self::new(verification_key, encryption_key, signature).map_err(|_| io::Error::other("signature verification failed"))
251266
}
252267

253268
pub fn verify_data(&self, data: &[u8], signature: &Signature) -> Result<(), SignatureError> {

0 commit comments

Comments
 (0)