Remove the state file for the random number generator

This commit is contained in:
Markus Teufelberger
2018-11-03 16:18:03 +01:00
committed by Nik Bougalis
parent cb71d493a0
commit 5e96da51f9
5 changed files with 0 additions and 118 deletions

View File

@@ -30,7 +30,6 @@
#include <ripple/core/DatabaseCon.h>
#include <ripple/core/TerminateHandler.h>
#include <ripple/core/TimeKeeper.h>
#include <ripple/crypto/csprng.h>
#include <ripple/json/to_string.h>
#include <ripple/net/RPCCall.h>
#include <ripple/resource/Fees.h>
@@ -68,15 +67,6 @@ namespace po = boost::program_options;
namespace ripple {
boost::filesystem::path
getEntropyFile(Config const& config)
{
auto const path = config.legacy("database_path");
if (path.empty ())
return {};
return boost::filesystem::path (path) / "random.seed";
}
bool
adjustDescriptorLimit(int needed, beast::Journal j)
{
@@ -489,13 +479,6 @@ int run (int argc, char** argv)
config->setup (configFile, bool (vm.count ("quiet")),
bool(vm.count("silent")), bool(vm.count("standalone")));
{
// Stir any previously saved entropy into the pool:
auto entropy = getEntropyFile (*config);
if (!entropy.empty ())
crypto_prng().load_state(entropy.string ());
}
if (vm.count("vacuum"))
{
DatabaseCon::Setup dbSetup = setup_DatabaseCon(*config);
@@ -738,11 +721,6 @@ int run (int argc, char** argv)
// Block until we get a stop RPC.
app->run();
// Try to write out some entropy to use the next time we start.
auto entropy = getEntropyFile (app->config());
if (!entropy.empty ())
crypto_prng().save_state(entropy.string ());
return 0;
}

View File

@@ -81,9 +81,6 @@ public:
/** Returns the full path and filename of the debug log file. */
boost::filesystem::path getDebugLogFile () const;
/** Returns the full path and filename of the entropy seed file. */
boost::filesystem::path getEntropyFile () const;
private:
boost::filesystem::path CONFIG_FILE;
public:

View File

@@ -61,14 +61,6 @@ public:
void
mix_entropy (void* buffer = nullptr, std::size_t count = 0);
/** Load entropy from the specified file */
void
load_state (std::string const& file);
/** Save entropy to the specified file */
void
save_state (std::string const& file);
/** Generate a random integer */
result_type
operator()();

View File

@@ -50,27 +50,6 @@ csprng_engine::~csprng_engine ()
RAND_cleanup ();
}
void
csprng_engine::load_state (std::string const& file)
{
if (!file.empty())
{
std::lock_guard<std::mutex> lock (mutex_);
RAND_load_file (file.c_str (), kilobytes(1));
RAND_write_file (file.c_str ());
}
}
void
csprng_engine::save_state (std::string const& file)
{
if (!file.empty())
{
std::lock_guard<std::mutex> lock (mutex_);
RAND_write_file (file.c_str ());
}
}
void
csprng_engine::mix_entropy (void* buffer, std::size_t count)
{