Commit 08fb48f5 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Cleanup Random::die_on_error.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent ded2bdf1
......@@ -115,6 +115,17 @@ Random::operator()()
return uint64_from_buffer (&cipher_text[0]);
}
void
Random::die_on_error (const char *func, gcry_error_t error)
{
if (error)
{
fprintf (stderr, "%s failed: %s/%s\n", func, gcry_strsource (error), gcry_strerror (error));
exit (1); /* can't recover here */
}
}
void
Random::set_global_test_key (uint64_t key)
{
......
......@@ -17,18 +17,9 @@ public:
};
private:
gcry_cipher_hd_t aes_ctr_cipher;
void
die_on_error (const char *func, gcry_error_t error)
{
if (error)
{
fprintf (stderr, "%s failed: %s/%s\n", func, gcry_strsource (error), gcry_strerror (error));
exit (1); /* can't recover here */
}
}
std::vector<unsigned char> get_start_counter (uint64_t seed, Stream stream);
void die_on_error (const char *func, gcry_error_t error);
public:
Random (uint64_t seed, Stream stream);
~Random();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment