Commit Graph

290 Commits

Author SHA1 Message Date
5b1c9ba71c
fortuna: make sleep_time vars constexpr
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 08:00:16 +01:00
4c7e95e475
fortuna: add mtx_random_data
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 07:55:21 +01:00
a3f871a644
fortuna: move code into a try block
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 06:06:07 +01:00
4f28612f3f
fortuna: add const and casts where appropriate
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 05:58:36 +01:00
5da8023bd3
chore(sfm): move code inside a try block
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 05:45:27 +01:00
246995dab3
sfm: fix reads,writes of the seed file, refactor
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 05:36:06 +01:00
8b446d4bfe
cmake: update clang-tidy options (speed,relevance)
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 04:21:47 +01:00
7972a851a0
chore: consolidate,add try blocks, throw more
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 04:03:19 +01:00
44a2f4148e
pool: refactor try-catch-throw logic (a little)
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 02:23:33 +01:00
422eb6fd8d
fortuna(SFM service): assert '_p_pools' ptrs equal
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-20 01:53:38 +01:00
7db896bcc0
Fortuna: add urandom_entropy_src_service() m. func
All checks were successful
continuous-integration/drone/push Build is passing
* implement a background service for the UrandomEntropySrc that is run
  every 50ms in an endless loop in a dedicated thread "th_urandom"
* print time, progress and a simple counter (for now) to console
* protect event adder instantiation by acquiring a mutex in
  std::unique_lock
* check validity of _p_pools ptr
* hardcode entropy source id as 0
2022-01-17 09:35:17 +01:00
d404681889
feat: "prepare to add proper entropy source" nits
All checks were successful
continuous-integration/drone/push Build is passing
general
* make greater use of "this"

Fortuna
* declare da_pools as a proper std::array of 32 Pool objects
* declare da_pools as const
* use std::shared_ptr _p_pools to access da_pools and share access to
  it
* reflect change of pools[] -> std::array in how the array elements
  are accessed, which is a) via _p_pools pointer and b) using ".at(i)"
  function
* pass _p_pools shared_ptr to Accumulator
* refactor member function names and variable names
* add member function attribute [[optimize_for_synchronized]]
* secure conversions with static_cast-s

Accumulator
* make use of _p_pools
* add _p_pools-related member functions
* add a static constexpr variable NUM_OF_POOLS

UrandomEntropySrc
* implement event adding logic using _p_pools
* make std::vector<char> non-static in urandom_entropy_src
* implement proper urandom entropy source event "sourcing" (from
  /dev/urandom), event adding, clear bytes array at the end
* properly convert using reinterpret_cast
* protect access to the main function with std::lock_guard
* receive EventAdderImpl as a ref
* use return value from "add_entropy()" member function and create
  sanity guard checking the return code "int ret"

EventAdder
* pass event (std::vector<char>) by const&

EventAdderImpl
* make use of _p_pools shared_ptr
* implement proper pool-rotating event-adding logic

Pool
* delete all copy constructors and assignment operator, the objects
  will not be copied or assigned to
* receive parameters by const& where possible/sensible
* handle concurrency:
  * declare std:string s as mutable
  * declare a rw std::mutex intended for writing and mutable
    std::recursive_mutex for read-only operations in const member
    functions
    ref: https://herbsutter.com/2013/05/24/gotw-6a-const-correctness-part-1-3/
    ref: https://arne-mertz.de/2017/10/mutable/
  * use std::lock_guard and std::unique_lock
* refactor "add_entropy()" member function
  * get rid of intermediate "event_str" and directly use the "event"
    std::vector<char> for all operations
  * add a lock guard to prevent multiple threads (should that route be
    taken) from modifying pool resources simultaneously
  * add all_ok bool for basic sanity checking
  * add print statements (at least for now)
* rename "get_s_length()" member function to "get_s_byte_count()" and
  repurpose it to return byte count of the stored entropy std::string s
2022-01-17 08:27:24 +01:00
e899c03da2
chore(pool): add const& qual, #include stuff
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 07:49:03 +01:00
e78ac038db
accumulator: don't move &gen
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 07:32:57 +01:00
96d8265c22
entropy_src: add ctor,dtor, rm scheduler fun
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 07:28:32 +01:00
55659bd243
generator: pass param by const&
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 07:22:19 +01:00
c615076182
chore(sfm): uint -> unsigned int
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 07:20:16 +01:00
2872c44d8e
Util: add do_sha() for {const,} std::vector<char>&
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 04:52:55 +01:00
62f31c1436
scheduler: add thread_sleep, use const& param
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 04:42:59 +01:00
146bf14d68
accumulator: use const& params,uint->unsigned int
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 04:36:15 +01:00
b4d7cb3dfb
chore: rm trailing ;
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 04:03:06 +01:00
706176bcc4
cmake: add libs using target_include_directories
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-17 00:28:52 +01:00
7fca4481c8
generator: implement time_to_reseed() fun
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-15 13:35:56 +01:00
c0933d355d
fortuna: improve mtx handling, introduce accu_mtx
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 08:52:51 +01:00
b682b0251d
UrandomEntropySrc: add a static_cast to calm TIDY
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 08:39:29 +01:00
f79395261f
sfm: smooth out yet other conversions
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 08:27:52 +01:00
5d6b9b9b28
Util: apply latest clang-format
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 08:07:26 +01:00
7c6e53f31b
SeedFileManager: fix -Wshadow, -Wconversion
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 07:58:55 +01:00
2f452de8be
accumulator: for loop -> std::any_of
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 07:25:10 +01:00
61dbc4b666
accumulator: fix -Wshadow, -Wconversion
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 07:17:59 +01:00
508eaaa67f
EventAdderImpl: fix -Wshadow, -Wconversion
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 07:10:16 +01:00
bb1d895d4e
cmake: switch to alt. compiler detection mechanism
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 07:02:12 +01:00
65882cad15
cmake: only run TSan on non-SAN,TIDY Debug builds
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 06:58:49 +01:00
57fae8f582
generate_random_data: return early on invalid arg
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 05:44:37 +01:00
53cde1371f
generator: improve iteration
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 05:40:22 +01:00
e0448d6d08
fortuna,generator: better printing
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 05:20:52 +01:00
ad71199e1a
cmake: look for fmtlib system pkg first
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 04:48:48 +01:00
a2020d212d
cmake: add -W{conversion,shadow,cast-qual}
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 04:24:43 +01:00
01a9797569
cmake: ThreadSan on (NOT SAN), avoid *San clashes
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 04:22:32 +01:00
97b178f243
cmake: -Wformat -> -Wformat=2
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 04:11:57 +01:00
dec7875276
cmake: look for threads lib in a portable way
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 04:09:44 +01:00
0bac9f83d3
generator: fix generate_random_data() function
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 01:09:24 +01:00
879a8c69d3
fortuna: add urandom_entropy_src_service prototype
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 07:19:52 +01:00
6a2362be37
fortuna: ++(informative value of print messages)
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:50:37 +01:00
bdfd64475f
fortuna: improve PRNG initialization mutex logic
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:41:57 +01:00
73cf5545dd
makefile: smarter clean target - prevent bad stuff
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:28:45 +01:00
9f738e97ec
accumulator: actually register the pool
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:21:57 +01:00
d6e97e3fda
SeedFileManager: initialize RUNNING with constinit
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:18:43 +01:00
15798773a9
SeedFileManager: mark ctor explicit
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:08:40 +01:00
a0df93c9ec
clang-format: BinPack{Arguments,Parameters}: false
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 06:04:18 +01:00