go.crypto/bn256: ensure that t is initialised correctly.
t caches the value of z squared, but wasn't getting correctly initialised when the value of z was reset. R=golang-dev CC=golang-dev https://golang.org/cl/6850091
This commit is contained in:
+5
-1
@@ -129,8 +129,11 @@ func (e *G1) Unmarshal(m []byte) (*G1, bool) {
|
||||
// This is the point at infinity.
|
||||
e.p.y.SetInt64(1)
|
||||
e.p.z.SetInt64(0)
|
||||
e.p.t.SetInt64(0)
|
||||
} else {
|
||||
e.p.z.SetInt64(1)
|
||||
e.p.t.SetInt64(1)
|
||||
|
||||
if !e.p.IsOnCurve() {
|
||||
return nil, false
|
||||
}
|
||||
@@ -243,11 +246,12 @@ func (e *G2) Unmarshal(m []byte) (*G2, bool) {
|
||||
// This is the point at infinity.
|
||||
e.p.y.SetOne()
|
||||
e.p.z.SetZero()
|
||||
e.p.t.SetZero()
|
||||
} else {
|
||||
e.p.z.SetOne()
|
||||
e.p.t.SetOne()
|
||||
|
||||
if !e.p.IsOnCurve() {
|
||||
println("X")
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user