From 8c9c8d322c13269d0796bd2b600193d9eb5bfc0b Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Wed, 11 Jul 2018 12:50:40 -0400 Subject: [PATCH] rev148: Rework _DRBG_STATE_SAVE Signed-off-by: Stefan Berger --- src/tpm2/TpmBuildSwitches.h | 7 +++++-- src/tpm2/crypto/openssl/CryptRand.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tpm2/TpmBuildSwitches.h b/src/tpm2/TpmBuildSwitches.h index 8d3901e..d52856d 100644 --- a/src/tpm2/TpmBuildSwitches.h +++ b/src/tpm2/TpmBuildSwitches.h @@ -121,9 +121,12 @@ //# define RSA_INSTRUMENT #endif /* This switch enables the RNG state save and restore */ -#ifndef _DRBG_STATE_SAVE -# define _DRBG_STATE_SAVE // Comment this out if no state save is wanted +#if !(defined _DRBG_STATE_SAVE) \ + || ((_DRBG_STATE_SAVE != NO) && (_DRBG_STATE_SAVE != YES)) +# undef _DRBG_STATE_SAVE +# define _DRBG_STATE_SAVE YES // Default: Either YES or NO #endif + /* Switch added to support packed lists that leave out space associated with unimplemented commands. Comment this out to use linear lists. */ /* NOTE: if vendor specific commands are present, the associated list is always in compressed diff --git a/src/tpm2/crypto/openssl/CryptRand.c b/src/tpm2/crypto/openssl/CryptRand.c index 0363daf..54eb18b 100644 --- a/src/tpm2/crypto/openssl/CryptRand.c +++ b/src/tpm2/crypto/openssl/CryptRand.c @@ -626,7 +626,7 @@ CryptRandStartup( void ) { -#ifndef _DRBG_STATE_SAVE +#if !_DRBG_STATE_SAVE // If not saved in NV, re-instantiate on each startup DRBG_Instantiate(&drbgDefault, 0, NULL); #else -- 2.39.5