Skip to content

Commit

Permalink
fix chainkey for frost keygen
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricfung committed Feb 21, 2024
1 parent e8c0818 commit 34fc3a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions protocols/frost/keygen/keygen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func checkOutput(t *testing.T, group curve.Curve, rounds []round.Session, partie
actualPublicKey := privateKey.ActOnBase()

require.True(t, publicKey.Equal(actualPublicKey))
require.Len(t, chainKey, 32)

shares := make(map[party.ID]curve.Scalar)
for _, result := range results {
Expand Down
6 changes: 4 additions & 2 deletions protocols/frost/keygen/round3.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func (r *round3) StoreMessage(msg round.Message) error {

// Finalize implements round.Round.
func (r *round3) Finalize(chan<- *round.Message) (round.Session, error) {
ChainKey := types.EmptyRID()
chainKey := types.EmptyRID()
for _, j := range r.PartyIDs() {
ChainKey.XOR(r.ChainKeys[j])
chainKey.XOR(r.ChainKeys[j])
}

// These steps come from Figure 1, Round 2 of the Frost paper
Expand Down Expand Up @@ -163,6 +163,7 @@ func (r *round3) Finalize(chan<- *round.Message) (round.Session, error) {
Threshold: r.threshold,
PrivateShare: r.privateShare,
PublicKey: YSecp.XScalar().Bytes(),
ChainKey: chainKey,
VerificationShares: secpVerificationShares,
}), nil
}
Expand All @@ -172,6 +173,7 @@ func (r *round3) Finalize(chan<- *round.Message) (round.Session, error) {
Threshold: r.threshold,
PrivateShare: r.privateShare,
PublicKey: r.publicKey,
ChainKey: chainKey,
VerificationShares: party.NewPointMap(r.verificationShares),
}), nil
}
Expand Down

0 comments on commit 34fc3a1

Please sign in to comment.