Skip to content

Commit 486bc52

Browse files
DavidHuiemariameda
authored andcommitted
crypto/secp256k1: catch curve parameter parse errors (ethereum#16392)
1 parent 65e51b2 commit 486bc52

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crypto/secp256k1/curve.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ func init() {
290290
// See SEC 2 section 2.7.1
291291
// curve parameters taken from:
292292
// http://www.secg.org/collateral/sec2_final.pdf
293-
theCurve.P, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16)
294-
theCurve.N, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 16)
295-
theCurve.B, _ = new(big.Int).SetString("0000000000000000000000000000000000000000000000000000000000000007", 16)
296-
theCurve.Gx, _ = new(big.Int).SetString("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16)
297-
theCurve.Gy, _ = new(big.Int).SetString("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 16)
293+
theCurve.P = math.MustParseBig256("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F")
294+
theCurve.N = math.MustParseBig256("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141")
295+
theCurve.B = math.MustParseBig256("0x0000000000000000000000000000000000000000000000000000000000000007")
296+
theCurve.Gx = math.MustParseBig256("0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798")
297+
theCurve.Gy = math.MustParseBig256("0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8")
298298
theCurve.BitSize = 256
299299
}
300300

0 commit comments

Comments
 (0)