Commit Graph

31 Commits

Author SHA1 Message Date
surtur e0448d6d08
fortuna,generator: better printing
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 05:20:52 +01:00
surtur 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
surtur 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
surtur 8c3aee1b07
fortuna: use a proper shared_ptr to Generator
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-13 03:02:31 +01:00
surtur 643e7aabf6
fortuna: add basic joinability check
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-12 03:41:24 +01:00
surtur 3553968d52
fortuna: add accumulator service,thread
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-10 07:57:11 +01:00
surtur 1817b4a82e
fortuna: add print mutex, impl with unique_lock
All checks were successful
continuous-integration/drone/push Build is passing
* 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
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-10 04:25:03 +01:00
surtur 795b9ffe54
add proper SeedFileManager implementation
All checks were successful
continuous-integration/drone/push Build is passing
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 6e62e47d7b
chore(fortuna): std::mutex -> std::unique_lock
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-06 00:50:28 +01:00
surtur 3d65cde727
fortuna: properly reindent file
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-04 06:57:36 +01:00
surtur 06db22bfa4
fortuna: add seed_file_manager_service() [wip]
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-04 06:44:30 +01:00
surtur c6695f4be3
generator service: refactor var names,types
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-03 08:53:54 +01:00
surtur 3e4fb10414
fortuna: add generator service
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-03 07:49:53 +01:00
surtur b5601acfbd
refactor: non-semantic cleanup
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-29 03:55:01 +01:00
surtur 7eaaef2fdb
fortuna: handle reseeds+clear pools for seed
All checks were successful
continuous-integration/drone/push Build is passing
* 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 65c476dbd6
add Util class + perform general refactor
All checks were successful
continuous-integration/drone/push Build is passing
* 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
2021-12-13 05:10:07 +01:00
surtur b55ca33e24
chore(fortuna): add random_data() checks, batch 1
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-12 06:14:58 +01:00
surtur 2fbf5464a0
fortuna: erase -> clear
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-11 01:20:34 +01:00
surtur 8b4cd4b6e8
fortuna(random_data): time-tracking precision++
All checks were successful
continuous-integration/drone/push Build is passing
using floats does wonders
2021-12-08 23:17:37 +01:00
surtur 0e3caebb6d
chore(fortuna): formatting
[skip ci]
2021-12-08 03:31:47 +01:00
surtur f02952d72a
fortuna(random_data): add basic time tracking
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-07 15:55:29 +01:00
surtur 9f799c83a9
fortuna: add incr_reseed_ctr
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-07 15:46:01 +01:00
surtur a1cbbb209e
handle PRNG state in R_state + accumulator basis
All checks were successful
continuous-integration/drone/push Build is passing
* 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 0c2a1c6744
finalise generator
All checks were successful
continuous-integration/drone/push Build is passing
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
2021-11-30 14:09:39 +01:00
surtur bcd33c2f33
chore: direct braced string initialization
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-20 22:31:55 +01:00
surtur 444660bf89
feat(generator): add constructor/destructor
All checks were successful
continuous-integration/drone/push Build is passing
* initialize_generator() is now a private method
* call initialize_generator() inside the constructor of the Generator
* move full struct declaration to generator.h
* have a private field named G of type G_state
* remove explicit instantiation of Generator from fortuna constructor -
  Generator is a private field of fortuna
* remove direct initialize_generator() call from fortuna constructor
* remove get_state() calls as G_state G is now a private field
* refactor get_state() to simply return the *private field G_state G*
* refactor do_crypto() - I know, this should have been split to a
  separate commit - remove function parameters and useless assignments
  inside its body to reflect that once it accesses k and ctr (of the
  G_state G), it won't be necessary for them to be passed as parameters,
  since *G_state G is now a private field*...
2021-11-20 22:31:54 +01:00
surtur bd421295c4
feat: use fmt instead of iostreams
All checks were successful
continuous-integration/drone/push Build is passing
switch to fmt - "A modern formatting library" - for fun and profit,
currently in header-only configuration.

ref: https://github.com/fmtlib/fmt

closes #5
closes #4
2021-11-18 22:05:05 +01:00
surtur c82d3912f5
generator: add CTR-mode Serpent to random_data()
All checks were successful
continuous-integration/drone/push Build is passing
operate on a fixed string with randomly generated key and iv block on
each run.

this is neither finished nor correct implementation, it currently also
calls the Decryption routine to prove that it's working properly with
the input given ("Oh, I am fortune's fool!" seemed fitting for fortuna).
2021-11-15 23:37:04 +01:00
surtur 3f411f687e
chore: header-guard encompass files properly
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-15 22:13:00 +01:00
surtur ea11801789
add fortuna class
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-10 23:58:42 +01:00