Moving random_pool in to secure.
This commit is contained in:
parent
61f08a3351
commit
c6d407e32d
5 changed files with 34 additions and 29 deletions
|
@ -9,9 +9,12 @@
|
|||
|
||||
#include <cryptopp/osrng.h>
|
||||
|
||||
namespace rai
|
||||
{
|
||||
extern CryptoPP::AutoSeededRandomPool random_pool;
|
||||
}
|
||||
|
||||
void ed25519_randombytes_unsafe (void * out, size_t outlen)
|
||||
{
|
||||
random_pool.GenerateBlock (reinterpret_cast <uint8_t *> (out), outlen);
|
||||
rai::random_pool.GenerateBlock (reinterpret_cast <uint8_t *> (out), outlen);
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
#include <rai/core/core.hpp>
|
||||
|
||||
#include <cryptopp/osrng.h>
|
||||
|
||||
#include <ed25519-donna/ed25519.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
@ -55,18 +53,8 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
CryptoPP::AutoSeededRandomPool random_pool;
|
||||
std::chrono::seconds constexpr rai::processor::period;
|
||||
std::chrono::seconds constexpr rai::processor::cutoff;
|
||||
namespace {
|
||||
std::string rai_test_private_key = "E49C03BB7404C10B388AE56322217306B57F3DCBB3A5F060A2F420AD7AA3F034";
|
||||
std::string rai_test_public_key = "1149338F7D0DA66D7ED0DAA4F1F72431831B3D06AFC704F3224D68B317CC41B2";
|
||||
std::string rai_live_public_key = "0";
|
||||
}
|
||||
rai::keypair rai::test_genesis_key (rai_test_private_key);
|
||||
rai::address rai::rai_test_address (rai_test_public_key);
|
||||
rai::address rai::rai_live_address (rai_live_public_key);
|
||||
rai::address rai::genesis_address (GENESIS_KEY);
|
||||
|
||||
void hash_number (CryptoPP::SHA3 & hash_a, boost::multiprecision::uint256_t const & number_a)
|
||||
{
|
||||
|
|
|
@ -556,20 +556,6 @@ namespace rai {
|
|||
>
|
||||
> peers;
|
||||
};
|
||||
extern rai::keypair test_genesis_key;
|
||||
extern rai::address rai_test_address;
|
||||
extern rai::address rai_live_address;
|
||||
extern rai::address genesis_address;
|
||||
class genesis
|
||||
{
|
||||
public:
|
||||
explicit genesis ();
|
||||
void initialize (rai::block_store &) const;
|
||||
rai::block_hash hash () const;
|
||||
rai::send_block send1;
|
||||
rai::send_block send2;
|
||||
rai::open_block open;
|
||||
};
|
||||
class log
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <cryptopp/aes.h>
|
||||
#include <cryptopp/modes.h>
|
||||
|
||||
CryptoPP::AutoSeededRandomPool rai::random_pool;
|
||||
|
||||
void rai::uint256_union::digest_password (std::string const & password_a)
|
||||
{
|
||||
CryptoPP::SHA3 hash (32);
|
||||
|
@ -1861,4 +1863,14 @@ rai::uint256_union rai::vote::hash () const
|
|||
rai::uint256_t rai::votes::flip_threshold ()
|
||||
{
|
||||
return ledger.supply () / 2;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::string rai_test_private_key = "E49C03BB7404C10B388AE56322217306B57F3DCBB3A5F060A2F420AD7AA3F034";
|
||||
std::string rai_test_public_key = "1149338F7D0DA66D7ED0DAA4F1F72431831B3D06AFC704F3224D68B317CC41B2";
|
||||
std::string rai_live_public_key = "0";
|
||||
}
|
||||
rai::keypair rai::test_genesis_key (rai_test_private_key);
|
||||
rai::address rai::rai_test_address (rai_test_public_key);
|
||||
rai::address rai::rai_live_address (rai_live_public_key);
|
||||
rai::address rai::genesis_address (GENESIS_KEY);
|
|
@ -3,6 +3,7 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
#include <cryptopp/osrng.h>
|
||||
#include <cryptopp/sha3.h>
|
||||
|
||||
#include <leveldb/db.h>
|
||||
|
@ -13,6 +14,7 @@
|
|||
|
||||
namespace rai
|
||||
{
|
||||
extern CryptoPP::AutoSeededRandomPool random_pool;
|
||||
using stream = std::basic_streambuf <uint8_t>;
|
||||
using bufferstream = boost::iostreams::stream_buffer <boost::iostreams::basic_array_source <uint8_t>>;
|
||||
using vectorstream = boost::iostreams::stream_buffer <boost::iostreams::back_insert_device <std::vector <uint8_t>>>;
|
||||
|
@ -453,5 +455,19 @@ namespace rai
|
|||
std::unique_ptr <rai::block> last_winner;
|
||||
uint64_t sequence;
|
||||
std::unordered_map <rai::address, std::pair <uint64_t, std::unique_ptr <rai::block>>> rep_votes;
|
||||
};
|
||||
};
|
||||
extern rai::keypair test_genesis_key;
|
||||
extern rai::address rai_test_address;
|
||||
extern rai::address rai_live_address;
|
||||
extern rai::address genesis_address;
|
||||
class genesis
|
||||
{
|
||||
public:
|
||||
explicit genesis ();
|
||||
void initialize (rai::block_store &) const;
|
||||
rai::block_hash hash () const;
|
||||
rai::send_block send1;
|
||||
rai::send_block send2;
|
||||
rai::open_block open;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue