Previously, when g.p == nil, String() crashed. In other method like Add(),
a point with g.p == nil is treated as an identity element.
Besides, the following code is the only way to get an identity element
outside the library: g := bn256.G1{}. In this situation, g.p == nil.
For example, the following code will crash:
package main
import (
"fmt"
"golang.org/x/crypto/bn256"
)
func main() {
g := bn256.G1{}
fmt.Println(g.String())
}
Change-Id: Ied6f7c8197e7b79b0913c000a9cf1cf68f8188a9
GitHub-Last-Rev: 23246486a982ea54d6023726e048c74f02089f25
GitHub-Pull-Request: golang/crypto#75
Reviewed-on: https://go-review.googlesource.com/c/163118
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Previously MulScalar was ignoring the first parameter, which was inconsistent with gfp6 and gfp2.
Change-Id: I4f4a4ca2f07a25176ab159be684a02696f1580ba
GitHub-Last-Rev: ec40c0403614ed56cf329102eb274dc776fa3be8
GitHub-Pull-Request: golang/crypto#67
Reviewed-on: https://go-review.googlesource.com/c/154457
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Just ran
gofmt -w .
on the project root. That's all.
Change-Id: Ia90223dda399c1df67e7bcf75c6773de63902cc8
GitHub-Last-Rev: 8ba80b96761b077a4e084a93d5f18e6b2f7375ad
GitHub-Pull-Request: golang/crypto#52
Reviewed-on: https://go-review.googlesource.com/119375
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When c = ∞, z = 0 and 0 does not have a modular inverse, triggering
undefined behavior (recently changed to returning nil) in ModInverse.
Unclear how this used to work anyway. Looks like ModInverse was
leaving the receiver untouched, making zInv = 0 when pool = nil.
Fixesgolang/go#25199
Change-Id: Ib39abf59f0e71cf43cdb5836142ebdd3b206fb3f
Reviewed-on: https://go-review.googlesource.com/110695
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
None are "wrong" per se, but there are a lot of good suggestions and
in one case a docstring that was not present in godoc due to the
presence of an extra newline.
Changed "Id" in struct properties to "ID" in some non-exported
structs. Removed a trailing period from some error messages; I believe
the exact contents of error strings are not covered by the Go
compatibility promise.
Change-Id: I7c620582dc247396f72c52d38c909ccc0ec87b83
Reviewed-on: https://go-review.googlesource.com/80145
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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
Package bn256 implements a particular bilinear group at the 128-bit
security level.
R=golang-dev, remyoudompheng, r, r, akumar
CC=golang-dev
https://golang.org/cl/6402052