Page MenuHomeFreeBSD

random(4): Abstract loader entropy injection

Authored by cem on Nov 21 2019, 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

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.Nov 22 2019, 12:26 AM


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

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

This revision was automatically updated to reflect the committed changes.