From 35120930afc966b8a07b4ca8e7648cdced13a207 Mon Sep 17 00:00:00 2001 From: MariusVanDerWijden Date: Tue, 17 Jun 2025 22:00:54 +0200 Subject: [PATCH] crypto/bn256/google: align behavior --- crypto/bn256/google/bn256.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/bn256/google/bn256.go b/crypto/bn256/google/bn256.go index aca9cf62de..e427b8bf42 100644 --- a/crypto/bn256/google/bn256.go +++ b/crypto/bn256/google/bn256.go @@ -128,7 +128,7 @@ func (e *G1) Marshal() []byte { func (e *G1) Unmarshal(m []byte) ([]byte, error) { // Each value is a 256-bit number. const numBytes = 256 / 8 - if len(m) != 2*numBytes { + if len(m) < 2*numBytes { return nil, errors.New("bn256: not enough data") } // Unmarshal the points and check their caps @@ -253,7 +253,7 @@ func (n *G2) Marshal() []byte { func (e *G2) Unmarshal(m []byte) ([]byte, error) { // Each value is a 256-bit number. const numBytes = 256 / 8 - if len(m) != 4*numBytes { + if len(m) < 4*numBytes { return nil, errors.New("bn256: not enough data") } // Unmarshal the points and check their caps