Page MenuHomeFreeBSD

random(4): Abstract loader entropy injection

Authored by cem on Thu, Nov 21, 6:02 PM.



Break random_harvestq_prime up into some logical subroutines.

No functional change.

The goal is that it becomes easier to add other early entropy sources.

Diff Detail

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

Event Timeline

cem created this revision.Thu, Nov 21, 6:02 PM
delphij requested changes to this revision.Fri, Nov 22, 12:26 AM
delphij added a subscriber: delphij.

I think the proposed change actually does change the code behavior slightly.

What the old code does is basically "if we don't see an object of type 'boot_entropy_cache', try looking up the one with type '/boot/entropy' instead".

The new code validates both whether the object of 'boot_entroy_cache' is preloaded (existing behavior), and if the loaded object was sane (newly added behavior; previously we would not check the sanity before proceeding further, and it seemed to be reasonable because the expectation was that the type is either boot_entropy_cache, or '/boot/entropy' and the loaded file would be the same one).

The compatibility code wrapped in the NO_BACKWARD_COMPATIBILITY block was delivered in 12.0-RELEASE, but we didn't issued a warning that "please please update your /boot/defaults/loader.conf now" in the fallback case (we should have done that ~3 years ago, but now it's probably less relevant).

I would suggest that we simply delete that compatibility shim instead: it wasn't the intention to support both types permanently, and the code is already short enough to fit in one page.

This revision now requires changes to proceed.Fri, Nov 22, 12:26 AM
cem updated this revision to Diff 64711.Fri, Nov 22, 2:16 AM


delphij accepted this revision.Fri, Nov 22, 6:29 AM


This revision is now accepted and ready to land.Fri, Nov 22, 6:29 AM

(Note that the refactor is not really needed, but I don't have strong opinion here).

markm accepted this revision.Fri, Nov 22, 8:07 AM
This revision was automatically updated to reflect the committed changes.