[PATCH 3/3] Wait for enough entropy when creating LUKS format
Chris Lumens
clumens at redhat.com
Tue May 28 15:00:55 UTC 2013
> @@ -462,6 +466,19 @@ class ActionCreateFormat(DeviceAction):
>
> self.device.disk.format.commitToDisk()
>
> + if isinstance(self.device.format, luks.LUKS):
> + # LUKS needs to wait for random data entropy if it is too low
> + current_entropy = get_current_entropy()
> + if current_entropy < luks.MINIMAL_ENTROPY:
> + if callbacks and "WaitForEntropy" in callbacks:
> + msg = "Not enough entropy to create LUKS format. "\
> + "%d bits are needed." % luks.MINIMAL_ENTROPY
> + callbacks["WaitForEntropy"](msg, luks.MINIMAL_ENTROPY)
> +
> + while get_current_entropy() < luks.MINIMAL_ENTROPY:
> + # wait for entropy to become high enough
> + time.sleep(1)
> +
> self.device.format.create(device=self.device.path,
> options=self.device.formatArgs)
> # Get the UUID now that the format is created
Would it also be possible to somehow unpredictably stir things up here
to increase available entropy? That could help the loop take less time
to complete.
- Chris
More information about the anaconda-patches
mailing list