diff --git a/tests/api.c b/tests/api.c index e87be69c0..f0e92b40b 100644 --- a/tests/api.c +++ b/tests/api.c @@ -3045,7 +3045,7 @@ static int test_wolfSSL_CertManagerAPI(void) EXPECT_DECLS; #ifndef NO_CERTS WOLFSSL_CERT_MANAGER* cm = NULL; - unsigned char c; + unsigned char c = 0; ExpectNotNull(cm = wolfSSL_CertManagerNew_ex(NULL)); diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 373816ffb..cd6bb125a 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -620,8 +620,7 @@ /* optional macro to add sleep between tests */ #ifndef TEST_SLEEP - /* stub the sleep macro */ - #define TEST_SLEEP() WC_DO_NOTHING + #define TEST_SLEEP() WC_RELAX_LONG_LOOP() #endif #define TEST_STRING "Everyone gets Friday off." @@ -2347,10 +2346,18 @@ static WC_INLINE void bench_stats_start(int* count, double* start) #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS #define bench_stats_start(count, start) do { \ SAVE_VECTOR_REGISTERS(pr_err( \ - "SAVE_VECTOR_REGISTERS failed for benchmark run."); \ + "ERROR: SAVE_VECTOR_REGISTERS failed for benchmark run."); \ return; ); \ bench_stats_start(count, start); \ } while (0) +#elif defined(WOLFSSL_LINUXKM) + /* we're using floating point to figure the statistics, so we need to + * FPU save+lock even without SIMD. + */ + #define bench_stats_start(count, start) do { \ + kernel_fpu_begin(); \ + bench_stats_start(count, start); \ + } while (0) #endif static WC_INLINE int bench_stats_check(double start) @@ -2543,8 +2550,6 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID, total = current_time(0) - start; - WC_RELAX_LONG_LOOP(); - #if defined(WOLFSSL_ESPIDF) && defined(DEBUG_WOLFSSL_BENCHMARK_TIMING) ESP_LOGI(TAG, "%s total_cycles = %llu", desc, total_cycles); #endif @@ -2743,6 +2748,8 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID, #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS RESTORE_VECTOR_REGISTERS(); +#elif defined(WOLFSSL_LINUXKM) + kernel_fpu_end(); #endif TEST_SLEEP(); @@ -2775,8 +2782,6 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength, total = current_time(0) - start; - WC_RELAX_LONG_LOOP(); - #ifdef LINUX_RUSAGE_UTIME check_for_excessive_stime(algo, strength, desc, desc_extra); #endif @@ -3006,6 +3011,8 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength, #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS RESTORE_VECTOR_REGISTERS(); +#elif defined(WOLFSSL_LINUXKM) + kernel_fpu_end(); #endif TEST_SLEEP();