Skip to content

Commit 8ff0f45

Browse files
authored
Merge pull request #9067 from douzzer/20250805-clang-and-linuxkm-fixes
20250805-clang-and-linuxkm-fixes
2 parents 649b6ed + 034cbb9 commit 8ff0f45

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

tests/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ static int test_wolfSSL_CertManagerAPI(void)
30453045
EXPECT_DECLS;
30463046
#ifndef NO_CERTS
30473047
WOLFSSL_CERT_MANAGER* cm = NULL;
3048-
unsigned char c;
3048+
unsigned char c = 0;
30493049

30503050
ExpectNotNull(cm = wolfSSL_CertManagerNew_ex(NULL));
30513051

wolfcrypt/benchmark/benchmark.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,7 @@
620620

621621
/* optional macro to add sleep between tests */
622622
#ifndef TEST_SLEEP
623-
/* stub the sleep macro */
624-
#define TEST_SLEEP() WC_DO_NOTHING
623+
#define TEST_SLEEP() WC_RELAX_LONG_LOOP()
625624
#endif
626625

627626
#define TEST_STRING "Everyone gets Friday off."
@@ -2347,10 +2346,18 @@ static WC_INLINE void bench_stats_start(int* count, double* start)
23472346
#ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
23482347
#define bench_stats_start(count, start) do { \
23492348
SAVE_VECTOR_REGISTERS(pr_err( \
2350-
"SAVE_VECTOR_REGISTERS failed for benchmark run."); \
2349+
"ERROR: SAVE_VECTOR_REGISTERS failed for benchmark run."); \
23512350
return; ); \
23522351
bench_stats_start(count, start); \
23532352
} while (0)
2353+
#elif defined(WOLFSSL_LINUXKM)
2354+
/* we're using floating point to figure the statistics, so we need to
2355+
* FPU save+lock even without SIMD.
2356+
*/
2357+
#define bench_stats_start(count, start) do { \
2358+
kernel_fpu_begin(); \
2359+
bench_stats_start(count, start); \
2360+
} while (0)
23542361
#endif
23552362

23562363
static WC_INLINE int bench_stats_check(double start)
@@ -2543,8 +2550,6 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
25432550

25442551
total = current_time(0) - start;
25452552

2546-
WC_RELAX_LONG_LOOP();
2547-
25482553
#if defined(WOLFSSL_ESPIDF) && defined(DEBUG_WOLFSSL_BENCHMARK_TIMING)
25492554
ESP_LOGI(TAG, "%s total_cycles = %llu", desc, total_cycles);
25502555
#endif
@@ -2743,6 +2748,8 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
27432748

27442749
#ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
27452750
RESTORE_VECTOR_REGISTERS();
2751+
#elif defined(WOLFSSL_LINUXKM)
2752+
kernel_fpu_end();
27462753
#endif
27472754

27482755
TEST_SLEEP();
@@ -2775,8 +2782,6 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength,
27752782

27762783
total = current_time(0) - start;
27772784

2778-
WC_RELAX_LONG_LOOP();
2779-
27802785
#ifdef LINUX_RUSAGE_UTIME
27812786
check_for_excessive_stime(algo, strength, desc, desc_extra);
27822787
#endif
@@ -3006,6 +3011,8 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength,
30063011

30073012
#ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
30083013
RESTORE_VECTOR_REGISTERS();
3014+
#elif defined(WOLFSSL_LINUXKM)
3015+
kernel_fpu_end();
30093016
#endif
30103017

30113018
TEST_SLEEP();

0 commit comments

Comments
 (0)