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

@@ -803,10 +803,9 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
ReadDirCtx* readCtx = NULL; readCtx = (ReadDirCtx*)XMALLOC(sizeof(ReadDirCtx), crl->heap,
readCtx = (char*)XMALLOC(sizeof(ReadDirCtx), ctx->heap,
DYNAMIC_TYPE_TMP_BUFFER); DYNAMIC_TYPE_TMP_BUFFER);
if (name == NULL) if (readCtx == NULL)
return MEMORY_E; return MEMORY_E;
#endif #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 (newStatus) XFREE(newStatus, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (ocspResponse) XFREE(ocspResponse, 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); WOLFSSL_LEAVE("CheckCertOCSP", MEMORY_ERROR);
return MEMORY_E; 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 */ /* set the carry to the carry bits of the current word found above */
r = rr; 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; c->used = a->used;
/* subtract first digit */ /* subtract first digit */
*tmpc = *tmpa++ - b; *tmpc = *tmpa - b;
mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); if (b > *tmpa++)
mu = ((-*tmpc) >> DIGIT_BIT) + 1;
else
mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK; *tmpc++ &= MP_MASK;
/* handle rest of the digits */ /* handle rest of the digits */
for (ix = 1; ix < a->used; ix++) { for (ix = 1; ix < a->used; ix++) {
*tmpc = *tmpa++ - mu; *tmpc = *tmpa++ - mu;
mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); mu = *tmpc >> DIGIT_BIT;
*tmpc++ &= MP_MASK; *tmpc++ &= MP_MASK;
} }
} }

View File

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