From f2d9eb2994e9b8a88e92e21a02db8b59e9ffa840 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 15 Jun 2015 15:47:40 -0700 Subject: [PATCH 1/2] 1. Disable randomized base address on FIPS test project. 2. Fixed setting for disabling whole program optimization on file fips.c in the windows project file. --- IDE/WIN/test.vcxproj | 9 ++++++++- IDE/WIN/wolfssl-fips.vcxproj | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/IDE/WIN/test.vcxproj b/IDE/WIN/test.vcxproj index 4ee75a0e1..47681399b 100644 --- a/IDE/WIN/test.vcxproj +++ b/IDE/WIN/test.vcxproj @@ -123,6 +123,7 @@ Console MachineX86 ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + false @@ -160,6 +161,7 @@ true MachineX86 UseLinkTimeCodeGeneration + false @@ -179,6 +181,7 @@ true true UseLinkTimeCodeGeneration + false @@ -191,6 +194,7 @@ Level3 ProgramDatabase + false true @@ -214,6 +218,7 @@ true Console ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + false @@ -233,6 +238,7 @@ true MachineX86 UseLinkTimeCodeGeneration + false @@ -251,6 +257,7 @@ true true UseLinkTimeCodeGeneration + false @@ -265,4 +272,4 @@ - \ No newline at end of file + diff --git a/IDE/WIN/wolfssl-fips.vcxproj b/IDE/WIN/wolfssl-fips.vcxproj index 7936ee730..04c22c407 100644 --- a/IDE/WIN/wolfssl-fips.vcxproj +++ b/IDE/WIN/wolfssl-fips.vcxproj @@ -250,9 +250,9 @@ $(IntDir)ctaocrypt\ false - false - true false + false + false $(IntDir)ctaocrypt\ @@ -314,4 +314,4 @@ - \ No newline at end of file + From 8fa258c657fbab6de8c5210a28b64ebb12fcc015 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 15 Jun 2015 17:52:30 -0700 Subject: [PATCH 2/2] fix scan-build warning --- wolfcrypt/src/random.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 34763ae8b..4a1f7ea5b 100755 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -418,12 +418,16 @@ static int Hash_DRBG_Instantiate(DRBG* drbg, const byte* seed, word32 seedSz, /* Returns: DRBG_SUCCESS or DRBG_FAILURE */ static int Hash_DRBG_Uninstantiate(DRBG* drbg) { - volatile DRBG clear = {0, 0, {0}, {0}, 0}; + word32 i; + int compareSum = 0; + byte* compareDrbg = (byte*)drbg; ForceZero(drbg, sizeof(DRBG)); - return (ConstantCompare((byte*)drbg, (byte*)&clear, sizeof(DRBG)) == 0) ? - DRBG_SUCCESS : DRBG_FAILURE; + for (i = 0; i < sizeof(DRBG); i++) + compareSum |= compareDrbg[i] ^ 0; + + return (compareSum == 0) ? DRBG_SUCCESS : DRBG_FAILURE; } /* End NIST DRBG Code */