diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/crypto.go | 6 | ||||
-rw-r--r-- | core/crypto_test.go | 8 | ||||
-rw-r--r-- | core/dkg-tsig-protocol_test.go | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/core/crypto.go b/core/crypto.go index ceb38f0..a0bacac 100644 --- a/core/crypto.go +++ b/core/crypto.go @@ -154,7 +154,8 @@ func hashDKGMasterPublicKey(mpk *types.DKGMasterPublicKey) common.Hash { ) } -func verifyDKGMasterPublicKeySignature( +// VerifyDKGMasterPublicKeySignature verifies DKGMasterPublicKey signature. +func VerifyDKGMasterPublicKeySignature( mpk *types.DKGMasterPublicKey) (bool, error) { hash := hashDKGMasterPublicKey(mpk) pubKey, err := crypto.SigToPub(hash, mpk.Signature) @@ -180,7 +181,8 @@ func hashDKGComplaint(complaint *types.DKGComplaint) common.Hash { ) } -func verifyDKGComplaintSignature( +// VerifyDKGComplaintSignature verifies DKGCompliant signature. +func VerifyDKGComplaintSignature( complaint *types.DKGComplaint) (bool, error) { hash := hashDKGComplaint(complaint) pubKey, err := crypto.SigToPub(hash, complaint.Signature) diff --git a/core/crypto_test.go b/core/crypto_test.go index 85bfb63..1fdc802 100644 --- a/core/crypto_test.go +++ b/core/crypto_test.go @@ -184,9 +184,9 @@ func (s *CryptoTestSuite) TestDKGSignature() { } mpk.Signature, err = prv.Sign(hashDKGMasterPublicKey(mpk)) s.Require().Nil(err) - s.True(verifyDKGMasterPublicKeySignature(mpk)) + s.True(VerifyDKGMasterPublicKeySignature(mpk)) mpk.Round++ - s.False(verifyDKGMasterPublicKeySignature(mpk)) + s.False(VerifyDKGMasterPublicKeySignature(mpk)) complaint := &types.DKGComplaint{ ProposerID: nID, @@ -195,9 +195,9 @@ func (s *CryptoTestSuite) TestDKGSignature() { } complaint.Signature, err = prv.Sign(hashDKGComplaint(complaint)) s.Require().Nil(err) - s.True(verifyDKGComplaintSignature(complaint)) + s.True(VerifyDKGComplaintSignature(complaint)) complaint.Round++ - s.False(verifyDKGComplaintSignature(complaint)) + s.False(VerifyDKGComplaintSignature(complaint)) sig := &types.DKGPartialSignature{ ProposerID: nID, diff --git a/core/dkg-tsig-protocol_test.go b/core/dkg-tsig-protocol_test.go index 1e8cac4..9743531 100644 --- a/core/dkg-tsig-protocol_test.go +++ b/core/dkg-tsig-protocol_test.go @@ -271,7 +271,7 @@ func (s *DKGTSIGProtocolTestSuite) TestNackComplaint() { complaint, exist := recv.complaints[byzantineID] s.True(complaint.IsNack()) s.Require().True(exist) - s.True(verifyDKGComplaintSignature(complaint)) + s.True(VerifyDKGComplaintSignature(complaint)) } } |