rev148: Rework DRBG_DEBUG_PRINT

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-07-11 12:37:47 -04:00 committed by Stefan Berger
parent fa9c6382ec
commit e41d4d453a
2 changed files with 11 additions and 9 deletions

View File

@ -183,13 +183,15 @@
# define RUNTIME_SIZE_CHECKS NO // Default: Either YES or NO
# endif
// If doing debug, can set the DRBG to print out the intermediate test values. Before enabling this,
// make sure that the dbgDumpMemBlock() function has been added someplace (preferably, somewhere in
// CryptRand.c)
# if !(defined DRBG_DEBUG_PRINT) \
|| ((DRBG_DEBUG_PRINT != NO) && (DRBG_DEBUG_PRINT != YES))
# undef DRBG_DEBUG_PRINT
# define DRBG_DEBUG_PRINT NO // Default: Either YES or NO
# endif
/* If doing debug, can set the DRBG to print out the intermediate test values. Before enabling this,
make sure that the dbgDumpMemBlock() function has been added someplace (preferably, somewhere in
CryptRand.c) */
#ifndef DRBG_DEBUG_PRINT
//# define DRBG_DEBUG_PRINT
#endif
/* If an assertion event it not going to produce any trace information (function and line number)
then define NO_FAIL_TRACE */
#ifndef NO_FAIL_TRACE

View File

@ -435,7 +435,7 @@ DRBG_SelfTest(
// Do an instantiate
if(!DRBG_Instantiate(&testState, 0, NULL))
return FALSE;
#if defined DRBG_DEBUG_PRINT && defined DEBUG
#if DRBG_DEBUG_PRINT
dbgDumpMemBlock(pDRBG_KEY(&testState), DRBG_KEY_SIZE_BYTES,
"Key after Instantiate");
dbgDumpMemBlock(pDRBG_IV(&testState), DRBG_IV_SIZE_BYTES,
@ -443,7 +443,7 @@ DRBG_SelfTest(
#endif
if(DRBG_Generate((RAND_STATE *)&testState, buf, sizeof(buf)) == 0)
return FALSE;
#if defined DRBG_DEBUG_PRINT && defined DEBUG
#if DRBG_DEBUG_PRINT
dbgDumpMemBlock(pDRBG_KEY(&testState.seed), DRBG_KEY_SIZE_BYTES,
"Key after 1st Generate");
dbgDumpMemBlock(pDRBG_IV(&testState.seed), DRBG_IV_SIZE_BYTES,
@ -453,7 +453,7 @@ DRBG_SelfTest(
return FALSE;
memcpy(seed.bytes, DRBG_NistTestVector_EntropyReseed, sizeof(seed));
DRBG_Reseed(&testState, &seed, NULL);
#if defined DRBG_DEBUG_PRINT && defined DEBUG
#if DRBG_DEBUG_PRINT
dbgDumpMemBlock((BYTE *)pDRBG_KEY(&testState.seed), DRBG_KEY_SIZE_BYTES,
"Key after 2nd Generate");
dbgDumpMemBlock((BYTE *)pDRBG_IV(&testState.seed), DRBG_IV_SIZE_BYTES,