mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Move common sanity check code to init/common
This commit is contained in:
parent
a67b54855b
commit
387c4cf588
3 changed files with 31 additions and 26 deletions
|
|
@ -2,11 +2,15 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <compat/sanity.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <key.h>
|
||||
#include <logging.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <pubkey.h>
|
||||
#include <random.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
@ -27,4 +31,24 @@ void UnsetGlobals()
|
|||
globalVerifyHandle.reset();
|
||||
ECC_Stop();
|
||||
}
|
||||
|
||||
bool SanityChecks()
|
||||
{
|
||||
if (!ECC_InitSanityCheck()) {
|
||||
return InitError(Untranslated("Elliptic curve cryptography sanity check failure. Aborting."));
|
||||
}
|
||||
|
||||
if (!glibcxx_sanity_test())
|
||||
return false;
|
||||
|
||||
if (!Random_SanityCheck()) {
|
||||
return InitError(Untranslated("OS cryptographic RNG sanity check failure. Aborting."));
|
||||
}
|
||||
|
||||
if (!ChronoSanityCheck()) {
|
||||
return InitError(Untranslated("Clock epoch mismatch. Aborting."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace init
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue