mirror of
https://github.com/emmansun/gmsm.git
synced 2025-06-28 00:13:26 +08:00
all: golint
This commit is contained in:
parent
fca59d1a92
commit
bb64af1a24
@ -3,7 +3,7 @@ package cpuid
|
||||
import "github.com/emmansun/gmsm/internal/deps/cpu"
|
||||
|
||||
var (
|
||||
HasAES = cpu.X86.HasAES
|
||||
HasGFMUL = cpu.X86.HasPCLMULQDQ
|
||||
HasAES = cpu.X86.HasAES
|
||||
HasGFMUL = cpu.X86.HasPCLMULQDQ
|
||||
HasVPMSUMD = false
|
||||
)
|
||||
|
@ -46,8 +46,8 @@ const (
|
||||
r = 4193792 // 2^32 mod q
|
||||
)
|
||||
|
||||
// See FIPS 204, Algorithm 49, MontgomeryReduce()
|
||||
func fieldReduce(a uint64) fieldElement {
|
||||
// See FIPS 204, Algorithm 49, MontgomeryReduce()
|
||||
t := uint32(a) * qNegInv
|
||||
return fieldReduceOnce(uint32((a + uint64(t)*q) >> 32))
|
||||
}
|
||||
@ -243,4 +243,3 @@ func vectorCountOnes(a []ringElement) int {
|
||||
}
|
||||
return oneCount
|
||||
}
|
||||
|
||||
|
@ -845,7 +845,7 @@ var _p256 *sm2Curve
|
||||
func p256() *sm2Curve {
|
||||
p256Once.Do(func() {
|
||||
_p256 = &sm2Curve{
|
||||
newPoint: func() *_sm2ec.SM2P256Point { return _sm2ec.NewSM2P256Point() },
|
||||
newPoint: _sm2ec.NewSM2P256Point,
|
||||
}
|
||||
precomputeParams(_p256, P256())
|
||||
})
|
||||
|
@ -159,7 +159,7 @@ func buildTmpPublicKeyAttr(key crypto.Signer, rawAttributes []asn1.RawValue, tmp
|
||||
}
|
||||
publicKeyBytes = make([]byte, 136)
|
||||
// Prefix{8} || X{32} || zero{32} || Y{32} || zero{32}
|
||||
copy(publicKeyBytes[:], tmpPublicKeyPrefix)
|
||||
copy(publicKeyBytes, tmpPublicKeyPrefix)
|
||||
ecPub, _ := tmpPub.(*ecdsa.PublicKey)
|
||||
ecPub.X.FillBytes(publicKeyBytes[8:40])
|
||||
ecPub.Y.FillBytes(publicKeyBytes[72:104])
|
||||
@ -175,7 +175,7 @@ func buildTmpPublicKeyAttr(key crypto.Signer, rawAttributes []asn1.RawValue, tmp
|
||||
}
|
||||
var tmpPublicKey = tmpPublicKeyInfo{
|
||||
Version: 1,
|
||||
PublicKey: publicKeyBytes[:],
|
||||
PublicKey: publicKeyBytes,
|
||||
}
|
||||
b, err := asn1.Marshal(tmpPublicKey)
|
||||
if err != nil {
|
||||
|
@ -393,11 +393,11 @@ func TestCheckSignatureWithDigest(t *testing.T) {
|
||||
algo: SM2WithSM3,
|
||||
digest: func() []byte {
|
||||
hash, _ := sm2.CalculateSM2Hash(&sm2PrivateKey.PublicKey, rawMessage, nil)
|
||||
return hash[:]
|
||||
return hash
|
||||
}(),
|
||||
signature: func() []byte {
|
||||
hash, _ := sm2.CalculateSM2Hash(&sm2PrivateKey.PublicKey, rawMessage, nil)
|
||||
return mustSignSM2(t, sm2PrivateKey, hash[:])
|
||||
return mustSignSM2(t, sm2PrivateKey, hash)
|
||||
}(),
|
||||
expectedError: nil,
|
||||
},
|
||||
@ -409,7 +409,7 @@ func TestCheckSignatureWithDigest(t *testing.T) {
|
||||
algo: SM2WithSM3,
|
||||
digest: func() []byte {
|
||||
hash, _ := sm2.CalculateSM2Hash(&sm2PrivateKey.PublicKey, rawMessage, nil)
|
||||
return hash[:]
|
||||
return hash
|
||||
}(),
|
||||
signature: func() []byte {
|
||||
hash, _ := sm2.CalculateSM2Hash(&sm2PrivateKey2.PublicKey, rawMessage, nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user