generator: add more try-catch blocks internally
All checks were successful
continuous-integration/drone/push Build is passing

one around initialization and another when calling reseed()
This commit is contained in:
surtur 2021-12-05 03:13:47 +01:00
parent cf0e548315
commit 53645ea160
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -34,10 +34,21 @@ Generator::~Generator() = default;
void Generator::initialize_generator(){
std::memset(G.k, 0x00, G.k.size());
G.ctr = 0;
fmt::print("Generator initialized\n");
reseed("fortuna");
try {
std::memset(G.k, 0x00, G.k.size());
G.ctr = 0;
fmt::print("Generator initialized\n");
} catch(CryptoPP::Exception& e) {
fmt::print(stderr, "{}\n", e.what());
exit(1);
}
try {
// FIXME: hardcoded seed for the time being
reseed("fortuna");
} catch(CryptoPP::Exception& e) {
fmt::print(stderr, "{}\n", e.what());
exit(1);
}
};
auto Generator::get_state() -> G_state {