Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security fix: any participant could disable DKG #464

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions share/dkg/rabin/dkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,16 @@ func (d *DistKeyGenerator) ProcessDeal(dd *Deal) (*Response, error) {
return nil, err
}

d.verifiers[dd.Index] = ver
resp, err := ver.ProcessEncryptedDeal(dd.Deal)
if err != nil {
return nil, err
}

// Set StatusApproval for the verifier that represents the participant
// that distibuted the Deal
d.verifiers[dd.Index].UnsafeSetResponseDKG(dd.Index, true)
ver.UnsafeSetResponseDKG(dd.Index, true)

d.verifiers[dd.Index] = ver
return &Response{
Index: dd.Index,
Response: resp,
Expand Down
28 changes: 14 additions & 14 deletions share/dkg/rabin/dkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,6 @@ func TestDKGProcessDeal(t *testing.T) {
assert.Error(t, err)
rec.participants = goodP

// good deal
resp, err = rec.ProcessDeal(deal)
assert.NotNil(t, resp)
assert.Equal(t, true, resp.Response.Approved)
assert.Nil(t, err)
_, ok := rec.verifiers[deal.Index]
require.True(t, ok)
assert.Equal(t, uint32(0), resp.Index)

// duplicate
resp, err = rec.ProcessDeal(deal)
assert.Nil(t, resp)
assert.Error(t, err)

// wrong index
goodIdx := deal.Index
deal.Index = uint32(nbParticipants + 1)
Expand All @@ -119,6 +105,20 @@ func TestDKGProcessDeal(t *testing.T) {
assert.Error(t, err)
deal.Deal.Signature = goodSig

// good deal
resp, err = rec.ProcessDeal(deal)
assert.NotNil(t, resp)
assert.Equal(t, true, resp.Response.Approved)
assert.Nil(t, err)
_, ok := rec.verifiers[deal.Index]
require.True(t, ok)
assert.Equal(t, uint32(0), resp.Index)

// duplicate
resp, err = rec.ProcessDeal(deal)
assert.Nil(t, resp)
assert.Error(t, err)

}

func TestDKGProcessResponse(t *testing.T) {
Expand Down