108 static const uint8_t zeroIV[8] = {};
109 s_chacha.setIV(zeroIV,
sizeof(zeroIV));
133 const uint32_t value =
static ChaCha s_chacha
ChaCha20 cipher object (20-round configuration by default constructor).
uint32_t getSecureRandom32()
Return 32 bits of CSPRNG output (non-blocking).
static uint8_t s_keystreamUsed
Number of bytes consumed from s_keystreamBuf so far.
static const uint8_t CSPRNG_BLOCK_BYTES
Size of one ChaCha20 keystream output block in bytes.
static uint8_t s_keystreamBuf[CSPRNG_BLOCK_BYTES]
One-block keystream cache. Refilled automatically when s_keystreamUsed >= CSPRNG_BLOCK_BYTES.
static void s_fillKeystreamBlock()
Produce the next 64-byte ChaCha20 keystream block into s_keystreamBuf.
void initCSPRNG(const uint8_t *hardwareSeed)
Seed the ChaCha20 CSPRNG with 256 bits of hardware entropy.