diff --git a/src/bench/bench_dash.cpp b/src/bench/bench_dash.cpp index 82b1cf3b3ebd..a1d208502470 100644 --- a/src/bench/bench_dash.cpp +++ b/src/bench/bench_dash.cpp @@ -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 diff --git a/src/bls/bls.cpp b/src/bls/bls.cpp index 02a793551866..bb44f50296ac 100644 --- a/src/bls/bls.cpp +++ b/src/bls/bls.cpp @@ -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; +} diff --git a/src/bls/bls.h b/src/bls/bls.h index f62ab67566a4..c50a96ee11ec 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -300,4 +300,6 @@ typedef std::shared_ptr BLSPublicKeyVectorPtr; typedef std::shared_ptr BLSSecretKeyVectorPtr; typedef std::shared_ptr BLSSignatureVectorPtr; +bool BLSInit(); + #endif // DASH_CRYPTO_BLS_H diff --git a/src/init.cpp b/src/init.cpp index a66c23991157..5bf399197a24 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -855,6 +855,10 @@ bool InitSanityCheck(void) if (!glibc_sanity_test() || !glibcxx_sanity_test()) return false; + if (!BLSInit()) { + return false; + } + return true; } diff --git a/src/test/test_dash.cpp b/src/test/test_dash.cpp index 7bc3f7e9f734..5300171d1247 100644 --- a/src/test/test_dash.cpp +++ b/src/test/test_dash.cpp @@ -44,6 +44,7 @@ extern void noui_connect(); BasicTestingSetup::BasicTestingSetup(const std::string& chainName) { ECC_Start(); + BLSInit(); SetupEnvironment(); SetupNetworking(); InitSignatureCache();