Commit Graph

23 Commits

Author SHA1 Message Date
surtur c0933d355d
fortuna: improve mtx handling, introduce accu_mtx 2022-01-14 08:52:51 +01:00
surtur 879a8c69d3
fortuna: add urandom_entropy_src_service prototype 2022-01-13 07:19:52 +01:00
surtur 6a2362be37
fortuna: ++(informative value of print messages) 2022-01-13 06:50:37 +01:00
surtur bdfd64475f
fortuna: improve PRNG initialization mutex logic 2022-01-13 06:41:57 +01:00
surtur a0df93c9ec
clang-format: BinPack{Arguments,Parameters}: false 2022-01-13 06:04:18 +01:00
surtur 8c3aee1b07
fortuna: use a proper shared_ptr to Generator 2022-01-13 03:02:31 +01:00
surtur 4d0785b002
generator::R_state: make ctor,dtor noexcept 2022-01-13 01:51:33 +01:00
surtur 3553968d52
fortuna: add accumulator service,thread 2022-01-10 07:57:11 +01:00
surtur 1817b4a82e
fortuna: add print mutex, impl with unique_lock
* used for orderly printing to screen, currently only used by the two of
  the services: generator_service and seed_file_manager_service
* lock the mutex in a unique_lock only when printing to screen, unlock
  it immediately after printing is done
* use proper chrono type for sleep_time (instead of uint)
* also, generator_service is no longer a static method
2022-01-10 07:43:55 +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 06db22bfa4
fortuna: add seed_file_manager_service() [wip] 2022-01-04 06:44:30 +01:00
surtur 3e4fb10414
fortuna: add generator service 2022-01-03 07:49:53 +01:00
surtur b5601acfbd
refactor: non-semantic cleanup 2021-12-29 03:55:01 +01:00
surtur 234b87ff1f
accumulator: use a Generator pointer 2021-12-29 02:56:57 +01:00
surtur 7eaaef2fdb
fortuna: handle reseeds+clear pools for seed
* actually clear out entropy of the pools before a reseed
* correctly prepare the seed for the reseed
* add a couple of helper methods to Pool that assist with getting
  length, retrieving and clearing of the collected entropy
* catch exceptions in main(), handle them gracefully
2021-12-13 05:11:17 +01:00
surtur b55ca33e24
chore(fortuna): add random_data() checks, batch 1 2021-12-12 06:14:58 +01:00
surtur 053d2187a2
chore(accumulator): make use of init_pool_num 2021-12-09 14:11:39 +01:00
surtur 9f799c83a9
fortuna: add incr_reseed_ctr 2021-12-07 15:46:01 +01:00
surtur b96ce5d644
fortuna: wrap pool initialization in a try-catch 2021-12-07 02:48:37 +01:00
surtur a1cbbb209e
handle PRNG state in R_state + accumulator basis
* handle the PRNG state with R_state nested class
* add a private property R holding PRNG state to Fortuna
* add R_state properties as defined in Cryptography Engineering:
  * a generator instance
  * a reseed counter
  * 32 pools that the collected entropy is to be distributed over

* add initial definition of the Pool object and its initialization

* attempt to initialize PRNG in Fortuna constructor. wrap the
  initialization call in a try-catch block like a cultured person
* erase the string used to print data from random_data() after it's been
  used
2021-12-04 00:40:39 +01:00
surtur 225952a7e2
fix(fortuna): add end-of-namespace comment 2021-11-19 20:59:12 +01:00
surtur ea11801789
add fortuna class 2021-11-10 23:58:42 +01:00