Page MenuHomeFreeBSD

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

Authored by cem on May 24 2019, 12:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 7, 8:50 PM
Unknown Object (File)
Feb 21 2024, 11:16 PM
Unknown Object (File)
Feb 13 2024, 3:14 PM
Unknown Object (File)
Feb 12 2024, 11:28 AM
Unknown Object (File)
Feb 7 2024, 11:43 AM
Unknown Object (File)
Jan 2 2024, 6:07 PM
Unknown Object (File)
Dec 27 2023, 9:35 PM
Unknown Object (File)
Dec 27 2023, 9:28 PM
Subscribers

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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24459
Build 23267: arc lint + arc unit

Event Timeline

Add missing mtree declaration.

Fix hash.c build on ppc64

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

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.

@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 added a subscriber: gordon.

This looks straightforward. Approved.

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