From 4c5258d8b6be6789e3c5433562c226507dc1249f Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Thu, 22 Nov 2012 13:44:59 -0500 Subject: [PATCH] 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 --- bn256/bn256.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bn256/bn256.go b/bn256/bn256.go index 2a19a7e..bc96e3d 100644 --- a/bn256/bn256.go +++ b/bn256/bn256.go @@ -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 } }