Commit Graph

16 Commits

Author SHA1 Message Date
Daniel Micay 3af44d2e6a can now depend on libc having a getrandom wrapper 2020-03-29 11:40:12 -04:00
Daniel Micay dfa49481e5 random: fix whitespace issue 2019-11-06 05:28:35 -05:00
Daniel Micay 13ee04c8c3 fill CSPRNG caches lazily to speed up early init 2019-04-15 07:23:30 -04:00
Daniel Micay a13db3fc68 initialize size class CSPRNGs from init CSPRNG
This avoids making a huge number of getrandom system calls during
initialization. The init CSPRNG is unmapped before initialization
finishes and these are still reseeded from the OS. The purpose of the
independent CSPRNGs is simply to avoid the massive performance hit of
synchronization and there's no harm in doing it this way.

Keeping around the init CSPRNG and reseeding from it would defeat the
purpose of reseeding, and it isn't a measurable performance issue since
it can just be tuned to reseed less often.
2019-04-15 06:50:24 -04:00
Daniel Micay c7e2cb82f4 add generic get_random_bytes function 2019-04-15 06:07:28 -04:00
Daniel Micay 943a81fbeb use smaller integers for random cache state 2018-11-04 14:24:21 -05:00
Daniel Micay c74fe56091 minor include style fix 2018-10-10 18:19:56 -04:00
Daniel Micay dcd969ae04 use a consistent style for fixed-size int types
The stdint.h types don't cover 128-bit integers and the underscore makes
them ill suited to usage in function suffixes. Instead, use the common
naming style in the Linux kernel and elsewhere including the ChaCha8
implementation included here.
2018-10-04 15:17:11 -04:00
Daniel Micay 433af6d4ba drop 128-bit keys from ChaCha implementation 2018-09-11 10:22:28 -04:00
Daniel Micay 99fcddc223 use much faster get_random_{type}_uniform approach 2018-08-30 02:08:05 -04:00
Daniel Micay 700e06c2db manually specialize the CSPRNG cache 2018-08-26 00:43:46 -04:00
Daniel Micay c41e659383 use ChaCha8-based CSPRNG 2018-08-25 23:24:00 -04:00
Daniel Micay 2b7c9362bb consume fewer random bytes for slab randomization 2018-08-25 18:32:44 -04:00
Daniel Micay 71dde7c4f8 provide getrandom wrapper to support glibc < 2.25
Debian stretch (currently stable) only has glibc 2.24...
2018-08-24 18:48:55 -04:00
Daniel Micay daa44905ee implement a cache for the CSPRNG 2018-08-23 16:36:57 -04:00
Daniel Micay 70d61b6662 initial commit 2018-08-23 15:42:41 -04:00