mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
sm9: remove unsure code
This commit is contained in:
parent
af50b136e9
commit
ec7f96d3cc
@ -9,6 +9,21 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestG1AddNeg(t *testing.T) {
|
||||||
|
g1, g2 := &G1{}, &G1{}
|
||||||
|
|
||||||
|
g1.Neg(Gen1)
|
||||||
|
g2.Add(g1, Gen1)
|
||||||
|
if !g2.p.IsInfinity() {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
g3 := &G1{}
|
||||||
|
g3.Set(Gen1)
|
||||||
|
if !g3.Equal(Gen1) {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type g1BaseMultTest struct {
|
type g1BaseMultTest struct {
|
||||||
k string
|
k string
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,21 @@ func TestScaleMult(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestG2AddNeg(t *testing.T) {
|
||||||
|
g1, g2 := &G2{}, &G2{}
|
||||||
|
|
||||||
|
g1.Neg(Gen2)
|
||||||
|
g2.Add(g1, Gen2)
|
||||||
|
if !g2.p.IsInfinity() {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
g3 := &G2{}
|
||||||
|
g3.Set(Gen2)
|
||||||
|
if !g3.Equal(Gen2) {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkG2(b *testing.B) {
|
func BenchmarkG2(b *testing.B) {
|
||||||
x, _ := rand.Int(rand.Reader, Order)
|
x, _ := rand.Int(rand.Reader, Order)
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
|
@ -100,13 +100,6 @@ func (e *gfP12) IsOne() bool {
|
|||||||
return e.x.IsZero() && e.y.IsZero() && e.z.IsOne()
|
return e.x.IsZero() && e.y.IsZero() && e.z.IsOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *gfP12) Neg(a *gfP12) *gfP12 {
|
|
||||||
e.x.Neg(&a.x)
|
|
||||||
e.y.Neg(&a.y)
|
|
||||||
e.z.Neg(&a.z)
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *gfP12) Add(a, b *gfP12) *gfP12 {
|
func (e *gfP12) Add(a, b *gfP12) *gfP12 {
|
||||||
e.x.Add(&a.x, &b.x)
|
e.x.Add(&a.x, &b.x)
|
||||||
e.y.Add(&a.y, &b.y)
|
e.y.Add(&a.y, &b.y)
|
||||||
|
@ -68,15 +68,6 @@ func (e *GT) Add(a, b *GT) *GT {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
// Neg sets e to -a and then returns e.
|
|
||||||
func (e *GT) Neg(a *GT) *GT {
|
|
||||||
if e.p == nil {
|
|
||||||
e.p = &gfP12{}
|
|
||||||
}
|
|
||||||
e.p.Neg(a.p) // TODO: fix it.
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set sets e to a and then returns e.
|
// Set sets e to a and then returns e.
|
||||||
func (e *GT) Set(a *GT) *GT {
|
func (e *GT) Set(a *GT) *GT {
|
||||||
if e.p == nil {
|
if e.p == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user