summaryrefslogtreecommitdiff
path: root/random/rndw32.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-01-27 09:16:31 +0100
committerWerner Koch <wk@gnupg.org>2017-01-27 09:18:06 +0100
commita351fbde8548ce3f57298c618426f043844fbc78 (patch)
tree2a4416db152fe1d6099452102ebb854f2949f1dd /random/rndw32.c
parent8bbefa2ab283dd1443cb7453749aa0b51aec6ec4 (diff)
downloadlibgcrypt-a351fbde8548ce3f57298c618426f043844fbc78.tar.gz
w32: New envvar GCRYPT_RNDW32_DBG.
* random/rndw32.c (_gcry_rndw32_gather_random): Use getenv to set DEBUG_ME. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'random/rndw32.c')
-rw-r--r--random/rndw32.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/random/rndw32.c b/random/rndw32.c
index de6e783c..8c507ac3 100644
--- a/random/rndw32.c
+++ b/random/rndw32.c
@@ -245,12 +245,13 @@ static RTLGENRANDOM pRtlGenRandom;
static int system_rng_available; /* Whether a system RNG is available. */
static HCRYPTPROV hRNGProv; /* Handle to Intel RNG CSP. */
-static int debug_me; /* Debug flag. */
+/* The debug flag. Debugging is enabled if the value of the envvar
+ * GCRY_RNDW32_DBG is a postive number.*/
+static int debug_me;
static int system_is_w2000; /* True if running on W2000. */
-
/* Try and connect to the system RNG if there's one present. */
static void
@@ -787,11 +788,16 @@ _gcry_rndw32_gather_random (void (*add)(const void*, size_t,
if (!is_initialized)
{
OSVERSIONINFO osvi = { sizeof( osvi ) };
+ const char *s;
+
+ if ((s = getenv ("GCRYPT_RNDW32_DBG")) && atoi (s) > 0)
+ debug_me = 1;
GetVersionEx( &osvi );
if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
log_fatal ("can only run on a Windows NT platform\n" );
system_is_w2000 = (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0);
+
init_system_rng ();
is_initialized = 1;
}