aboutsummaryrefslogtreecommitdiff
path: root/src/key.cpp
diff options
context:
space:
mode:
authorAndrew Poelstra <asp11@sfu.ca>2014-06-02 16:21:03 -0700
committerAndrew Poelstra <asp11@sfu.ca>2014-06-03 12:09:51 -0700
commit4a09e1df51267c6d2dec219c6f96a24b716cc251 (patch)
tree52a07bc8e7880c7ff0b7bec11083926b7bdd64f4 /src/key.cpp
parent52d7a544342b20fbf0d8b97796923455a400d282 (diff)
key.cpp: fail with a friendlier message on missing ssl EC support
Previously if bitcoind is linked with an OpenSSL which is compiled without EC support, this is seen as an assertion failure "pKey != NULL" at key.cpp:134, which occurs after several seconds. It is an esoteric piece of knowledge to interpret this as "oops, I linked with the wrong OpenSSL", and because of the delay it may not even be noticed. The new output is : OpenSSL appears to lack support for elliptic curve cryptography. For more information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries : Initialization sanity check failed. Bitcoin Core is shutting down. which occurs immediately after attempted startup. This also blocks in an InitSanityCheck() function which currently only checks for EC support but should eventually do more. See #4081.
Diffstat (limited to 'src/key.cpp')
-rw-r--r--src/key.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp
index aa24f0a622..4747beffb4 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -631,3 +631,15 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int nChild) const {
out.nChild = nChild;
return pubkey.Derive(out.pubkey, out.vchChainCode, nChild, vchChainCode);
}
+
+bool ECC_InitSanityCheck() {
+ EC_KEY *pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
+ if(pkey == NULL)
+ return false;
+ EC_KEY_free(pkey);
+
+ // TODO Is there more EC functionality that could be missing?
+ return true;
+}
+
+