summaryrefslogtreecommitdiff
path: root/random/rndlinux.c
diff options
context:
space:
mode:
Diffstat (limited to 'random/rndlinux.c')
-rw-r--r--random/rndlinux.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/random/rndlinux.c b/random/rndlinux.c
index d3a144a4..f1548fbf 100644
--- a/random/rndlinux.c
+++ b/random/rndlinux.c
@@ -158,6 +158,19 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
if (length > 1)
length -= n_hw;
+ /* When using a blocking random generator try to get some entropy
+ * from the jitter based RNG. In this case we take up to 50% of the
+ * remaining requested bytes. */
+ if (level >= GCRY_VERY_STRONG_RANDOM)
+ {
+ n_hw = _gcry_rndjent_poll (add, origin, length/2);
+ if (n_hw > length/2)
+ n_hw = length/2;
+ if (length > 1)
+ length -= n_hw;
+ }
+
+
/* Open the requested device. The first time a device is to be
opened we fail with a fatal error if the device does not exists.
In case the device has ever been closed, further open requests
@@ -165,7 +178,7 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
that we always require the device to be existent but want a more
graceful behaviour if the rarely needed close operation has been
used and the device needs to be re-opened later. */
- if (level >= 2)
+ if (level >= GCRY_VERY_STRONG_RANDOM)
{
if (fd_random == -1)
{