Skip to content

Commit

Permalink
Merge pull request #6954
Browse files Browse the repository at this point in the history
6e18268 Switch to libsecp256k1-based validation for ECDSA (Pieter Wuille)
  • Loading branch information
laanwj committed Nov 16, 2015
2 parents dafefb7 + 6e18268 commit e54ebbf
Show file tree
Hide file tree
Showing 13 changed files with 291 additions and 398 deletions.
15 changes: 15 additions & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ calculating the target.
A more detailed documentation about keeping traffic low can be found in
[/doc/reducetraffic.md](/doc/reducetraffic.md).

Signature validation using libsecp256k1
---------------------------------------

ECDSA signatures inside Bitcoin transactions now use validation using
[https://github.com/bitcoin/secp256k1](libsecp256k1) instead of OpenSSL.

Depending on the platform, this means a significant speedup for raw signature
validation speed. The advantage is largest on x86_64, where validation is over
five times faster. In practice, this translates to a raw reindexing and new
block validation times that are less than half of what it was before.

Libsecp256k1 has undergone very extensive testing and validation.

A side effect of this change is that libconsensus no longer depends on OpenSSL.

0.12.0 Change log
=================

Expand Down
10 changes: 2 additions & 8 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ BITCOIN_CORE_H = \
consensus/validation.h \
core_io.h \
core_memusage.h \
eccryptoverify.h \
ecwrapper.h \
hash.h \
httprpc.h \
httpserver.h \
Expand Down Expand Up @@ -272,8 +270,6 @@ libbitcoin_common_a_SOURCES = \
compressor.cpp \
core_read.cpp \
core_write.cpp \
eccryptoverify.cpp \
ecwrapper.cpp \
hash.cpp \
key.cpp \
keystore.cpp \
Expand Down Expand Up @@ -404,8 +400,6 @@ libbitcoinconsensus_la_SOURCES = \
crypto/sha1.cpp \
crypto/sha256.cpp \
crypto/sha512.cpp \
eccryptoverify.cpp \
ecwrapper.cpp \
hash.cpp \
primitives/transaction.cpp \
pubkey.cpp \
Expand All @@ -420,8 +414,8 @@ if GLIBC_BACK_COMPAT
endif

libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)

endif
Expand Down
10 changes: 8 additions & 2 deletions src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,15 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)

class Secp256k1Init
{
ECCVerifyHandle globalVerifyHandle;

public:
Secp256k1Init() { ECC_Start(); }
~Secp256k1Init() { ECC_Stop(); }
Secp256k1Init() {
ECC_Start();
}
~Secp256k1Init() {
ECC_Stop();
}
};

static void MutateTx(CMutableTransaction& tx, const string& command,
Expand Down
68 changes: 0 additions & 68 deletions src/eccryptoverify.cpp

This file was deleted.

21 changes: 0 additions & 21 deletions src/eccryptoverify.h

This file was deleted.

218 changes: 0 additions & 218 deletions src/ecwrapper.cpp

This file was deleted.

Loading

0 comments on commit e54ebbf

Please sign in to comment.