• Marius van der Wijden's avatar
    crypto/secp256k1: fix undefined behavior in BitCurve.Add (#22621) · 0703ef62
    Marius van der Wijden authored
    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: 's avatarFelix Lange <fjl@twurst.com>
    0703ef62
Name
Last commit
Last update
..
abi Loading commit data...
bitutil Loading commit data...
bls12381 Loading commit data...
bn256 Loading commit data...
difficulty Loading commit data...
keystore Loading commit data...
les Loading commit data...
rangeproof Loading commit data...
rlp Loading commit data...
runtime Loading commit data...
secp256k1 Loading commit data...
stacktrie Loading commit data...
trie Loading commit data...
txfetcher Loading commit data...
vflux Loading commit data...
README.md Loading commit data...