Fixes for extended configuration testing

This commit is contained in:
Sean Parkinson
2017-03-13 11:33:39 +10:00
parent a6cbfe6f93
commit 614231f71c
4 changed files with 20 additions and 16 deletions

View File

@@ -790,12 +790,12 @@ static int StartMonitorCRL(WOLFSSL_CRL* crl)
/* Load CRL path files of type, SSL_SUCCESS on ok */
int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
{
int ret = SSL_SUCCESS;
char* name = NULL;
int ret = SSL_SUCCESS;
char* name = NULL;
#ifdef WOLFSSL_SMALL_STACK
ReadDirCtx* readCtx = NULL;
#else
ReadDirCtx readCtx[1];
ReadDirCtx readCtx[1];
#endif
WOLFSSL_ENTER("LoadCRL");
@@ -803,10 +803,9 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
return BAD_FUNC_ARG;
#ifdef WOLFSSL_SMALL_STACK
ReadDirCtx* readCtx = NULL;
readCtx = (char*)XMALLOC(sizeof(ReadDirCtx), ctx->heap,
DYNAMIC_TYPE_TMP_BUFFER);
if (name == NULL)
readCtx = (ReadDirCtx*)XMALLOC(sizeof(ReadDirCtx), crl->heap,
DYNAMIC_TYPE_TMP_BUFFER);
if (readCtx == NULL)
return MEMORY_E;
#endif

View File

@@ -278,8 +278,6 @@ static int CheckResponse(WOLFSSL_OCSP* ocsp, byte* response, int responseSz,
if (newStatus) XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (ocspResponse) XFREE(ocspResponse, NULL, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(request, NULL, DYNAMIC_TYPE_OCSP);
WOLFSSL_LEAVE("CheckCertOCSP", MEMORY_ERROR);
return MEMORY_E;
}

View File

@@ -542,6 +542,7 @@ void mp_rshb (mp_int *c, int x)
/* set the carry to the carry bits of the current word found above */
r = rr;
}
mp_clamp(c);
}
@@ -4100,14 +4101,17 @@ int mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
c->used = a->used;
/* subtract first digit */
*tmpc = *tmpa++ - b;
mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1);
*tmpc = *tmpa - b;
if (b > *tmpa++)
mu = ((-*tmpc) >> DIGIT_BIT) + 1;
else
mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK;
/* handle rest of the digits */
for (ix = 1; ix < a->used; ix++) {
*tmpc = *tmpa++ - mu;
mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1);
mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK;
}
}

View File

@@ -254,7 +254,7 @@ int scrypt_test(void);
int pkcs7signed_test(void);
int pkcs7encrypted_test(void);
#endif
#if !defined(NO_ASN_TIME) && defined(WOLFSSL_TEST_CERT)
#if !defined(NO_ASN_TIME) && !defined(NO_RSA) && defined(WOLFSSL_TEST_CERT)
int cert_test(void);
#endif
#if defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_TEST_CERT)
@@ -660,7 +660,7 @@ int wolfcrypt_test(void* args)
printf( "RSA test passed!\n");
#endif
#if !defined(NO_ASN_TIME) && defined(WOLFSSL_TEST_CERT)
#if !defined(NO_ASN_TIME) && !defined(NO_RSA) && defined(WOLFSSL_TEST_CERT)
if ( (ret = cert_test()) != 0)
return err_sys("CERT test failed!\n", ret);
else
@@ -12522,6 +12522,7 @@ int mp_test()
ret = wc_RNG_GenerateBlock(&rng, (byte*)&d, sizeof(d));
if (ret != 0)
return -11003;
d &= MP_MASK;
/* Ensure sqrmod produce same result as mulmod. */
ret = mp_sqrmod(&a, &p, &r1);
@@ -12558,7 +12559,7 @@ int mp_test()
* - if p and a are even it will fail.
*/
ret = mp_invmod(&a, &p, &r1);
if (ret != 0 && ret != FP_VAL)
if (ret != 0 && ret != MP_VAL)
return -11019;
ret = 0;
@@ -12577,7 +12578,8 @@ int mp_test()
}
}
/* Check that setting a digit works. */
/* Check that setting a 32-bit digit works. */
d &= 0xffffffff;
mp_set_int(&a, d);
if (a.used != 1 || a.dp[0] != d)
return -11025;
@@ -12595,6 +12597,7 @@ done:
mp_clear(&p);
mp_clear(&r2);
mp_clear(&r1);
mp_clear(&b);
mp_clear(&a);
wc_FreeRng(&rng);
return ret;