Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leontiadZen committed Jul 5, 2023
1 parent 2ba920c commit a6a62c3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions benches/multi_party_ecdsa/gg18/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mod bench {
.expect("invalid key");
vss_scheme_vec.push(vss_scheme);
secret_shares_vec.push(secret_shares);
index_vec.push(index as u16);
index_vec.push(index);
}
let vss_scheme_for_test = vss_scheme_vec.clone();

Expand All @@ -89,7 +89,7 @@ mod bench {
&y_vec,
&party_shares[i],
&vss_scheme_vec,
(&index_vec[i] + 1).into(),
(&index_vec[i] + 1),
)
.expect("invalid vss");
shared_keys_vec.push(shared_keys);
Expand Down
2 changes: 1 addition & 1 deletion examples/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn aes_encrypt(key: &[u8], plaintext: &[u8]) -> AEAD {
.expect("encryption failure!");

AEAD {
ciphertext: ciphertext,
ciphertext,
tag: nonce.to_vec(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/gg18_sign_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn main() {
if env::args().nth(3).is_none() {
panic!("too few arguments")
}
let message_str = env::args().nth(3).unwrap_or_else(|| "".to_string());
let message_str = env::args().nth(3).unwrap_or_default();
let message = match hex::decode(message_str.clone()) {
Ok(x) => x,
Err(_e) => message_str.as_bytes().to_vec(),
Expand Down Expand Up @@ -502,7 +502,7 @@ fn main() {
// check sig against secp256k1
check_sig(&sig.r, &sig.s, &message_bn, &y_sum);

fs::write("signature".to_string(), sign_json).expect("Unable to save !");
fs::write("signature", sign_json).expect("Unable to save !");
}

fn format_vec_from_reads<'a, T: serde::Deserialize<'a> + Clone>(
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/multi_party_ecdsa/gg_2018/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn keygen_t_n_parties(
for (vss_scheme, secret_shares, index) in vss_result {
vss_scheme_vec.push(vss_scheme);
secret_shares_vec.push(secret_shares); // cannot unzip
index_vec.push(index as u16);
index_vec.push(index);
}

let vss_scheme_for_test = vss_scheme_vec.clone();
Expand All @@ -122,7 +122,7 @@ fn keygen_t_n_parties(
&y_vec,
&party_shares[i],
&vss_scheme_vec,
(&index_vec[i] + 1).into(),
(&index_vec[i] + 1),
)
.expect("invalid vss");
shared_keys_vec.push(shared_keys);
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/multi_party_ecdsa/gg_2020/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl GlobalStatePhase6 {
.map(|i| {
let g_wi_ki = &self.g_w_vec[i] * &self.k_vec[i];
let sum = self.miu_vec[i].iter().fold(g_wi_ki, |acc, x| {
acc + (Point::generator() * &Scalar::<Secp256k1>::from(&*x))
acc + (Point::generator() * &Scalar::<Secp256k1>::from(x))
});
sum
})
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/multi_party_ecdsa/gg_2020/party_i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl Keys {
let mut global_coefficients = head[0].commitments.clone();
for vss in tail {
for (i, coefficient_commitment) in vss.commitments.iter().enumerate() {
global_coefficients[i] = &global_coefficients[i] + &*coefficient_commitment;
global_coefficients[i] = &global_coefficients[i] + coefficient_commitment;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl Round4 {
&self.bc_vec,
usize::from(self.i - 1),
)
.map_err(|e| Error::Round5(e))?;
.map_err(Error::Round5)?;

let R_dash = &R * &self.sign_keys.k_i;

Expand Down Expand Up @@ -554,7 +554,7 @@ impl Round5 {
&l_s,
i,
)
.map_err(|e| Error::Round5(e))?;
.map_err(Error::Round5)?;
}
LocalSignature::phase5_check_R_dash_sum(&r_dash_vec).map_err(|e| {
Error::Round5(ErrorType {
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/two_party_ecdsa/lindell_2017/party_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl Party1Private {
) {
let (ek_new, dk_new) = Paillier::keypair().keys();
let randomness = Randomness::sample(&ek_new);
let factor_fe = Scalar::<Secp256k1>::from(&*factor);
let factor_fe = Scalar::<Secp256k1>::from(factor);
let x1_new = &party_one_private.x1 * factor_fe;
let c_key_new = Paillier::encrypt_with_chosen_randomness(
&ek_new,
Expand Down Expand Up @@ -576,7 +576,7 @@ pub fn verify(
let e_fe: Scalar<Secp256k1> =
Scalar::<Secp256k1>::from(&message.mod_floor(Scalar::<Secp256k1>::group_order()));
let u1 = Point::generator() * e_fe * &s_inv_fe;
let u2 = &*pubkey * rx_fe * &s_inv_fe;
let u2 = pubkey * rx_fe * &s_inv_fe;

// second condition is against malleability
let rx_bytes = &BigInt::to_bytes(&signature.r)[..];
Expand Down
8 changes: 4 additions & 4 deletions src/utilities/mta/range_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ pub(crate) mod tests {

let (bob_proof, _) = BobProof::generate(
&encrypted_a,
&mta_out.0.clone().into_owned(),
&mta_out.0.clone(),
&b,
&beta_prim,
alice_public_key,
Expand All @@ -679,7 +679,7 @@ pub(crate) mod tests {
);
assert!(bob_proof.verify(
&encrypted_a,
&mta_out.0.clone().into_owned(),
&mta_out.0.clone(),
alice_public_key,
&dlog_statement,
None
Expand All @@ -690,7 +690,7 @@ pub(crate) mod tests {
let X = ec_gen * &b;
let bob_proof = generate(
&encrypted_a,
&mta_out.0.clone().into_owned(),
&mta_out.0.clone(),
&b,
&beta_prim,
alice_public_key,
Expand All @@ -699,7 +699,7 @@ pub(crate) mod tests {
);
assert!(bob_proof.verify(
&encrypted_a,
&mta_out.0.clone().into_owned(),
&mta_out.0.clone(),
alice_public_key,
&dlog_statement,
&X
Expand Down

0 comments on commit a6a62c3

Please sign in to comment.