mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-15 17:30:44 +00:00
crypto: more linters and fix typo (#24783)
This commit is contained in:
parent
cb3edac2c7
commit
797efe74af
4 changed files with 4 additions and 9 deletions
|
|
@ -302,6 +302,7 @@ func appendUint64(b []byte, x uint64) []byte {
|
||||||
return append(b, a[:]...)
|
return append(b, a[:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:unused,deadcode
|
||||||
func appendUint32(b []byte, x uint32) []byte {
|
func appendUint32(b []byte, x uint32) []byte {
|
||||||
var a [4]byte
|
var a [4]byte
|
||||||
binary.BigEndian.PutUint32(a[:], x)
|
binary.BigEndian.PutUint32(a[:], x)
|
||||||
|
|
@ -313,6 +314,7 @@ func consumeUint64(b []byte) ([]byte, uint64) {
|
||||||
return b[8:], x
|
return b[8:], x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:unused,deadcode
|
||||||
func consumeUint32(b []byte) ([]byte, uint32) {
|
func consumeUint32(b []byte) ([]byte, uint32) {
|
||||||
x := binary.BigEndian.Uint32(b)
|
x := binary.BigEndian.Uint32(b)
|
||||||
return b[4:], x
|
return b[4:], x
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ var precomputed = [10][16]byte{
|
||||||
{10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
|
{10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:unused,deadcode
|
||||||
func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
|
func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
|
||||||
var m [16]uint64
|
var m [16]uint64
|
||||||
c0, c1 := c[0], c[1]
|
c0, c1 := c[0], c[1]
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromHex(s string) []byte {
|
|
||||||
b, err := hex.DecodeString(s)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHashes(t *testing.T) {
|
func TestHashes(t *testing.T) {
|
||||||
defer func(sse4, avx, avx2 bool) {
|
defer func(sse4, avx, avx2 bool) {
|
||||||
useSSE4, useAVX, useAVX2 = sse4, avx, avx2
|
useSSE4, useAVX, useAVX2 = sse4, avx, avx2
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error) {
|
||||||
//
|
//
|
||||||
// This function is susceptible to chosen plaintext attacks that can leak
|
// This function is susceptible to chosen plaintext attacks that can leak
|
||||||
// information about the private key that is used for signing. Callers must
|
// information about the private key that is used for signing. Callers must
|
||||||
// be aware that the given digest cannot be chosen by an adversery. Common
|
// be aware that the given digest cannot be chosen by an adversary. Common
|
||||||
// solution is to hash any input before calculating the signature.
|
// solution is to hash any input before calculating the signature.
|
||||||
//
|
//
|
||||||
// The produced signature is in the [R || S || V] format where V is 0 or 1.
|
// The produced signature is in the [R || S || V] format where V is 0 or 1.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue