]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(4): Add regression tests for uint128 implementation, Chacha CTR
authorcem <cem@FreeBSD.org>
Mon, 17 Jun 2019 14:59:45 +0000 (14:59 +0000)
committercem <cem@FreeBSD.org>
Mon, 17 Jun 2019 14:59:45 +0000 (14:59 +0000)
commita8e7a312c6c1bc36745a0dfab9ae767a65862299
tree1ad8cd837dc60ba4603de9550d9459be83129bd6
parent10dc8d0dd72feef1286e4ce5f9fbb6fe19769d64
random(4): Add regression tests for uint128 implementation, Chacha CTR

Add some basic regression tests to verify behavior of both uint128
implementations at typical boundary conditions, to run on all architectures.

Test uint128 increment behavior of Chacha in keystream mode, as used by
'kern.random.use_chacha20_cipher=1' (r344913) to verify assumptions at edge
cases.  These assumptions are critical to the safety of using Chacha as a
PRF in Fortuna (as implemented).

(Chacha's use in arc4random is safe regardless of these tests, as it is
limited to far less than 4 billion blocks of output in that API.)

Reviewed by: markm
Approved by: secteam(gordon)
Differential Revision: https://reviews.freebsd.org/D20392
etc/mtree/BSD.tests.dist
sys/dev/random/hash.c
sys/dev/random/hash.h
tests/sys/Makefile
tests/sys/devrandom/Makefile [new file with mode: 0644]
tests/sys/devrandom/uint128_test.c [new file with mode: 0644]