Commit Graph

60 Commits

Author SHA1 Message Date
surtur 226f264fcd
cmake: add more diagnostic warning flags 2022-02-03 01:43:21 +01:00
surtur 0e4d1aeef0
cmake: enable building with '-pedantic' 2022-01-30 23:00:13 +01:00
surtur 71f61085dd
cmake: change -mtune generic -> native 2022-01-27 21:19:50 +01:00
surtur ad6c01daaa
remove unused event_scheduler 2022-01-27 20:46:27 +01:00
surtur 2b1349b256
cmake: add -fno-signed-zeros, -ffunction-sections 2022-01-27 20:32:57 +01:00
surtur d99ef986bf
cmake: add -Wvla in Debug builds 2022-01-27 20:28:16 +01:00
surtur 1517b150ed
cmake: CMAKE_BUILD_TYPE MATCHES -> STREQUAL 2022-01-26 17:07:34 +01:00
surtur 7d856dab8e
cmake: use clang-tidy with extra-arg '-std=c++20' 2022-01-24 10:31:16 +01:00
surtur 8b446d4bfe
cmake: update clang-tidy options (speed,relevance) 2022-01-20 04:21:47 +01:00
surtur 706176bcc4
cmake: add libs using target_include_directories 2022-01-17 00:28:52 +01:00
surtur bb1d895d4e
cmake: switch to alt. compiler detection mechanism 2022-01-14 07:02:12 +01:00
surtur 65882cad15
cmake: only run TSan on non-SAN,TIDY Debug builds 2022-01-14 06:58:49 +01:00
surtur ad71199e1a
cmake: look for fmtlib system pkg first 2022-01-14 04:48:48 +01:00
surtur a2020d212d
cmake: add -W{conversion,shadow,cast-qual} 2022-01-14 04:24:43 +01:00
surtur 01a9797569
cmake: ThreadSan on (NOT SAN), avoid *San clashes 2022-01-14 04:22:32 +01:00
surtur 97b178f243
cmake: -Wformat -> -Wformat=2 2022-01-14 04:11:57 +01:00
surtur dec7875276
cmake: look for threads lib in a portable way 2022-01-14 04:09:44 +01:00
surtur 03578f9016
accumulator: refactor entropy_src,add files
* add event_scheduler_impl.h and properly override its base class
* add urandom_entropy_src.cpp, move there logic from header
* add urandom_entropy_src.cpp to CMakeLists.txt
* add unique_ptr per impl: one for both EventSchedulerImpl and
  EventAdderImpl each
* wrap a call in reinterpret_cast and reformat code
* add missing includes (best effort)
2022-01-13 05:40:33 +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 e7cce999a0
ci: fix git submodule update --init race condition 2022-01-14 04:41:43 +01:00
surtur ef418cf89c
fmt::fmt: header-only -> statically linked lib 2022-01-13 05:50:56 +01:00
surtur 04e088c07f
cmake: reindent;add vim modeline 2022-01-07 17:45:05 +01:00
surtur 5ad8e610a4
cmake: integrate iwyu, if/when present 2022-01-07 06:20:26 +01:00
surtur d4c7c61ac4
cmake,makefile: think of clang++, too 2022-01-07 05:14:56 +01:00
surtur 19d5ff0f22
cmake,makefile: SAN,TIDY,VALGRIND opts;clean turbo 2022-01-07 03:42:42 +01:00
surtur 554030bbaa
cmake: a little refactor 2022-01-04 05:33:14 +01:00
surtur 55cb3b6ec7
chore(cmake): improve legibility 2022-01-01 07:11:21 +01:00
surtur 928011dd54
chore(cmake): record gcc switches for debugging 2021-12-30 22:34:22 +01:00
surtur 6408b1ded7
add fmtlog library
"fmtlog is a performant fmtlib-style logging library with latency in nanoseconds."
ref: https://github.com/MengRao/fmtlog
2021-12-30 22:30:41 +01:00
surtur 129516a48f
add seed_file_management.h holding SeedFileManager 2021-12-13 05:59:27 +01:00
surtur 65c476dbd6
add Util class + perform general refactor
* 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 da48e61cc2
add da_threading lib
retrieved from https://stackoverflow.com/a/46135882
original author LWimsey <https://stackoverflow.com/users/6651824/lwimsey> (c) 2017
edited and made into a header-only lib by wanderer <a_mirre at utb.cz> (c) 2021
2021-12-12 22:50:06 +01:00
surtur cf41d323a4
fortuna: add task runner "do_task"; link pthread 2021-12-12 18:42:47 +01:00
surtur d0e9b08886
accumulator: add urandom_entropy_src 2021-12-11 02:24:40 +01:00
surtur a5b988ba71
accumulator: add event_scheduler,entropy_src ifces 2021-12-11 02:12:49 +01:00
surtur 801d605e2a
chore(clang-tidy): unify flags
also add a status message to CMake's output
2021-12-10 18:57:25 +01:00
surtur 872e6f7f9f
add event_adder_impl 2021-12-08 03:58:18 +01:00
surtur bc5bb6e700
add EventAdder interface
will be used as a base implementations of sources of random events
2021-12-06 01:02:43 +01:00
surtur 7f05984946
integrate clang-tidy into cmake
* consolidate everything with the makefile, the "tidy" target now just
  sets the env var that is checked for in CMakeLists
* rm clang-tidy from pre-commit as it's run as part of the "test"
  makefile target later in the file anyway
2021-12-05 05:13:07 +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 77f1fe4c56
cmake,makefile: sanitize!
as per #3
2021-12-02 18:34:07 +01:00
surtur e72aa06813
executable hardening v2
* enable PIE
* pass flags to linker based on the build type
* enable LTO
2021-12-02 18:25:15 +01:00
surtur bb12cf7b56
cmake: always set -Wall 2021-12-02 14:50:39 +01:00
surtur b15e1e9a55
harden executable
* fortify source
* link with "-pie"
* split stack
* set stack-protector to all
2021-11-30 15:52:17 +01:00
surtur d942e06263
cmake: compile PIC with "-fPIC" 2021-11-20 22:31:55 +01:00
surtur e531aa6289
cmake: print version 2021-11-20 22:31:55 +01:00
surtur bd421295c4
feat: use fmt instead of iostreams
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 9fd35eee93
cmake: require the declared cxx standard 2021-11-18 19:49:15 +01:00
surtur b934b11aa9
cmake(release): harden the build 2021-11-15 23:07:59 +01:00
surtur 0199fbd675
cmake: optimize for debugging with -Og 2021-11-15 23:04:37 +01:00