go report card

This commit is contained in:
Sun Yimin 2022-07-11 13:27:36 +08:00 committed by GitHub
parent f51e5cca1f
commit 7bf006ca42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 4 deletions

View File

@ -3,6 +3,7 @@
[![Travis CI](https://app.travis-ci.com/emmansun/gmsm.svg?branch=main)](https://app.travis-ci.com/emmansun/gmsm)
[![Github CI](https://github.com/emmansun/gmsm/actions/workflows/ci.yml/badge.svg)](https://github.com/emmansun/gmsm/actions/workflows/ci.yml)
[![Go Report Card]((https://goreportcard.com/report/github.com/emmansun/gmsm)](https://goreportcard.com/report/github.com/emmansun/gmsm)
[![Documentation](https://godoc.org/github.com/emmansun/gmsm?status.svg)](https://godoc.org/github.com/emmansun/gmsm)
[![Release](https://img.shields.io/github/release/emmansun/gmsm/all.svg)](https://github.com/emmansun/gmsm/releases)

View File

@ -149,7 +149,7 @@ func TestNISTP256MontgomeryDomain(t *testing.T) {
func TestForSqrt(t *testing.T) {
mod4 := new(big.Int).Mod(sm2Prime, big.NewInt(4))
if mod4.Cmp(big.NewInt(3)) != 0 {
t.Fatal("sm2 prime is not fufill 3 mod 4")
t.Fatal("sm2 prime is not fulfill 3 mod 4")
}
exp := new(big.Int).Add(sm2Prime, big.NewInt(1))

View File

@ -171,7 +171,7 @@ func (ke *KeyExchange) ConfirmResponder(rB *ecdsa.PublicKey, sB []byte) ([]byte,
return nil, errors.New("sm2: received invalid random from responder")
}
ke.peerSecret = rB
// Calcualte tA
// Calculate tA
t := (&big.Int{}).And(ke.w2Minus1, ke.secret.X)
t.Add(ke.w2, t)
t.Mul(t, ke.r)

View File

@ -269,7 +269,7 @@ func TestNonceSafety(t *testing.T) {
}
if r0.Cmp(r1) == 0 {
t.Error("SM2: the nonce used for two diferent messages was the same")
t.Error("SM2: the nonce used for two different messages was the same")
}
}

View File

@ -248,7 +248,7 @@ func (pub *EncryptMasterPublicKey) ScalarBaseMult(r *big.Int) *bn256.GT {
return bn256.ScalarBaseMultGT(tables, r)
}
// WrapKey generate and wrap key wtih reciever's uid and system hid
// WrapKey generate and wrap key with reciever's uid and system hid
func WrapKey(rand io.Reader, pub *EncryptMasterPublicKey, uid []byte, hid byte, kLen int) (key []byte, cipher *bn256.G1, err error) {
q := pub.GenerateUserPublicKey(uid, hid)
var r *big.Int