crypto: fix staticcheck warnings

This commit is contained in:
Guillaume Ballet 2019-11-22 18:52:22 +01:00
parent fdff182f11
commit 296e2ee156
5 changed files with 5 additions and 10 deletions

View file

@ -302,6 +302,7 @@ func appendUint64(b []byte, x uint64) []byte {
return append(b, a[:]...) return append(b, a[:]...)
} }
//lint:ignore U1000 keep utility function
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
} }
//lint:ignore U1000 keep utility function
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

View file

@ -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},
} }
//lint:ignore U1000 useful on other platforms
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]

View file

@ -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

View file

@ -9,6 +9,7 @@ import (
"golang.org/x/sys/cpu" "golang.org/x/sys/cpu"
) )
//lint:ignore U1000 used in asm
//nolint:varcheck //nolint:varcheck
var hasBMI2 = cpu.X86.HasBMI2 var hasBMI2 = cpu.X86.HasBMI2

View file

@ -199,9 +199,8 @@ func miller(q *twistPoint, p *curvePoint) *gfP12 {
r = newR r = newR
r2.Square(&minusQ2.y) r2.Square(&minusQ2.y)
a, b, c, newR = lineFunctionAdd(r, minusQ2, bAffine, r2) a, b, c, _ = lineFunctionAdd(r, minusQ2, bAffine, r2)
mulLine(ret, a, b, c) mulLine(ret, a, b, c)
r = newR
return ret return ret
} }