Test Fixes

1. Update gitignore with some more VS outputs.
2. Update the Windows IDE user settings with FIPSv2 settings.
3. Remove redundant _InitHmac() function from ssl.c.
4. In wc_DhGenerateParams(), initialize the groupSz and bufSz to 0.
5. In wc_DhExportParamsRaw(), initialize pLen, qLen, and gLen to 0.
6. In wc_MakeRsaKey(), initialize isPrime to 0.
7. In ecc_test_make_pub(), initialize exportBuf and tmp to NULL and initialize the ECC key before any chance of trying to free it.
8. In fips_test.h header, update types.h include to use the wolfCrypt types rather than ctaocrypt types.
9. In fips_test.h header, change the visibility tags on all the function prototypes to use the WOLFSSL tags rather than CYASSL.
10. Change the wolfCrypt visibility tags to use CyaSSL's tags for old FIPS and the regular tags for new FIPS and non-FIPS builds.
This commit is contained in:
John Safranek
2018-04-03 15:48:19 -07:00
parent 90f05ba3ff
commit 6b7e833d53
8 changed files with 42 additions and 75 deletions

View File

@@ -1247,7 +1247,7 @@ int wc_DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g,
int wc_DhGenerateParams(WC_RNG *rng, int modSz, DhKey *dh)
{
mp_int tmp, tmp2;
int groupSz, bufSz = 0,
int groupSz = 0, bufSz = 0,
primeCheckCount = 0,
primeCheck = MP_NO,
ret = 0;
@@ -1407,7 +1407,7 @@ int wc_DhExportParamsRaw(DhKey* dh, byte* p, word32* pSz,
byte* q, word32* qSz, byte* g, word32* gSz)
{
int ret = 0;
word32 pLen, qLen, gLen;
word32 pLen = 0, qLen = 0, gLen = 0;
if (dh == NULL || pSz == NULL || qSz == NULL || gSz == NULL)
ret = BAD_FUNC_ARG;

View File

@@ -2684,7 +2684,7 @@ int wc_CheckProbablePrime(const byte* pRaw, word32 pRawSz,
int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng)
{
mp_int p, q, tmp1, tmp2, tmp3;
int err, i, failCount, primeSz, isPrime;
int err, i, failCount, primeSz, isPrime = 0;
byte* buf = NULL;
if (key == NULL || rng == NULL)

View File

@@ -13893,8 +13893,8 @@ done:
static int ecc_test_make_pub(WC_RNG* rng)
{
ecc_key key;
unsigned char* exportBuf;
unsigned char* tmp;
unsigned char* exportBuf = NULL;
unsigned char* tmp = NULL;
unsigned char msg[] = "test wolfSSL ECC public gen";
word32 x, tmpSz;
int ret = 0;
@@ -13909,14 +13909,15 @@ static int ecc_test_make_pub(WC_RNG* rng)
FILE* file;
#endif
wc_ecc_init(&key);
tmp = (byte*)XMALLOC(FOURK_BUF, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
if (tmp == NULL) {
return -6810;
ERROR_OUT(-6810, done);
}
exportBuf = (byte*)XMALLOC(FOURK_BUF, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
if (exportBuf == NULL) {
XFREE(tmp, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
return -6811;
ERROR_OUT(-6811, done);
}
#ifdef USE_CERT_BUFFERS_256
@@ -13932,8 +13933,6 @@ static int ecc_test_make_pub(WC_RNG* rng)
fclose(file);
#endif /* USE_CERT_BUFFERS_256 */
wc_ecc_init(&key);
/* import private only then test with */
ret = wc_ecc_import_private_key(tmp, tmpSz, NULL, 0, NULL);
if (ret == 0) {