style: enable strict gofumpt (#15579)
This commit is contained in:
@@ -85,7 +85,7 @@ type hashed struct {
|
||||
// cost. If the cost given is less than MinCost, the cost will be set to
|
||||
// DefaultCost, instead. Use CompareHashAndPassword, as defined in this package,
|
||||
// to compare the returned hashed password with its cleartext version.
|
||||
func GenerateFromPassword(salt []byte, password []byte, cost uint32) ([]byte, error) {
|
||||
func GenerateFromPassword(salt, password []byte, cost uint32) ([]byte, error) {
|
||||
if len(salt) != maxSaltSize {
|
||||
return nil, fmt.Errorf("salt len must be %v", maxSaltSize)
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func Cost(hashedPassword []byte) (uint32, error) {
|
||||
return p.cost, nil
|
||||
}
|
||||
|
||||
func newFromPassword(salt []byte, password []byte, cost uint32) (*hashed, error) {
|
||||
func newFromPassword(salt, password []byte, cost uint32) (*hashed, error) {
|
||||
if cost < MinCost {
|
||||
cost = DefaultCost
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (pubKey *PubKey) Bytes() []byte {
|
||||
return pubKey.Key
|
||||
}
|
||||
|
||||
func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
func (pubKey *PubKey) VerifySignature(msg, sig []byte) bool {
|
||||
// make sure we use the same algorithm to sign
|
||||
if len(sig) != SignatureSize {
|
||||
return false
|
||||
|
||||
@@ -39,7 +39,7 @@ func NormalizeS(sigS *big.Int) *big.Int {
|
||||
// signatureRaw will serialize signature to R || S.
|
||||
// R, S are padded to 32 bytes respectively.
|
||||
// code roughly copied from secp256k1_nocgo.go
|
||||
func signatureRaw(r *big.Int, s *big.Int) []byte {
|
||||
func signatureRaw(r, s *big.Int) []byte {
|
||||
rBytes := r.Bytes()
|
||||
sBytes := s.Bytes()
|
||||
sigBytes := make([]byte, 64)
|
||||
|
||||
@@ -61,7 +61,7 @@ func (pk *PubKey) Bytes() []byte {
|
||||
// where the s integer component of the signature is in the
|
||||
// lower half of the curve order
|
||||
// 7/21/21 - expects raw encoded signature (fixed-width 64-bytes, R || S)
|
||||
func (pk *PubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
func (pk *PubKey) VerifySignature(msg, sig []byte) bool {
|
||||
// check length for raw signature
|
||||
// which is two 32-byte padded big.Ints
|
||||
// concatenated
|
||||
|
||||
@@ -100,7 +100,7 @@ func (m *LegacyAminoPubKey) VerifyMultisignature(getSignBytes multisigtypes.GetS
|
||||
// VerifySignature implements cryptotypes.PubKey VerifySignature method,
|
||||
// it panics because it can't handle MultiSignatureData
|
||||
// cf. https://github.com/cosmos/cosmos-sdk/issues/7109#issuecomment-686329936
|
||||
func (m *LegacyAminoPubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
func (m *LegacyAminoPubKey) VerifySignature(msg, sig []byte) bool {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ var (
|
||||
// The caller is responsible for ensuring that msg cannot be chosen
|
||||
// directly by an attacker. It is usually preferable to use a cryptographic
|
||||
// hash function on any input before handing it to this function.
|
||||
func Sign(msg []byte, seckey []byte) ([]byte, error) {
|
||||
func Sign(msg, seckey []byte) ([]byte, error) {
|
||||
if len(msg) != 32 {
|
||||
return nil, ErrInvalidMsgLen
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func Sign(msg []byte, seckey []byte) ([]byte, error) {
|
||||
// msg must be the 32-byte hash of the message to be signed.
|
||||
// sig must be a 65-byte compact ECDSA signature containing the
|
||||
// recovery id as the last element.
|
||||
func RecoverPubkey(msg []byte, sig []byte) ([]byte, error) {
|
||||
func RecoverPubkey(msg, sig []byte) ([]byte, error) {
|
||||
if len(msg) != 32 {
|
||||
return nil, ErrInvalidMsgLen
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) {
|
||||
|
||||
// VerifyBytes verifies a signature of the form R || S.
|
||||
// It rejects signatures which are not in lower-S form.
|
||||
func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool {
|
||||
func (pubKey *PubKey) VerifySignature(msg, sigStr []byte) bool {
|
||||
if len(sigStr) != 64 {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func (m *PubKey) Type() string {
|
||||
}
|
||||
|
||||
// VerifySignature implements SDK PubKey interface.
|
||||
func (m *PubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
func (m *PubKey) VerifySignature(msg, sig []byte) bool {
|
||||
return m.Key.VerifySignature(msg, sig)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user