Compare commits

..
3 Commits
Author SHA1 Message Date
Jakub Sztandera 95e754601e Merge pull request #1080 from filecoin-project/fix/nil-sigs
Fix nil signature verification
2020-01-14 17:15:45 +01:00
Łukasz Magiera 5e11da7316 build: bump version 2020-01-14 16:53:05 +01:00
Łukasz Magiera 24e36852af Fix nil signature verification 2020-01-14 16:52:01 +01:00
4 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import "fmt"
var CurrentCommit string
// BuildVersion is the local build version, set by build system
const BuildVersion = "0.2.1"
const BuildVersion = "0.2.2"
var UserVersion = BuildVersion + CurrentCommit
+4
View File
@@ -120,6 +120,10 @@ func (blk *BlockHeader) CheckBlockSignature(ctx context.Context, worker address.
_, span := trace.StartSpan(ctx, "checkBlockSignature")
defer span.End()
if blk.BlockSig == nil {
return xerrors.New("block signature not present")
}
sigb, err := blk.SigningBytes()
if err != nil {
return xerrors.Errorf("failed to get block signing bytes: %w", err)
+3
View File
@@ -116,5 +116,8 @@ func (s *Signature) UnmarshalCBOR(br io.Reader) error {
}
func (s *Signature) Equals(o *Signature) bool {
if s == nil || o == nil {
return s == o
}
return s.Type == o.Type && bytes.Equal(s.Data, o.Data)
}
+5
View File
@@ -9,9 +9,14 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-crypto"
"github.com/minio/blake2b-simd"
"golang.org/x/xerrors"
)
func (s *Signature) Verify(addr address.Address, msg []byte) error {
if s == nil {
return xerrors.Errorf("signature is nil")
}
if addr.Protocol() == address.ID {
return fmt.Errorf("must resolve ID addresses before using them to verify a signature")
}