Set MAX_PRF_HALF bigger for large FFDHE parameters

Stack size measurement is in a thread - free local fp_cache
This commit is contained in:
Sean Parkinson
2019-02-21 08:09:52 +10:00
parent 7aa5cd6f10
commit b4996e35fa
3 changed files with 13 additions and 2 deletions

View File

@@ -3185,6 +3185,11 @@ exit:
wolfAsync_DevClose(&devId);
#endif
#if defined(HAVE_ECC) && defined(FP_ECC) && defined(HAVE_THREAD_LS) \
&& defined(HAVE_STACK_SIZE)
wc_ecc_fp_free(); /* free per thread cache */
#endif
/* There are use cases when these assignments are not read. To avoid
* potential confusion those warnings have been handled here.
*/

View File

@@ -2279,8 +2279,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
exit:
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
#if defined(HAVE_ECC) && defined(FP_ECC) && defined(HAVE_THREAD_LS) \
&& (defined(NO_MAIN_DRIVER) || defined(HAVE_STACK_SIZE))
wc_ecc_fp_free(); /* free per thread cache */
#endif

View File

@@ -194,7 +194,13 @@ WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
#endif /* WOLFSSL_SHA512 */
enum max_prf {
#ifdef HAVE_FFDHE_8192
MAX_PRF_HALF = 512, /* Maximum half secret len */
#elif defined(HAVE_FFDHE_6144)
MAX_PRF_HALF = 384, /* Maximum half secret len */
#else
MAX_PRF_HALF = 256, /* Maximum half secret len */
#endif
MAX_PRF_LABSEED = 128, /* Maximum label + seed len */
MAX_PRF_DIG = 224 /* Maximum digest len */
};