op-geth/crypto
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
..
blake2b crypto/blake2b: fix 386, round 2 2019-08-22 12:24:11 +03:00
bls12381 all: remove unneeded parentheses (#21921) 2021-02-02 11:32:44 +02:00
bn256 common,crypto: move fuzzers out of core (#22029) 2020-12-23 17:44:45 +01:00
ecies crypto/ecies: improve concatKDF (#20836) 2020-04-03 11:57:24 +02:00
secp256k1 crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) 2021-05-27 13:30:25 +02:00
signify all: remove unneeded parentheses (#21921) 2021-02-02 11:32:44 +02:00
crypto.go core: implement background trie prefetcher 2021-01-21 01:46:38 +02:00
crypto_test.go core: implement background trie prefetcher 2021-01-21 01:46:38 +02:00
signature_cgo.go crypto: add SignatureLength constant and use it everywhere (#19996) 2019-08-22 15:14:06 +02:00
signature_nocgo.go crypto: add SignatureLength constant and use it everywhere (#19996) 2019-08-22 15:14:06 +02:00
signature_test.go crypto: ensure that VerifySignature rejects malleable signatures (#15708) 2017-12-20 14:30:00 +02:00