Skip to content

Commit

Permalink
Switch to libsecp256k1-based validation for ECDSA
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and str4d committed Jun 6, 2017
1 parent c1afe40 commit 3d02d0f
Show file tree
Hide file tree
Showing 13 changed files with 296 additions and 403 deletions.
20 changes: 20 additions & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(note: this is a temporary file, to be added-to by anybody, and moved to
release-notes at release time)

Notable changes
===============

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

ECDSA signatures inside Zcash 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 upstream.

A side effect of this change is that libconsensus no longer depends on OpenSSL.
10 changes: 2 additions & 8 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ BITCOIN_CORE_H = \
consensus/validation.h \
core_io.h \
core_memusage.h \
eccryptoverify.h \
deprecation.h \
ecwrapper.h \
hash.h \
httprpc.h \
httpserver.h \
Expand Down Expand Up @@ -326,8 +324,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 @@ -505,8 +501,6 @@ libzcashconsensus_la_SOURCES = \
crypto/sha1.cpp \
crypto/sha256.cpp \
crypto/sha512.cpp \
eccryptoverify.cpp \
ecwrapper.cpp \
hash.cpp \
primitives/transaction.cpp \
pubkey.cpp \
Expand All @@ -521,8 +515,8 @@ if GLIBC_BACK_COMPAT
endif

libzcashconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
libzcashconsensus_la_LIBADD = $(CRYPTO_LIBS)
libzcashconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
libzcashconsensus_la_LIBADD = $(LIBSECP256K1)
libzcashconsensus_la_CPPFLAGS = -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL

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 @@ -445,9 +445,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.

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

This file was deleted.

Loading

0 comments on commit 3d02d0f

Please sign in to comment.