Merge pull request #701 from rnicoll/1.8-dev-elliptic-curve
Fail with a friendlier message on missing OpenSSL EC support
This commit is contained in:
commit
038a247ff9
20
src/init.cpp
20
src/init.cpp
|
@ -392,6 +392,23 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
|||
}
|
||||
}
|
||||
|
||||
/** Sanity checks
|
||||
* Ensure that Dogecoin is running in a usable environment with all
|
||||
* necessary library support.
|
||||
*/
|
||||
bool InitSanityCheck(void)
|
||||
{
|
||||
if(!ECC_InitSanityCheck()) {
|
||||
InitError("OpenSSL appears to lack support for elliptic curve cryptography. For more "
|
||||
"information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries");
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: remaining sanity checks, see BitCoin issue #4081
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Initialize dogecoin.
|
||||
* @pre Parameters should be parsed and config file should be read.
|
||||
*/
|
||||
|
@ -612,6 +629,9 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||
strWalletFile = GetArg("-wallet", "wallet.dat");
|
||||
#endif
|
||||
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
||||
// Sanity check
|
||||
if (!InitSanityCheck())
|
||||
return InitError(_("Initialization sanity check failed. Dogecoin Core is shutting down."));
|
||||
|
||||
std::string strDataDir = GetDataDir().string();
|
||||
#ifdef ENABLE_WALLET
|
||||
|
|
12
src/key.cpp
12
src/key.cpp
|
@ -656,3 +656,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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue