Commit Graph

16 Commits

Author SHA1 Message Date
surtur 29f7ebd529
sfm: new seed_f_path "/var/tmp/.fortuna.seed" 2022-02-07 23:16:03 +01:00
surtur 8cafbc7706
fix: -Wextra-semi 2022-02-03 00:49:40 +01:00
surtur f48927738d
sfm: assert checkup_interval < seed_write_interval 2022-01-23 20:27:14 +01:00
surtur 8b9fbe1e1e
sfm: add get_write_interval() const member func. 2022-01-23 20:18:59 +01:00
surtur b8f76886eb
sfm: make write_interval const, as in unchanging 2022-01-23 20:17:36 +01:00
surtur 52de785399
fortuna: properly handle reseeds
* move reseed_ctr and related member functions to Accumulator

* create a std::shared_ptr<Accumulator> to Fortuna's internal
  Accumulator object and feed that into SeedFileManager instead of a
  reference, which used to get copied to a new object in SeedFileManager

* make Accumulator non-copyable, since it's only to be created once.
  instead, a shared_ptr is used to facilitate multiple-access

* handle concurrency in Accumulator as the reseed_ctr-related functions
  can now be accessed from both Fortuna and SeedFileManager, declare mtx
  as mutable (since it's also used in a const function)

* use std::scoped_lock in 'initialize_prng()' to safely lock both mutexes
2022-01-22 18:36:51 +01:00
surtur 660afa8d5e
sfm(th): make is_job_running() const 2022-01-21 05:35:47 +01:00
surtur b5bf269494
sfm(th): add mtx,locks,l_guards;IS_RUNNING->atomic 2022-01-21 05:32:23 +01:00
surtur 246995dab3
sfm: fix reads,writes of the seed file, refactor 2022-01-20 05:36:06 +01:00
surtur d6e97e3fda
SeedFileManager: initialize RUNNING with constinit 2022-01-13 06:18:43 +01:00
surtur 15798773a9
SeedFileManager: mark ctor explicit 2022-01-13 06:08:40 +01:00
surtur 226a5c2c6c
sfm: improve the job "RUNNING" logic, use static 2022-01-13 02:49:45 +01:00
surtur 4b216a6f6e
refactor: clang-format 2022-01-10 04:25:03 +01:00
surtur 795b9ffe54
add proper SeedFileManager implementation
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)
2022-01-09 11:58:38 +01:00
surtur 81e627998e
refactor(SeedFileManager) 2021-12-29 04:51:40 +01:00
surtur 129516a48f
add seed_file_management.h holding SeedFileManager 2021-12-13 05:59:27 +01:00