ChaCha20 DRNG

The ChaCha20 DRNG is a complete standalone implementation of a deterministic random number generator. It does not need any external cryptographic support.

It is implemented using ideas specified in SP800-90A, AIS 20/31 as well as specified by Peter Gutmann's 1998 Usenix Security Symposium paper: "Software Generation of Practically Strong Random Numbers". The following list enumerates the different properties offered with the ChaCha20 DRNG.

Different seed sources are implemented which are activated during compile time. This includes the support for the CPU Jitter Random Number Generator which makes the ChaCha20 DRNG fully standalone without the need of support from other cryptographic implementations. See the seed source documentation for details.

The ChaCha20 DRNG is derived from the "standalone" DRNG support implemented as part of the Linux Random Number Generator -- a new approach to the Linux /dev/random.

GitHub Link

A public git repository is found at smuellerDD/chacha20_drng.

API Documentation

A full documentation is derived from the source code comments in chacha20_drng.h.

See the README file enclosed in the source code for details on how to use the code.

Source Code

The following source code contains the implementation of the ChaCha20 DRNG.

Link Changes

chacha20_drng-1.0.0

Signature

Initial version

chacha20_drng-1.1.0

Signature

  • fix invocation of getrandom syscall (thanks to Patrick)
  • remove debug printf
  • use private name space for version macros (suggested by Jason Cooper)
  • add API calls to obtain version of implementation (suggested by Jason Cooper)

chacha20_drng-1.2.0

Signature

  • place version macros into the C so that they are private (thanks to Jason Cooper)
  • add license files (thanks to Jason Cooper)
  • change drng_chacha20_versionstring to return the snprintf error (thanks to Jason Cooper)

chacha20_drng-1.2.1

Signature

  • make implementation of chacha20_update faster by using one loop
  • initialize the ChaCha20 key state with a time stamp
  • catch return code of mlock
  • enhance tests

chacha20_drng-1.2.2

Signature

  • Minor changes to compile on embedded systems (thanks to Jason Cooper)

chacha20_drng-1.3.0

Signature

  • Add ChaCha20 DRNG self test
  • Bug fix drng_chacha20_alloc: if mlock fails, deallocate memory
  • Update Jitter RNG to version 2.1.0
  • Support multiple noise sources concurrently

chacha20_drng-1.3.1

Signature

  • Add MIT license
  • Add handling of buffer that is not aligned to 4 bytes

2017-12-12 smueller at chronox.de