Reintroduce BLSInit to correctly set secure alloctor callbacks (#2543)

https://github.com/dashpay/dash/pull/2409 removed the need to call the
Init method of the Chia BLS library, but we also accidently removed the
initialization of the secure allocator.
This commit is contained in:
Alexander Block 2018-12-10 06:04:48 +01:00 committed by GitHub
parent d9b28fe1ad
commit 63b58b1e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View File

@ -19,6 +19,7 @@ main(int argc, char** argv)
ECC_Start();
ECCVerifyHandle verifyHandle;
BLSInit();
SetupEnvironment();
fPrintToDebugLog = false; // don't want to write to debug.log file

View File

@ -462,3 +462,11 @@ static void secure_free(void* p)
return get_secure_allocator().deallocate(ptr, n);
}
#endif
bool BLSInit()
{
#ifndef BUILD_BITCOIN_INTERNAL
bls::BLS::SetSecureAllocator(secure_allocate, secure_free);
#endif
return true;
}

View File

@ -300,4 +300,6 @@ typedef std::shared_ptr<BLSPublicKeyVector> BLSPublicKeyVectorPtr;
typedef std::shared_ptr<BLSSecretKeyVector> BLSSecretKeyVectorPtr;
typedef std::shared_ptr<BLSSignatureVector> BLSSignatureVectorPtr;
bool BLSInit();
#endif // DASH_CRYPTO_BLS_H

View File

@ -855,6 +855,10 @@ bool InitSanityCheck(void)
if (!glibc_sanity_test() || !glibcxx_sanity_test())
return false;
if (!BLSInit()) {
return false;
}
return true;
}

View File

@ -44,6 +44,7 @@ extern void noui_connect();
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
{
ECC_Start();
BLSInit();
SetupEnvironment();
SetupNetworking();
InitSignatureCache();