diff --git a/crypto/keys/bls12381/bls12381.go b/crypto/keys/bls12381/bls12381.go index 4806b26685..eab266c3d2 100644 --- a/crypto/keys/bls12381/bls12381.go +++ b/crypto/keys/bls12381/bls12381.go @@ -112,7 +112,7 @@ func GenPrivKey() *PrivKey { return &PrivKey{Key: genPrivKey(crypto.CReader())} } -// genPrivKey generates a new secp256k1 private key using the provided reader. +// genPrivKey generates a new bls12381 private key using the provided reader. func genPrivKey(rand io.Reader) []byte { var ikm [SeedSize]byte _, err := io.ReadFull(rand, ikm[:]) diff --git a/crypto/keys/bls12381/multisig.go b/crypto/keys/bls12381/multisig.go new file mode 100644 index 0000000000..18e499e390 --- /dev/null +++ b/crypto/keys/bls12381/multisig.go @@ -0,0 +1,102 @@ +package bls12381 + +import ( + "encoding/base64" + "fmt" + + blst "github.com/supranational/blst/bindings/go" +) + +func aggregatePublicKey(pks []*PubKey) (*blst.P1Affine, error) { + pubkeys := make([]*blst.P1Affine, len(pks)) + for i, pk := range pks { + pubkeys[i] = new(blst.P1Affine).Deserialize(pk.Key) + if pubkeys[i] == nil { + return nil, fmt.Errorf("failed to deserialize public key") + } + } + + aggregator := new(blst.P1Aggregate) + b := aggregator.Aggregate(pubkeys, false) + if !b { + return nil, fmt.Errorf("failed to aggregate public keys") + } + apk := aggregator.ToAffine() + + return apk, nil +} + +// AggregateSignature combines a set of verified signatures into a single bls signature +func AggregateSignature(sigs [][]byte) ([]byte, error) { + sigmas := make([]*blst.P2Affine, len(sigs)) + for i, sig := range sigs { + sigmas[i] = new(blst.P2Affine).Uncompress(sig) + if sigmas[i] == nil { + return nil, fmt.Errorf("failed to deserialize the %d-th signature", i) + } + } + + aggregator := new(blst.P2Aggregate) + b := aggregator.Aggregate(sigmas, false) + if !b { + return nil, fmt.Errorf("failed to aggregate signatures") + } + aggSigBytes := aggregator.ToAffine().Compress() + return aggSigBytes, nil +} + +// VerifyMultiSignature assumes public key is already validated +func VerifyMultiSignature(msg []byte, sig []byte, pks []*PubKey) error { + return VerifyAggregateSignature([][]byte{msg}, sig, [][]*PubKey{pks}) +} + +func Unique(msgs [][]byte) bool { + if len(msgs) <= 1 { + return true + } + msgMap := make(map[string]bool, len(msgs)) + for _, msg := range msgs { + s := base64.StdEncoding.EncodeToString(msg) + if _, ok := msgMap[s]; ok { + return false + } + msgMap[s] = true + } + return true +} + +func VerifyAggregateSignature(msgs [][]byte, sig []byte, pkss [][]*PubKey) error { + n := len(msgs) + if n == 0 { + return fmt.Errorf("messages cannot be empty") + } + + if len(pkss) != n { + return fmt.Errorf("the number of messages and public key sets must match") + } + + if !Unique(msgs) { + return fmt.Errorf("messages must be pairwise distinct") + } + + apks := make([]*blst.P1Affine, len(pkss)) + for i, pks := range pkss { + apk, err := aggregatePublicKey(pks) + if err != nil { + return fmt.Errorf("cannot aggregate public keys: %s", err.Error()) + } + apks[i] = apk + } + + sigma := new(blst.P2Affine).Uncompress(sig) + if sigma == nil { + return fmt.Errorf("failed to deserialize signature") + } + + dst := []byte("BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_") + if !sigma.AggregateVerify(true, apks, false, msgs, dst) { + return fmt.Errorf("failed to verify signature") + } + + return nil +} diff --git a/crypto/keys/bls12381/multisig_test.go b/crypto/keys/bls12381/multisig_test.go new file mode 100644 index 0000000000..c0024f859b --- /dev/null +++ b/crypto/keys/bls12381/multisig_test.go @@ -0,0 +1,124 @@ +package bls12381_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + bls "github.com/cosmos/cosmos-sdk/crypto/keys/bls12381" +) + +func TestBlsMultiSig(t *testing.T) { + total := 5 + pks := make([]*bls.PubKey, total) + sigs := make([][]byte, total) + msg := []byte("hello world") + for i := 0; i < total; i++ { + sk := bls.GenPrivKey() + pk, ok := sk.PubKey().(*bls.PubKey) + require.True(t, ok) + + sig, err := sk.Sign(msg) + require.Nil(t, err) + + pks[i] = pk + sigs[i] = sig + } + + aggSig, err := bls.AggregateSignature(sigs) + require.Nil(t, err) + + assert.Nil(t, bls.VerifyMultiSignature(msg, aggSig, pks)) + +} + +func TestBlsAggSig(t *testing.T) { + total := 5 + pks := make([][]*bls.PubKey, total) + sigs := make([][]byte, total) + msgs := make([][]byte, total) + for i := 0; i < total; i++ { + msgs[i] = []byte(fmt.Sprintf("message %d", i)) + sk := bls.GenPrivKey() + pk, ok := sk.PubKey().(*bls.PubKey) + require.True(t, ok) + + sig, err := sk.Sign(msgs[i]) + require.Nil(t, err) + + pks[i] = []*bls.PubKey{pk} + sigs[i] = sig + } + + aggSig, err := bls.AggregateSignature(sigs) + require.Nil(t, err) + + assert.Nil(t, bls.VerifyAggregateSignature(msgs, aggSig, pks)) + +} + +func benchmarkBlsVerifyMulti(total int, b *testing.B) { + pks := make([]*bls.PubKey, total) + sigs := make([][]byte, total) + msg := []byte("hello world") + for i := 0; i < total; i++ { + sk := bls.GenPrivKey() + pk, ok := sk.PubKey().(*bls.PubKey) + require.True(b, ok) + + sig, err := sk.Sign(msg) + require.Nil(b, err) + + pks[i] = pk + sigs[i] = sig + } + + aggSig, err := bls.AggregateSignature(sigs) + require.Nil(b, err) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + bls.VerifyMultiSignature(msg, aggSig, pks) + } +} + +func BenchmarkBlsVerifyMulti8(b *testing.B) { benchmarkBlsVerifyMulti(8, b) } +func BenchmarkBlsVerifyMulti16(b *testing.B) { benchmarkBlsVerifyMulti(16, b) } +func BenchmarkBlsVerifyMulti32(b *testing.B) { benchmarkBlsVerifyMulti(32, b) } +func BenchmarkBlsVerifyMulti64(b *testing.B) { benchmarkBlsVerifyMulti(64, b) } +func BenchmarkBlsVerifyMulti128(b *testing.B) { benchmarkBlsVerifyMulti(128, b) } + +func benchmarkBlsVerifyAgg(total int, b *testing.B) { + pks := make([][]*bls.PubKey, total) + sigs := make([][]byte, total) + msgs := make([][]byte, total) + for i := 0; i < total; i++ { + msgs[i] = []byte(fmt.Sprintf("message %d", i)) + sk := bls.GenPrivKey() + pk, ok := sk.PubKey().(*bls.PubKey) + require.True(b, ok) + + sig, err := sk.Sign(msgs[i]) + require.Nil(b, err) + + pks[i] = []*bls.PubKey{pk} + sigs[i] = sig + } + + aggSig, err := bls.AggregateSignature(sigs) + require.Nil(b, err) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + bls.VerifyAggregateSignature(msgs, aggSig, pks) + } +} + +func BenchmarkBlsVerifyAgg8(b *testing.B) { benchmarkBlsVerifyAgg(8, b) } +func BenchmarkBlsVerifyAgg16(b *testing.B) { benchmarkBlsVerifyAgg(16, b) } +func BenchmarkBlsVerifyAgg32(b *testing.B) { benchmarkBlsVerifyAgg(32, b) } +func BenchmarkBlsVerifyAgg64(b *testing.B) { benchmarkBlsVerifyAgg(64, b) } +func BenchmarkBlsVerifyAgg128(b *testing.B) { benchmarkBlsVerifyAgg(128, b) } diff --git a/proto/cosmos/auth/v1beta1/auth.proto b/proto/cosmos/auth/v1beta1/auth.proto index 799568c186..9be92bd2ce 100644 --- a/proto/cosmos/auth/v1beta1/auth.proto +++ b/proto/cosmos/auth/v1beta1/auth.proto @@ -23,6 +23,7 @@ message BaseAccount { [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; uint64 sequence = 4; + bool pop_is_valid = 5; } // ModuleAccount defines an account for modules that holds coins on a pool. diff --git a/types/errors/errors.go b/types/errors/errors.go index 026f5f569b..909b97f691 100644 --- a/types/errors/errors.go +++ b/types/errors/errors.go @@ -134,6 +134,9 @@ var ( // supported. ErrNotSupported = Register(RootCodespace, 37, "feature not supported") + // ErrInvalidPop to doc + ErrInvalidPop = Register(RootCodespace, 38, "invalid pop for public key") + // ErrPanic is only set when we recover from a panic, so we know to // redact potentially sensitive system info ErrPanic = Register(UndefinedCodespace, 111222, "panic") diff --git a/x/auth/ante/ante.go b/x/auth/ante/ante.go index 8cc025bad2..ee474b8fbc 100644 --- a/x/auth/ante/ante.go +++ b/x/auth/ante/ante.go @@ -28,6 +28,7 @@ func NewAnteHandler( NewDeductFeeDecorator(ak, bankKeeper), NewSigGasConsumeDecorator(ak, sigGasConsumer), NewSigVerificationDecorator(ak, signModeHandler), + NewSetPopValidDecorator(ak), NewIncrementSequenceDecorator(ak), ) } diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index db5df87a9a..38a89ea7d8 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -318,6 +318,40 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul return next(ctx, tx, simulate) } +// SetPopValidDecorator handles the validation status of the proof-of-possession (POP) of an individual public key. +// A valid transaction and signature can be viewed as a POP for the signer's public key. +// POP is required when forming a compact multisig group in order to prevent rogue public key attacks. +type SetPopValidDecorator struct { + ak AccountKeeper +} + +func NewSetPopValidDecorator(ak AccountKeeper) SetPopValidDecorator { + return SetPopValidDecorator{ + ak: ak, + } +} + +func (spvd SetPopValidDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + sigTx, ok := tx.(authsigning.SigVerifiableTx) + if !ok { + return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") + } + + for _, addr := range sigTx.GetSigners() { + acc := spvd.ak.GetAccount(ctx, addr) + pk := acc.GetPubKey() + + switch pk.(type) { + case *bls12381.PubKey, *secp256k1.PubKey, *ed25519.PubKey: + if err := acc.SetPopValid(true); err != nil { + return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidPop, err.Error()) + } + } + } + + return next(ctx, tx, simulate) +} + // IncrementSequenceDecorator handles incrementing sequences of all signers. // Use the IncrementSequenceDecorator decorator to prevent replay attacks. Note, // there is no need to execute IncrementSequenceDecorator on RecheckTX since diff --git a/x/auth/types/account.go b/x/auth/types/account.go index eb9939ffce..9b1b89ec6c 100644 --- a/x/auth/types/account.go +++ b/x/auth/types/account.go @@ -32,6 +32,7 @@ func NewBaseAccount(address sdk.AccAddress, pubKey cryptotypes.PubKey, accountNu Address: address.String(), AccountNumber: accountNumber, Sequence: sequence, + PopIsValid: false, } err := acc.SetPubKey(pubKey) @@ -117,6 +118,20 @@ func (acc *BaseAccount) SetSequence(seq uint64) error { return nil } +// SetPopValid - Implements sdk.AccountI. +func (acc *BaseAccount) SetPopValid(isValid bool) error { + if acc.PubKey == nil { + return errors.New("public key is not set yet") + } + acc.PopIsValid = isValid + return nil +} + +// GetPopValid - Implements sdk.AccountI. +func (acc *BaseAccount) GetPopValid() bool { + return acc.PopIsValid +} + // Validate checks for errors on the account fields func (acc BaseAccount) Validate() error { if acc.Address == "" || acc.PubKey == nil { @@ -222,6 +237,11 @@ func (ma ModuleAccount) SetSequence(seq uint64) error { return fmt.Errorf("not supported for module accounts") } +// SetPopValid - Implements AccountI +func (ma ModuleAccount) SetPopValid(isValid bool) error { + return fmt.Errorf("not supported for module accounts") +} + // Validate checks for errors on the account fields func (ma ModuleAccount) Validate() error { if strings.TrimSpace(ma.Name) == "" { @@ -324,6 +344,9 @@ type AccountI interface { GetSequence() uint64 SetSequence(uint64) error + GetPopValid() bool + SetPopValid(bool) error + // Ensure that account implements stringer String() string } diff --git a/x/auth/types/auth.pb.go b/x/auth/types/auth.pb.go index ad2283b816..dff9c39fc2 100644 --- a/x/auth/types/auth.pb.go +++ b/x/auth/types/auth.pb.go @@ -33,6 +33,7 @@ type BaseAccount struct { PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` + PopIsValid bool `protobuf:"varint,5,opt,name=pop_is_valid,json=popIsValid,proto3" json:"pop_is_valid,omitempty"` } func (m *BaseAccount) Reset() { *m = BaseAccount{} } @@ -199,52 +200,53 @@ func init() { func init() { proto.RegisterFile("cosmos/auth/v1beta1/auth.proto", fileDescriptor_7e1f7e915d020d2d) } var fileDescriptor_7e1f7e915d020d2d = []byte{ - // 707 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0x4f, 0x4f, 0xdb, 0x48, - 0x14, 0x8f, 0x97, 0x6c, 0x80, 0x09, 0x20, 0x61, 0x12, 0x30, 0xd9, 0x95, 0xc7, 0xf2, 0x29, 0x2b, - 0x6d, 0x1c, 0x25, 0x88, 0xd5, 0x12, 0xad, 0x56, 0x8b, 0xd9, 0x1e, 0x50, 0x0b, 0x42, 0x46, 0xea, - 0xa1, 0xaa, 0xe4, 0x8e, 0x9d, 0xc1, 0x58, 0x64, 0x32, 0xc6, 0x33, 0x46, 0x31, 0x9f, 0xa0, 0xc7, - 0x1e, 0x7b, 0xe4, 0x43, 0xf0, 0x0d, 0x7a, 0xe9, 0x11, 0x71, 0xa8, 0x7a, 0xb2, 0xaa, 0x70, 0xa9, - 0x7a, 0xf4, 0xbd, 0x52, 0x95, 0xb1, 0x13, 0x12, 0x94, 0x9e, 0xe2, 0xf7, 0x7e, 0xff, 0xde, 0xbc, - 0x51, 0x06, 0xa8, 0x2e, 0x65, 0x84, 0xb2, 0x26, 0x8a, 0xf8, 0x79, 0xf3, 0xaa, 0xe5, 0x60, 0x8e, - 0x5a, 0xa2, 0x30, 0x82, 0x90, 0x72, 0x2a, 0x6f, 0x64, 0xb8, 0x21, 0x5a, 0x39, 0x5e, 0x5b, 0xc9, - 0x9b, 0x82, 0x52, 0xab, 0x78, 0xd4, 0xa3, 0xe2, 0xb3, 0x39, 0xfa, 0xca, 0xbb, 0xdb, 0x1e, 0xa5, - 0x5e, 0x0f, 0x37, 0x45, 0xe5, 0x44, 0x67, 0x4d, 0xd4, 0x8f, 0x33, 0x48, 0xff, 0x2e, 0x81, 0x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, 0x71, 0xb7, 0xbd, 0xbb, 0xdb, - 0xda, 0xcb, 0x2e, 0xdd, 0xec, 0x0c, 0x13, 0x58, 0x39, 0xf5, 0xbd, 0x97, 0x82, 0x31, 0x92, 0x3e, - 0xfb, 0x5f, 0xe0, 0x69, 0x02, 0xd5, 0x2c, 0xed, 0x27, 0x06, 0xba, 0x55, 0x61, 0x33, 0xba, 0xac, - 0x2d, 0xc7, 0x60, 0xfb, 0xa9, 0x82, 0x61, 0x37, 0x68, 0xef, 0xfe, 0x75, 0xd1, 0x52, 0x7e, 0x15, - 0xa1, 0xff, 0x0e, 0x13, 0xb8, 0x39, 0x13, 0x7a, 0x3a, 0x66, 0xa4, 0x09, 0xd4, 0xe6, 0xc7, 0x4e, - 0x4c, 0x74, 0x6b, 0x93, 0xcd, 0xd5, 0xca, 0x11, 0x50, 0x9e, 0xaa, 0x9c, 0x1e, 0x6b, 0xb5, 0x77, - 0xfe, 0x6e, 0x29, 0x25, 0x91, 0xfc, 0xcf, 0x30, 0x81, 0xd5, 0x99, 0x64, 0x33, 0x27, 0xa4, 0x09, - 0x84, 0xf3, 0x83, 0xc7, 0x16, 0xba, 0x55, 0x65, 0xf3, 0x94, 0x9d, 0xa5, 0xfc, 0xaf, 0x22, 0x99, - 0x07, 0x1f, 0x87, 0xaa, 0x74, 0x37, 0x54, 0xa5, 0x2f, 0x43, 0x55, 0x7a, 0xf7, 0xa0, 0x16, 0xee, - 0x1e, 0xd4, 0xc2, 0xe7, 0x07, 0xb5, 0xf0, 0xea, 0x0f, 0xcf, 0xe7, 0xe7, 0x91, 0x63, 0xb8, 0x94, - 0x34, 0xf3, 0x77, 0x2b, 0xfb, 0x69, 0xb0, 0xee, 0x45, 0x73, 0x90, 0x3d, 0x62, 0x3c, 0x0e, 0x30, - 0x73, 0x4a, 0xe2, 0x81, 0xd8, 0xf9, 0x11, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xe6, 0x37, 0xa1, 0xe0, - 0x04, 0x00, 0x00, + // 734 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xcf, 0x4e, 0xe3, 0x46, + 0x18, 0x8f, 0x21, 0x0d, 0x61, 0x12, 0x90, 0x30, 0x09, 0x98, 0xb4, 0xf2, 0x58, 0x3e, 0xa5, 0x52, + 0xe3, 0x28, 0x41, 0x54, 0x25, 0xaa, 0xaa, 0x62, 0xda, 0x03, 0x6a, 0x41, 0xc8, 0x48, 0x1c, 0xaa, + 0x4a, 0xde, 0xb1, 0x33, 0x18, 0x8b, 0x38, 0x63, 0x3c, 0x63, 0x14, 0xf3, 0x04, 0x7b, 0xdc, 0xe3, + 0xde, 0x96, 0x87, 0xe0, 0x0d, 0xf6, 0xb2, 0x47, 0xc4, 0x61, 0xb5, 0x27, 0x6b, 0x15, 0x2e, 0xab, + 0x3d, 0xfa, 0x09, 0x56, 0x1e, 0x3b, 0x21, 0x41, 0xd9, 0x53, 0xe6, 0xfb, 0x7e, 0xff, 0x66, 0xbe, + 0x71, 0x06, 0xc8, 0x36, 0xa1, 0x1e, 0xa1, 0x6d, 0x14, 0xb2, 0xcb, 0xf6, 0x4d, 0xc7, 0xc2, 0x0c, + 0x75, 0x78, 0xa1, 0xf9, 0x01, 0x61, 0x44, 0xdc, 0xcc, 0x70, 0x8d, 0xb7, 0x72, 0xbc, 0x51, 0xcd, + 0x9b, 0x9c, 0xd2, 0xa8, 0x39, 0xc4, 0x21, 0x7c, 0xd9, 0x4e, 0x57, 0x79, 0x77, 0xc7, 0x21, 0xc4, + 0x19, 0xe0, 0x36, 0xaf, 0xac, 0xf0, 0xa2, 0x8d, 0x86, 0x51, 0x06, 0xa9, 0xef, 0x96, 0x40, 0x45, + 0x47, 0x14, 0x1f, 0xd8, 0x36, 0x09, 0x87, 0x4c, 0x94, 0xc0, 0x0a, 0xea, 0xf7, 0x03, 0x4c, 0xa9, + 0x24, 0x28, 0x42, 0x73, 0xd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0xb2, 0xe7, 0x03, 0x02, 0x05, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -306,6 +308,16 @@ func (m *BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PopIsValid { + i-- + if m.PopIsValid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } if m.Sequence != 0 { i = encodeVarintAuth(dAtA, i, uint64(m.Sequence)) i-- @@ -473,6 +485,9 @@ func (m *BaseAccount) Size() (n int) { if m.Sequence != 0 { n += 1 + sovAuth(uint64(m.Sequence)) } + if m.PopIsValid { + n += 2 + } return n } @@ -667,6 +682,26 @@ func (m *BaseAccount) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PopIsValid", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuth + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PopIsValid = bool(v != 0) default: iNdEx = preIndex skippy, err := skipAuth(dAtA[iNdEx:])