From 6481d0af91ac9f6a95972c1ec8fc16c443487df8 Mon Sep 17 00:00:00 2001 From: Marek Date: Thu, 18 Mar 2021 16:30:25 +0000 Subject: [PATCH] Add comments to the checks --- src/frost.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frost.rs b/src/frost.rs index e18143e..566b0bf 100644 --- a/src/frost.rs +++ b/src/frost.rs @@ -342,6 +342,8 @@ impl SigningNonces { } } + // The values of 'hiding' and 'biding' must be non-zero so that commitments are not the + // identity. let hiding = Scalar::from_bytes_wide(&random_nonzero_bytes(rng)); let binding = Scalar::from_bytes_wide(&random_nonzero_bytes(rng)); @@ -481,9 +483,11 @@ fn gen_group_commitment( let mut accumulator = identity; for commitment in signing_package.signing_commitments.iter() { - if identity == commitment.binding && identity == commitment.hiding { - return Err("Commitment equals the identity."); - } + // The following check prevents a party from accidentally revealing their share. + // Note that the '&&' operator would be sufficient. + if identity == commitment.binding || identity == commitment.hiding { + return Err("Commitment equals the identity."); + } let rho_i = bindings .get(&commitment.index)