aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/elliptic/elliptic.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-02-11 14:58:56 +0000
committerCherry Mui <cherryyz@google.com>2022-02-11 14:58:56 +0000
commite90b835f3071f1eb71810a3631b792f23df59f24 (patch)
treedc5a1c1620f14dbc051402095af9c024bc12a202 /src/crypto/elliptic/elliptic.go
parentbb93480d009322886df6f5185c988d6d21fdc2c8 (diff)
parent0a6cf8706fdd0fe1bd26e4d1ecbcd41650bf5e6c (diff)
downloadgo-e90b835f3071f1eb71810a3631b792f23df59f24.tar.gz
go-e90b835f3071f1eb71810a3631b792f23df59f24.zip
[dev.boringcrypto.go1.16] all: merge go1.16.14 into dev.boringcrypto.go1.16
Change-Id: I186a567b3e76df7ecf1842634a3851eab7c9dfce
Diffstat (limited to 'src/crypto/elliptic/elliptic.go')
-rw-r--r--src/crypto/elliptic/elliptic.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/crypto/elliptic/elliptic.go b/src/crypto/elliptic/elliptic.go
index f93dc16419..afedf18df1 100644
--- a/src/crypto/elliptic/elliptic.go
+++ b/src/crypto/elliptic/elliptic.go
@@ -71,6 +71,11 @@ func (curve *CurveParams) polynomial(x *big.Int) *big.Int {
}
func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool {
+ if x.Sign() < 0 || x.Cmp(curve.P) >= 0 ||
+ y.Sign() < 0 || y.Cmp(curve.P) >= 0 {
+ return false
+ }
+
// y² = x³ - 3x + b
y2 := new(big.Int).Mul(y, y)
y2.Mod(y2, curve.P)