Page MenuHomeFreeBSD

Fortuna: Clean up reseeding key material to closer match FS&K
ClosedPublic

Authored by cem on Aug 29 2018, 4:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 23, 1:26 PM
Unknown Object (File)
Tue, Jun 17, 7:30 AM
Unknown Object (File)
Sun, Jun 15, 6:25 PM
Unknown Object (File)
Sun, Jun 15, 6:50 AM
Unknown Object (File)
Fri, Jun 13, 7:51 AM
Unknown Object (File)
Fri, Jun 13, 2:57 AM
Unknown Object (File)
Thu, Jun 12, 7:51 AM
Unknown Object (File)
Thu, Jun 12, 2:55 AM
Subscribers

Details

Summary

When reseeding, only incorporate actual key material. Do not include e.g.
the derived key schedules or other AES context.

I don't think the extra material was harmful here, just not beneficial.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19255
Build 18868: arc lint + arc unit

Event Timeline

sys/dev/random/fortuna.c
289

The sentiment is good, but this looks a bit "magic number-ish". Dividing by 8 may give the right answer, but rather co-incidentially, no?

Would it not be more correct to have a specific sizeof(something)?

sys/dev/random/fortuna.c
289

keyLen is stored in bits, but randomdev_hash_iterate() takes a number of bytes. sizeof(something) wouldn't be semantically correct, even if it produced the number 8 ;-).

See preexisting use of the 8 constant to translate between rijndael key lengths and ordinary byte lengths in e.g., dev/random/hash.c and crypto/rijndael/rijndael-api-fst.c.

(In general, FreeBSD MI code in general and crypto implementations in particular widely assume 8 bits per byte.)

markm added inline comments.
sys/dev/random/fortuna.c
289

I geddit. keyless is in bits.

LGTM.

This revision is now accepted and ready to land.Aug 29 2018, 7:36 PM
delphij accepted this revision.
delphij added a reviewer: secteam.
This revision was automatically updated to reflect the committed changes.