aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-04-22 14:28:26 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2015-05-04 14:45:34 +0200
commita56054be650052361e8de79f0f03a56a043759e5 (patch)
tree05aec96814359918e9a87b6035e037bce5257e2a /src/init.cpp
parent4dda253190e6f5ac6728e88fefdf6e8eaf41419c (diff)
Update key.cpp to use new libsecp256k1
libsecp256k1's API changed, so update key.cpp to use it. Libsecp256k1 now has explicit context objects, which makes it completely thread-safe. In turn, keep an explicit context object in key.cpp, which is explicitly initialized destroyed. This is not really pretty now, but it's more efficient than the static initialized object in key.cpp (which made for example bitcoin-tx slow, as for most of its calls, libsecp256k1 wasn't actually needed). This also brings in the new blinding support in libsecp256k1. By passing in a random seed, temporary variables during the elliptic curve computations are altered, in such a way that if an attacker does not know the blind, observing the internal operations leaks less information about the keys used. This was implemented by Greg Maxwell.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 665aebe1c5..854d8e94dd 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -194,6 +194,7 @@ void Shutdown()
delete pwalletMain;
pwalletMain = NULL;
#endif
+ ECC_Stop();
LogPrintf("%s: done\n", __func__);
}
@@ -788,6 +789,9 @@ bool AppInit2(boost::thread_group& threadGroup)
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
+ // Initialize elliptic curve code
+ ECC_Start();
+
// Sanity check
if (!InitSanityCheck())
return InitError(_("Initialization sanity check failed. Bitcoin Core is shutting down."));