diff --git a/src/crl.c b/src/crl.c index e4a876aad..09e633373 100755 --- a/src/crl.c +++ b/src/crl.c @@ -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 diff --git a/src/ocsp.c b/src/ocsp.c index bcf973b54..0af304f34 100644 --- a/src/ocsp.c +++ b/src/ocsp.c @@ -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; } diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index a9d4b9234..669d54d43 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -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); } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 28d2bc1bf..627c482ac 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -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 @@ -12584,6 +12584,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); @@ -12620,7 +12621,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; @@ -12639,7 +12640,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; @@ -12657,6 +12659,7 @@ done: mp_clear(&p); mp_clear(&r2); mp_clear(&r1); + mp_clear(&b); mp_clear(&a); wc_FreeRng(&rng); return ret; diff --git a/wolfssl/wolfcrypt/tfm.h b/wolfssl/wolfcrypt/tfm.h index 6fe7c03bb..53357b78a 100644 --- a/wolfssl/wolfcrypt/tfm.h +++ b/wolfssl/wolfcrypt/tfm.h @@ -608,6 +608,7 @@ typedef fp_int mp_int; #define MP_YES FP_YES /* yes/no result */ #define MP_ZPOS FP_ZPOS #define MP_NEG FP_NEG +#define MP_MASK FP_MASK /* Prototypes */ #define mp_zero(a) fp_zero(a)