cleanup fp cache on examples with thread local storage

This commit is contained in:
toddouska 2014-09-09 10:14:32 -07:00
parent 2c595139db
commit 6175a2a20c
5 changed files with 36 additions and 1 deletions

View File

@ -250,6 +250,9 @@ int benchmark_test(void *args)
#ifdef HAVE_ECC
bench_eccKeyGen();
bench_eccKeyAgree();
#if defined(FP_ECC)
ecc_fp_free();
#endif
#endif
return 0;

View File

@ -24,6 +24,9 @@
#endif
#include <cyassl/ctaocrypt/settings.h>
#ifdef HAVE_ECC
#include <cyassl/ctaocrypt/ecc.h> /* ecc_fp_free */
#endif
#if defined(CYASSL_MDK_ARM)
#include <stdio.h>
@ -328,6 +331,11 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
((func_args*)args)->return_code = 0;
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
ecc_fp_free(); /* free per thread cache */
#endif
#ifdef CYASSL_TIRTOS
fdCloseSession(Task_self());
#endif

View File

@ -24,6 +24,9 @@
#endif
#include <cyassl/ctaocrypt/settings.h>
#ifdef HAVE_ECC
#include <cyassl/ctaocrypt/ecc.h> /* ecc_fp_free */
#endif
#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
/* in case memory tracker wants stats */
@ -536,10 +539,16 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
CloseSocket(clientfd);
((func_args*)args)->return_code = 0;
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
ecc_fp_free(); /* free per thread cache */
#endif
#ifdef USE_CYASSL_MEMORY
if (trackMemory)
ShowMemoryTracker();
#endif /* USE_CYASSL_MEMORY */
#endif
#ifdef CYASSL_TIRTOS
fdCloseSession(Task_self());

View File

@ -28,6 +28,9 @@
#endif
#include <cyassl/ctaocrypt/settings.h>
#ifdef HAVE_ECC
#include <cyassl/ctaocrypt/ecc.h> /* ecc_fp_free */
#endif
#include <cyassl/error-ssl.h>
#include <stdlib.h>
@ -402,6 +405,11 @@ done:
fdCloseSession(Task_self());
#endif
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
ecc_fp_free(); /* free per thread cache */
#endif
#ifndef CYASSL_TIRTOS
return 0;
#endif
@ -590,6 +598,12 @@ static THREAD_RETURN CYASSL_THREAD run_cyassl_server(void* args)
#ifdef CYASSL_TIRTOS
fdCloseSession(Task_self());
#endif
#if defined(NO_MAIN_DRIVER) && defined(HAVE_ECC) && defined(FP_ECC) \
&& defined(HAVE_THREAD_LS)
ecc_fp_free(); /* free per thread cache */
#endif
#ifndef CYASSL_TIRTOS
return 0;
#endif

View File

@ -460,6 +460,7 @@ int SuiteTest(void)
printf(" End Cipher Suite Tests\n");
CyaSSL_CTX_free(cipherSuiteCtx);
CyaSSL_Cleanup();
return args.return_code;
}