in fortuna, print the random bytes as they come, without a newline, to
stdout. the idea is it can be directly piped to, say, dieharder, for,
e.g. testing purposes. also print info msg to stderr as is now customary
throughout the program.
a couple of fixes/necessary additions were made along the way, namely:
* add a default constructor for DoTask
* rework of the mutex/lock_guard/unique_lock logic in generator/fortuna
* add .fortuna.seed to the list of the ignored (.gitignore)
* add helper function to util for convertin bytes to blocks (16b==block)
* add a wrapper for around the SeedFileManager instance and a way to see
if it's dead or alive (so that it can be restarted if needed)
* the timeout for saving of the seed file has been decreased to a more
reasonable value than 10 minutes (I wouldn't want to lose potentially
up to 10 minutes worth of entropy)
* rm duplicate do_sha() code, consolidate in Util
* make reseed() public so that it can be called from outside
* rm reseed() from do_crypto() where it has no place
* use try-catch whenever possible
* perform memcpy operations in the right direction
* make greater use of local constants
* use more of the braced initializations
* there were memcpy operations of incorrect sizes in place, particularly
in regard to generator key (G.k) and counter (G.ctr), which resulted
in key bytes being set to garbage
commit a64b52e5a4
Author: surtur <a_mirre@utb.cz>
Date: Sun Nov 21 23:39:30 2021 +0100
finalise generator
this commit adds a (nearly) complete implementation of the generator.
* wrap calls to generator in a fortuna class method random_data
* calls generator's method generate_random_data, that internally calls
generate_blocks
* use a proper 256bit key in G_state
* add reseed method implementation
* call a reseed in initialize_generator
* do_sha returns proper digest now
* add proper do_crypto implementation
* call generate_blocks internally
* handle re-keying
* optimise header includes
TODO: there are still many commented (enabled on demand) debugging statements
-> TO BE REMOVED