From f7c153575b342663169fe8615ca827007aba626e Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 19 May 2021 21:43:02 +1000 Subject: [PATCH] Put variable-length fields last (#103) This helps prevent parsing issues in other implementations. --- src/frost.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frost.rs b/src/frost.rs index 75f98c2..7ffd9b3 100644 --- a/src/frost.rs +++ b/src/frost.rs @@ -100,15 +100,15 @@ pub struct GroupCommitment(jubjub::ExtendedPoint); /// To derive a FROST keypair, the receiver of the [`SharePackage`] *must* call /// .into(), which under the hood also performs validation. pub struct SharePackage { + /// The public signing key that represents the entire group. + pub(crate) group_public: VerificationKey, /// Denotes the participant index each share is owned by. We implicitly /// restrict the number of participants to 255. pub index: u8, - /// This participant's share. - pub(crate) share: Share, /// This participant's public key. pub(crate) public: Public, - /// The public signing key that represents the entire group. - pub(crate) group_public: VerificationKey, + /// This participant's share. + pub(crate) share: Share, } impl TryFrom for KeyPackage { @@ -379,11 +379,13 @@ impl From<(u8, &SigningNonces)> for SigningCommitments { /// Generated by the coordinator of the signing operation and distributed to /// each signing party. pub struct SigningPackage { - /// Message which each participant will sign - pub message: &'static [u8], /// The set of commitments participants published in the first round of the /// protocol. pub signing_commitments: Vec, + /// Message which each participant will sign. + /// + /// Each signer should perform protocol-specific verification on the message. + pub message: &'static [u8], } /// A participant's signature share, which the coordinator will use to aggregate