This updates the libsecp256k1 subtree to upstream master, and switches ECDSA validation to it.
Practical upshot:
- Signature validation is anywhere between 2.5 and 5.5 times faster.
- Consensus code no longer depends on OpenSSL or its signature parser.
- Removes linking with OpenSSL from libconsensus.
Libsecp256k1 itself has not had a stable release, but we’re very close to that. This PR is effectively a preview, with the intention of switching to the released version before the Bitcoin Core 0.12 release.
The past months libsecp256k1 has undergone very extensive testing and validation, though some of that work is still under review. This includes:
- Very high branch coverage (which required generating a trillion random test vectors and strip them down to the 32 which collectively give the highest coverage for the scalar arithmetic code)
- Formal proofs for the group laws using SAGE, and human-verifiable proof annotations for the field arithmetic logic.
- Test code that generates random valid DER signatures, fuzzes them, and compares the result of parsing them internally and using OpenSSL - which turned up a set of (to me) previously unknown behaviour in OpenSSL’s parser.
- The ability to compile in a test mode which switches to a slightly different curve (one constant change), resulting in a group of only 139 points instead of around 2256, allowing exhaustive testing of nearly all code.
The above things are planned to be finished before final release, as well as some API changes - though probably none that affect Bitcoin’s usage.
Thanks to everyone who contributed so far (including but not limited to @gmaxwell, @apoelstra, @peterdettman, @theuni, @luke-jr, …).