aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc
diff options
context:
space:
mode:
authorEugene Grosbein <eugen@FreeBSD.org>2021-05-26 11:30:24 +0000
committerEugene Grosbein <eugen@FreeBSD.org>2021-05-26 11:30:24 +0000
commit3bca93e04275045c3d868d09a57f9201999908f0 (patch)
treedc9654a5804030f1d70b71343f77a8ec4fe6ad81 /libexec/rc
parent905d192d6f161496c26db29d0d429525166bfff7 (diff)
downloadsrc-3bca93e04275045c3d868d09a57f9201999908f0.tar.gz
src-3bca93e04275045c3d868d09a57f9201999908f0.zip
rc.d/random: add support for zero harvest_mask
Replace the check for zero harvest_mask with new check for empty string. This allows one to specify harvest_mask="0" that disables harversting entropy from all but "pure" sources. Exact bit values for "pure" sources differ for stable/12 and later branches, so it is handy to use zero. The check for zero pre-dates introduction of "pure" non-maskable sources Use empty string to disable altering sysctl kern.random.harvest.mask. Note that notion of "pure" random sources is not documented in user level manual pages yet. Still, it helps to extend battery life for hardware with embedded "Intel Secure Key RNG" by disabling all other sources. Note that no defaults changed and default behaviour is not affected. Reported by: Dmitry Luhtionov
Diffstat (limited to 'libexec/rc')
-rwxr-xr-xlibexec/rc/rc.d/random2
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/rc/rc.d/random b/libexec/rc/rc.d/random
index d275284e13d6..fda3c8a71fae 100755
--- a/libexec/rc/rc.d/random
+++ b/libexec/rc/rc.d/random
@@ -47,7 +47,7 @@ feed_dev_random()
random_start()
{
- if [ ${harvest_mask} -gt 0 ]; then
+ if [ -n "${harvest_mask}" ]; then
echo -n 'Setting up harvesting: '
${SYSCTL} kern.random.harvest.mask=${harvest_mask} > /dev/null
${SYSCTL_N} kern.random.harvest.mask_symbolic