diff options
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r-- | crypto/crypto.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go index b3a8d730b..272050106 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -172,10 +172,10 @@ func GenerateKey() (*ecdsa.PrivateKey, error) { } func ValidateSignatureValues(v byte, r, s *big.Int) bool { - vint := uint32(v) - if r.Cmp(common.Big0) == 0 || s.Cmp(common.Big0) == 0 { + if r.Cmp(common.Big1) < 0 || s.Cmp(common.Big1) < 0 { return false } + vint := uint32(v) if r.Cmp(secp256k1n) < 0 && s.Cmp(secp256k1n) < 0 && (vint == 27 || vint == 28) { return true } else { @@ -302,17 +302,6 @@ func aesCBCDecrypt(key, cipherText, iv []byte) ([]byte, error) { } // From https://leanpub.com/gocrypto/read#leanpub-auto-block-cipher-modes -func PKCS7Pad(in []byte) []byte { - padding := 16 - (len(in) % 16) - if padding == 0 { - padding = 16 - } - for i := 0; i < padding; i++ { - in = append(in, byte(padding)) - } - return in -} - func PKCS7Unpad(in []byte) []byte { if len(in) == 0 { return nil |