mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
account for newer entropy poolsize in EntropyGenerator
This commit is contained in:
parent
46cf7a44ce
commit
a61362a73d
2 changed files with 13 additions and 1 deletions
|
@ -267,7 +267,8 @@ def pytest_configure(config):
|
|||
"requiring a minimum value of random entropy. In the case where the value is lower "
|
||||
"than the provided 'minimum', an attempt will be made to raise that value up until "
|
||||
"the provided 'timeout' minutes have passed, at which time, depending on the value "
|
||||
"of 'skip' the test will skip or fail.".format(
|
||||
"of 'skip' the test will skip or fail. For entropy poolsizes of 256 bits, the min "
|
||||
"is adjusted to 192.".format(
|
||||
EntropyGenerator.minimum_entropy, EntropyGenerator.max_minutes
|
||||
),
|
||||
)
|
||||
|
|
|
@ -664,12 +664,23 @@ class EntropyGenerator:
|
|||
def generate_entropy(self):
|
||||
max_time = self.max_minutes * 60
|
||||
kernel_entropy_file = pathlib.Path("/proc/sys/kernel/random/entropy_avail")
|
||||
kernel_poolsize_file = pathlib.Path("/proc/sys/kernel/random/poolsize")
|
||||
if not kernel_entropy_file.exists():
|
||||
log.info("The '%s' file is not avilable", kernel_entropy_file)
|
||||
return
|
||||
|
||||
self.current_entropy = int(kernel_entropy_file.read_text().strip())
|
||||
log.info("Available Entropy: %s", self.current_entropy)
|
||||
|
||||
if not kernel_poolsize_file.exists():
|
||||
log.info("The '%s' file is not avilable", kernel_poolsize_file)
|
||||
else:
|
||||
self.current_poolsize = int(kernel_poolsize_file.read_text().strip())
|
||||
log.info("Entropy Poolsize: %s", self.current_poolsize)
|
||||
# Account for smaller poolsizes using BLAKE2s
|
||||
if self.current_poolsize == 256:
|
||||
self.minimum_entropy = 192
|
||||
|
||||
if self.current_entropy >= self.minimum_entropy:
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue