crypto/cloudflare/bn256: fix in-place addition and unmarshalling (#23419)

This commit is contained in:
Guillaume Ballet
2021-08-25 17:33:09 +02:00
committed by GitHub
parent d16214228f
commit 887902ea4d
4 changed files with 20 additions and 6 deletions

View File

@ -61,6 +61,7 @@ func (e *gfP) Marshal(out []byte) {
func (e *gfP) Unmarshal(in []byte) error {
// Unmarshal the bytes into little endian form
for w := uint(0); w < 4; w++ {
e[3-w] = 0
for b := uint(0); b < 8; b++ {
e[3-w] += uint64(in[8*w+b]) << (56 - 8*b)
}