VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Random.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-07 15:24:56 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-08 01:50:03 +0100
commite5b9cee8681dc45340321f759079b344a3b2676c (patch)
tree7e4875ccf109ebd2d2a858ec0368f2d9d46e2a5a /src/Common/Random.c
parent6bb1f24ed571bccd4d1d247dafdc1dda6eaa3d8d (diff)
downloadVeraCrypt-e5b9cee8681dc45340321f759079b344a3b2676c.tar.gz
VeraCrypt-e5b9cee8681dc45340321f759079b344a3b2676c.zip
Windows: Add option to enable use of CPU RDRAND/RDSEED as source of entropy which is now disabled by default
Diffstat (limited to 'src/Common/Random.c')
-rw-r--r--src/Common/Random.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Common/Random.c b/src/Common/Random.c
index 12e9d9af..c8655b56 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -777,9 +777,10 @@ BOOL SlowPoll (void)
}
// use RDSEED or RDRAND from CPU as source of entropy if present
- if ( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
+ if ( IsCpuRngEnabled() &&
+ ( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
|| (HasRDRAND() && RDRAND_getBytes (buffer, sizeof (buffer)))
- )
+ ))
{
RandaddBuf (buffer, sizeof (buffer));
}
@@ -907,10 +908,11 @@ BOOL FastPoll (void)
return FALSE;
}
- // use RDSEED or RDRAND from CPU as source of entropy if present
- if ( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
+ // use RDSEED or RDRAND from CPU as source of entropy if enabled
+ if ( IsCpuRngEnabled() &&
+ ( (HasRDSEED() && RDSEED_getBytes (buffer, sizeof (buffer)))
|| (HasRDRAND() && RDRAND_getBytes (buffer, sizeof (buffer)))
- )
+ ))
{
RandaddBuf (buffer, sizeof (buffer));
}