Skip to content

Commit a220564

Browse files
committed
Further improvements to support benchmark
1 parent 9af0051 commit a220564

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

include/user_settings.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,15 @@ extern int tolower(int c);
584584
#if defined(WOLFCRYPT_TEST) || defined(WOLFCRYPT_BENCHMARK)
585585
#define NO_WRITE_TEMP_FILES
586586

587-
/* Enable malloc for test/benchmark (they need dynamic allocation) */
588-
#undef NO_WOLFSSL_MEMORY
589-
#undef WOLFSSL_NO_MALLOC
587+
/* Use static memory pool to avoid system malloc dependency.
588+
* benchmark.c provides gBenchMemory static buffer.
589+
* Default is 50KB with BENCH_EMBEDDED, override for smaller targets */
590+
#ifndef WOLFSSL_STATIC_MEMORY
591+
#define WOLFSSL_STATIC_MEMORY
592+
#endif
593+
#ifndef WOLFSSL_STATIC_MEMORY_TEST_SZ
594+
#define WOLFSSL_STATIC_MEMORY_TEST_SZ (10 * 1024)
595+
#endif
590596

591597
/* Enable SP math digit operations */
592598
#define WOLFSSL_SP_MUL_D
@@ -629,7 +635,8 @@ extern int tolower(int c);
629635
# define WOLFSSL_SP_NO_DYN_STACK
630636
# endif
631637
# if !defined(SECURE_PKCS11) && !defined(WOLFCRYPT_TZ_PSA) && \
632-
!defined(WOLFBOOT_ENABLE_WOLFHSM_SERVER)
638+
!defined(WOLFBOOT_ENABLE_WOLFHSM_SERVER) && \
639+
!defined(WOLFCRYPT_TEST) && !defined(WOLFCRYPT_BENCHMARK)
633640
# define NO_WOLFSSL_MEMORY
634641
# define WOLFSSL_NO_MALLOC
635642
# endif

test-app/ARM-va416x0.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_Min_Heap_Size = 0x00003000; /* required amount of heap */
1+
_Min_Heap_Size = 0x00000100; /* minimal heap (not using malloc) */
22
_Min_Stack_Size = 0x00003000; /* required amount of stack */
33

44
/* Memory areas */

test-app/wolfcrypt_support.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ double current_time(int reset)
8787

8888
/* ========== RNG SEED FUNCTIONS ========== */
8989

90-
#ifdef WOLFCRYPT_TEST
9190
/*
9291
* RNG seed generation strategy:
9392
* 1. If WOLFCRYPT_SECURE_MODE - use secure TRNG
@@ -98,7 +97,7 @@ double current_time(int reset)
9897
/* Simple incrementing RNG for testing (not cryptographically secure) */
9998
static uint32_t test_rng_counter = 0x12345678;
10099

101-
/* my_rng_seed_gen() - Generate random seed/data for test suite
100+
/* my_rng_seed_gen() - Generate random seed/data for test/benchmark
102101
* This is NOT cryptographically secure - only for testing!
103102
* Returns: 0 on success
104103
*/
@@ -114,8 +113,4 @@ int my_rng_seed_gen(unsigned char* output, unsigned int sz)
114113
return 0;
115114
}
116115

117-
/* Alias for block generation - same implementation */
118-
#define my_rng_gen_block my_rng_seed_gen
119-
#endif /* WOLFCRYPT_TEST */
120-
121116
#endif /* WOLFCRYPT_TEST || WOLFCRYPT_BENCHMARK */

0 commit comments

Comments
 (0)