aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/bn256/cloudflare/bn256.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/bn256/cloudflare/bn256.go b/crypto/bn256/cloudflare/bn256.go
index c6ea2d07e..38822a76b 100644
--- a/crypto/bn256/cloudflare/bn256.go
+++ b/crypto/bn256/cloudflare/bn256.go
@@ -100,6 +100,10 @@ func (e *G1) Marshal() []byte {
// Each value is a 256-bit number.
const numBytes = 256 / 8
+ if e.p == nil {
+ e.p = &curvePoint{}
+ }
+
e.p.MakeAffine()
ret := make([]byte, numBytes*2)
if e.p.IsInfinity() {
@@ -382,6 +386,11 @@ func (e *GT) Marshal() []byte {
// Each value is a 256-bit number.
const numBytes = 256 / 8
+ if e.p == nil {
+ e.p = &gfP12{}
+ e.p.SetOne()
+ }
+
ret := make([]byte, numBytes*12)
temp := &gfP{}