mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
sm9/bn256: fix add same bug
This commit is contained in:
parent
b9bbf94b47
commit
bbbf2612bc
@ -133,7 +133,7 @@ func (c *curvePoint) Add(a, b *curvePoint) {
|
|||||||
|
|
||||||
gfpSub(t, s2, s1)
|
gfpSub(t, s2, s1)
|
||||||
|
|
||||||
if h.Equal(zero) == 1 && t.Equal(one) == 1 {
|
if h.Equal(zero) == 1 && t.Equal(zero) == 1 {
|
||||||
c.Double(a)
|
c.Double(a)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,16 @@ func TestG1AddNeg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestG1AddSame(t *testing.T) {
|
||||||
|
g1, g2 := &G1{}, &G1{}
|
||||||
|
g1.Add(Gen1, Gen1)
|
||||||
|
g2.Double(Gen1)
|
||||||
|
|
||||||
|
if !g1.Equal(g2) {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type g1BaseMultTest struct {
|
type g1BaseMultTest struct {
|
||||||
k string
|
k string
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user