Skip to content

Commit

Permalink
crypto: more linters and fix typo (ethereum#24783)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Dec 9, 2024
1 parent cb3edac commit 797efe7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 2 additions & 0 deletions crypto/blake2b/blake2b.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func appendUint64(b []byte, x uint64) []byte {
return append(b, a[:]...)
}

//nolint:unused,deadcode
func appendUint32(b []byte, x uint32) []byte {
var a [4]byte
binary.BigEndian.PutUint32(a[:], x)
Expand All @@ -313,6 +314,7 @@ func consumeUint64(b []byte) ([]byte, uint64) {
return b[8:], x
}

//nolint:unused,deadcode
func consumeUint32(b []byte) ([]byte, uint32) {
x := binary.BigEndian.Uint32(b)
return b[4:], x
Expand Down
1 change: 1 addition & 0 deletions crypto/blake2b/blake2b_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
}

// nolint:unused,deadcode
func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
var m [16]uint64
c0, c1 := c[0], c[1]
Expand Down
8 changes: 0 additions & 8 deletions crypto/blake2b/blake2b_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ import (
"testing"
)

func fromHex(s string) []byte {
b, err := hex.DecodeString(s)
if err != nil {
panic(err)
}
return b
}

func TestHashes(t *testing.T) {
defer func(sse4, avx, avx2 bool) {
useSSE4, useAVX, useAVX2 = sse4, avx, avx2
Expand Down
2 changes: 1 addition & 1 deletion crypto/signature_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error) {
//
// This function is susceptible to chosen plaintext attacks that can leak
// 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.
//
// The produced signature is in the [R || S || V] format where V is 0 or 1.
Expand Down

0 comments on commit 797efe7

Please sign in to comment.