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()() ...@@ -115,6 +115,17 @@ Random::operator()()
return uint64_from_buffer (&cipher_text[0]); 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 void
Random::set_global_test_key (uint64_t key) Random::set_global_test_key (uint64_t key)
{ {
......
...@@ -17,18 +17,9 @@ public: ...@@ -17,18 +17,9 @@ public:
}; };
private: private:
gcry_cipher_hd_t aes_ctr_cipher; 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); std::vector<unsigned char> get_start_counter (uint64_t seed, Stream stream);
void die_on_error (const char *func, gcry_error_t error);
public: public:
Random (uint64_t seed, Stream stream); Random (uint64_t seed, Stream stream);
~Random(); ~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