Page MenuHomeFreeBSD

random(4): Add regression tests for uint128 implementation, Chacha CTR
ClosedPublic

Authored by cem on May 24 2019, 12:11 AM.

Details

Summary

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' to verify assumptions. These
assumptions are critical to the safety of using Chacha as a PRF in Fortuna
(as implemented), but do not impact arc4random at all.

Test Plan

Tests pass on amd64, and I'm looking for volunteers or cluster resources to
validate !x86 archs, especially big endian.

Tests pass on ref12-ppc64 as well.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.May 24 2019, 12:11 AM
cem updated this revision to Diff 57814.May 24 2019, 12:14 AM

Add missing mtree declaration.

cem edited the test plan for this revision. (Show Details)May 24 2019, 4:14 AM
cem updated this revision to Diff 57829.May 24 2019, 4:15 AM

Fix hash.c build on ppc64

unit_test.h has some x86-specific constructs, and we only need kassert/ctassert
for hash.c.

cem updated this revision to Diff 58340.Jun 7 2019, 1:53 AM

Rebase onto SVN head

  • keystream API takes blocks, not bytes still
  • Drop uint128_add64 API tests, which does not exist

I would like to commit these tests, which cover the existing r344913, as soon
as possible. The other tests will be moved to associated commits.

cem added a reviewer: secteam.Jun 7 2019, 1:54 AM
markm accepted this revision.Jun 7 2019, 6:21 PM

None job, thanks!

cem added a comment.Jun 7 2019, 9:37 PM

@delphij , this one technically touches sys/dev/random (fix a declaration name typo but mostly add #ifndef _KERNEL compatibility shims), so I need secteam blessing to commit. I'd appreciate a look when you get a chance.

gordon accepted this revision as: secteam.Jun 17 2019, 12:11 PM
gordon added a subscriber: gordon.

This looks straightforward. Approved.

This revision is now accepted and ready to land.Jun 17 2019, 12:11 PM