mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-12 12:06:18 +08:00
go report card
This commit is contained in:
parent
f51e5cca1f
commit
7bf006ca42
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
[](https://app.travis-ci.com/emmansun/gmsm)
|
[](https://app.travis-ci.com/emmansun/gmsm)
|
||||||
[](https://github.com/emmansun/gmsm/actions/workflows/ci.yml)
|
[](https://github.com/emmansun/gmsm/actions/workflows/ci.yml)
|
||||||
|
[](https://goreportcard.com/report/github.com/emmansun/gmsm)
|
||||||
[](https://godoc.org/github.com/emmansun/gmsm)
|
[](https://godoc.org/github.com/emmansun/gmsm)
|
||||||
[](https://github.com/emmansun/gmsm/releases)
|
[](https://github.com/emmansun/gmsm/releases)
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ func TestNISTP256MontgomeryDomain(t *testing.T) {
|
|||||||
func TestForSqrt(t *testing.T) {
|
func TestForSqrt(t *testing.T) {
|
||||||
mod4 := new(big.Int).Mod(sm2Prime, big.NewInt(4))
|
mod4 := new(big.Int).Mod(sm2Prime, big.NewInt(4))
|
||||||
if mod4.Cmp(big.NewInt(3)) != 0 {
|
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))
|
exp := new(big.Int).Add(sm2Prime, big.NewInt(1))
|
||||||
|
@ -171,7 +171,7 @@ func (ke *KeyExchange) ConfirmResponder(rB *ecdsa.PublicKey, sB []byte) ([]byte,
|
|||||||
return nil, errors.New("sm2: received invalid random from responder")
|
return nil, errors.New("sm2: received invalid random from responder")
|
||||||
}
|
}
|
||||||
ke.peerSecret = rB
|
ke.peerSecret = rB
|
||||||
// Calcualte tA
|
// Calculate tA
|
||||||
t := (&big.Int{}).And(ke.w2Minus1, ke.secret.X)
|
t := (&big.Int{}).And(ke.w2Minus1, ke.secret.X)
|
||||||
t.Add(ke.w2, t)
|
t.Add(ke.w2, t)
|
||||||
t.Mul(t, ke.r)
|
t.Mul(t, ke.r)
|
||||||
|
@ -269,7 +269,7 @@ func TestNonceSafety(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if r0.Cmp(r1) == 0 {
|
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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ func (pub *EncryptMasterPublicKey) ScalarBaseMult(r *big.Int) *bn256.GT {
|
|||||||
return bn256.ScalarBaseMultGT(tables, r)
|
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) {
|
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)
|
q := pub.GenerateUserPublicKey(uid, hid)
|
||||||
var r *big.Int
|
var r *big.Int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user