plugeth/crypto/secp256k1
Marius van der Wijden 0703ef62d3
crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621)
This commit changes the behavior of BitCurve.Add to be more inline
with btcd. It fixes two different bugs:

1) When adding a point at infinity to another point, the other point
   should be returned. While this is undefined behavior, it is better
   to be more inline with the go standard library.
   Thus (0,0) + (a, b) = (a,b)

2) Adding the same point to itself produced the point at infinity.
   This is incorrect, now doubleJacobian is used to correctly calculate it.
   Thus (a,b) + (a,b) == 2* (a,b) and not (0,0) anymore.

The change also adds a differential fuzzer for Add, testing it against btcd.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-05-27 13:30:25 +02:00
..
libsecp256k1 crypto/secp256k1: add workaround for go mod vendor (#21735) 2020-12-08 10:47:56 +01:00
.gitignore Moved obscuren secp256k1-go 2015-01-22 00:35:00 +01:00
curve.go crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00
dummy.go crypto/secp256k1: add workaround for go mod vendor (#21735) 2020-12-08 10:47:56 +01:00
ext.h crypto/secp256k1: unify the package license to 3-Clause BSD (#17225) 2018-07-24 02:47:47 +02:00
LICENSE crypto/secp256k1: unify the package license to 3-Clause BSD (#17225) 2018-07-24 02:47:47 +02:00
panic_cb.go crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00
scalar_mult_cgo.go crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00
scalar_mult_nocgo.go crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00
secp256_test.go crypto/secp256k1: remove external LGPL dependencies (#17239) 2018-07-26 13:33:13 +02:00
secp256.go crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00