Skip to content

Commit e54ebbf

Browse files
committed
Merge pull request #6954
6e18268 Switch to libsecp256k1-based validation for ECDSA (Pieter Wuille)
2 parents dafefb7 + 6e18268 commit e54ebbf

13 files changed

+291
-398
lines changed

doc/release-notes.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,21 @@ calculating the target.
190190
A more detailed documentation about keeping traffic low can be found in
191191
[/doc/reducetraffic.md](/doc/reducetraffic.md).
192192

193+
Signature validation using libsecp256k1
194+
---------------------------------------
195+
196+
ECDSA signatures inside Bitcoin transactions now use validation using
197+
[https://github.com/bitcoin/secp256k1](libsecp256k1) instead of OpenSSL.
198+
199+
Depending on the platform, this means a significant speedup for raw signature
200+
validation speed. The advantage is largest on x86_64, where validation is over
201+
five times faster. In practice, this translates to a raw reindexing and new
202+
block validation times that are less than half of what it was before.
203+
204+
Libsecp256k1 has undergone very extensive testing and validation.
205+
206+
A side effect of this change is that libconsensus no longer depends on OpenSSL.
207+
193208
0.12.0 Change log
194209
=================
195210

src/Makefile.am

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ BITCOIN_CORE_H = \
104104
consensus/validation.h \
105105
core_io.h \
106106
core_memusage.h \
107-
eccryptoverify.h \
108-
ecwrapper.h \
109107
hash.h \
110108
httprpc.h \
111109
httpserver.h \
@@ -272,8 +270,6 @@ libbitcoin_common_a_SOURCES = \
272270
compressor.cpp \
273271
core_read.cpp \
274272
core_write.cpp \
275-
eccryptoverify.cpp \
276-
ecwrapper.cpp \
277273
hash.cpp \
278274
key.cpp \
279275
keystore.cpp \
@@ -404,8 +400,6 @@ libbitcoinconsensus_la_SOURCES = \
404400
crypto/sha1.cpp \
405401
crypto/sha256.cpp \
406402
crypto/sha512.cpp \
407-
eccryptoverify.cpp \
408-
ecwrapper.cpp \
409403
hash.cpp \
410404
primitives/transaction.cpp \
411405
pubkey.cpp \
@@ -420,8 +414,8 @@ if GLIBC_BACK_COMPAT
420414
endif
421415

422416
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
423-
libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
424-
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
417+
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
418+
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
425419
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
426420

427421
endif

src/bitcoin-tx.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,15 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
477477

478478
class Secp256k1Init
479479
{
480+
ECCVerifyHandle globalVerifyHandle;
481+
480482
public:
481-
Secp256k1Init() { ECC_Start(); }
482-
~Secp256k1Init() { ECC_Stop(); }
483+
Secp256k1Init() {
484+
ECC_Start();
485+
}
486+
~Secp256k1Init() {
487+
ECC_Stop();
488+
}
483489
};
484490

485491
static void MutateTx(CMutableTransaction& tx, const string& command,

src/eccryptoverify.cpp

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/eccryptoverify.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/ecwrapper.cpp

Lines changed: 0 additions & 218 deletions
This file was deleted.

0 commit comments

Comments
 (0)