-
Notifications
You must be signed in to change notification settings - Fork 957
use heap hints where possible in benchmark #10121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2548,7 +2548,7 @@ typedef enum bench_stat_type { | |
|
|
||
| if (bstat == NULL) { | ||
| /* allocate new and put on list */ | ||
| bstat = (bench_stats_t*)XMALLOC(sizeof(bench_stats_t), NULL, | ||
| bstat = (bench_stats_t*)XMALLOC(sizeof(bench_stats_t), HEAP_HINT, | ||
| DYNAMIC_TYPE_INFO); | ||
| if (bstat) { | ||
| XMEMSET(bstat, 0, sizeof(bench_stats_t)); | ||
|
|
@@ -3614,7 +3614,7 @@ static WC_INLINE void bench_stats_free(void) | |
| bench_stats_t* bstat; | ||
| for (bstat = bench_stats_head; bstat != NULL; ) { | ||
| bench_stats_t* next = bstat->next; | ||
| XFREE(bstat, NULL, DYNAMIC_TYPE_INFO); | ||
| XFREE(bstat, HEAP_HINT, DYNAMIC_TYPE_INFO); | ||
| bstat = next; | ||
| } | ||
| bench_stats_head = NULL; | ||
|
|
@@ -5968,7 +5968,7 @@ static void bench_aesofb_internal(const byte* key, | |
|
|
||
| bench_stats_prepare(); | ||
|
|
||
| ret = wc_AesInit(&enc, NULL, INVALID_DEVID); | ||
| ret = wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID); | ||
| if (ret != 0) { | ||
| printf("AesInit failed at L%d, ret = %d\n", __LINE__, ret); | ||
| return; | ||
|
|
@@ -11035,7 +11035,7 @@ static void bench_lms_keygen(enum wc_LmsParm parm, byte* pub) | |
| return; | ||
| } | ||
|
|
||
| ret = wc_LmsKey_Init(&key, NULL, INVALID_DEVID); | ||
| ret = wc_LmsKey_Init(&key, HEAP_HINT, devId); | ||
|
||
| if (ret) { | ||
| printf("wc_LmsKey_Init failed: %d\n", ret); | ||
| wc_FreeRng(&rng); | ||
|
|
@@ -11051,7 +11051,7 @@ static void bench_lms_keygen(enum wc_LmsParm parm, byte* pub) | |
|
|
||
| wc_LmsKey_Free(&key); | ||
|
|
||
| ret = wc_LmsKey_Init(&key, NULL, INVALID_DEVID); | ||
| ret = wc_LmsKey_Init(&key, HEAP_HINT, devId); | ||
| if (ret) { | ||
| printf("wc_LmsKey_Init failed: %d\n", ret); | ||
| goto exit_lms_keygen; | ||
|
|
@@ -11140,7 +11140,7 @@ static void bench_lms_sign_verify(enum wc_LmsParm parm, byte* pub) | |
|
|
||
| bench_stats_prepare(); | ||
|
|
||
| ret = wc_LmsKey_Init(&key, NULL, INVALID_DEVID); | ||
| ret = wc_LmsKey_Init(&key, HEAP_HINT, devId); | ||
| if (ret) { | ||
| printf("wc_LmsKey_Init failed: %d\n", ret); | ||
| goto exit_lms_sign_verify; | ||
|
|
@@ -11571,7 +11571,7 @@ static void bench_xmss_sign_verify(const char * params) | |
|
|
||
| freeRng = 1; | ||
|
|
||
| ret = wc_XmssKey_Init(&key, NULL, INVALID_DEVID); | ||
| ret = wc_XmssKey_Init(&key, HEAP_HINT, devId); | ||
| if (ret != 0) { | ||
| printf("wc_XmssKey_Init failed: %d\n", ret); | ||
| goto exit_xmss_sign_verify; | ||
|
|
@@ -12056,7 +12056,7 @@ void bench_slhdsa(enum SlhDsaParam param) | |
| WC_ALLOC_VAR_EX(sig, byte, WC_SLHDSA_MAX_SIG_LEN, HEAP_HINT, | ||
| DYNAMIC_TYPE_TMP_BUFFER, goto exit); | ||
|
|
||
| ret = wc_SlhDsaKey_Init(key, param, NULL, INVALID_DEVID); | ||
| ret = wc_SlhDsaKey_Init(key, param, HEAP_HINT, devId); | ||
| if (ret != 0) { | ||
| goto exit; | ||
| } | ||
|
|
@@ -12105,7 +12105,7 @@ void bench_slhdsa(enum SlhDsaParam param) | |
| goto exit; | ||
| } | ||
|
|
||
| ret = wc_SlhDsaKey_Init(key_vfy, param, NULL, INVALID_DEVID); | ||
| ret = wc_SlhDsaKey_Init(key_vfy, param, HEAP_HINT, devId); | ||
| if (ret != 0) { | ||
| goto exit; | ||
| } | ||
|
|
@@ -13583,7 +13583,7 @@ void bench_eccsiKeyGen(void) | |
| bench_stats_start(&count, &start); | ||
| do { | ||
| for (i = 0; i < genTimes; i++) { | ||
| wc_InitEccsiKey(genKey, NULL, INVALID_DEVID); | ||
| wc_InitEccsiKey(genKey, HEAP_HINT, devId); | ||
| ret = wc_MakeEccsiKey(genKey, &gRng); | ||
| wc_FreeEccsiKey(genKey); | ||
| if (ret != 0) { | ||
|
|
@@ -13628,7 +13628,7 @@ void bench_eccsiPairGen(void) | |
|
|
||
| (void)mp_init(ssk); | ||
| pvt = wc_ecc_new_point(); | ||
| wc_InitEccsiKey(genKey, NULL, INVALID_DEVID); | ||
| wc_InitEccsiKey(genKey, HEAP_HINT, devId); | ||
| (void)wc_MakeEccsiKey(genKey, &gRng); | ||
|
|
||
| /* RSK Gen */ | ||
|
|
@@ -13687,7 +13687,7 @@ void bench_eccsiValidate(void) | |
|
|
||
| (void)mp_init(ssk); | ||
| pvt = wc_ecc_new_point(); | ||
| wc_InitEccsiKey(genKey, NULL, INVALID_DEVID); | ||
| wc_InitEccsiKey(genKey, HEAP_HINT, devId); | ||
| (void)wc_MakeEccsiKey(genKey, &gRng); | ||
| (void)wc_MakeEccsiPair(genKey, &gRng, WC_HASH_TYPE_SHA256, id, sizeof(id), | ||
| ssk, pvt); | ||
|
|
@@ -13752,7 +13752,7 @@ void bench_eccsi(void) | |
|
|
||
| (void)mp_init(ssk); | ||
| pvt = wc_ecc_new_point(); | ||
| (void)wc_InitEccsiKey(genKey, NULL, INVALID_DEVID); | ||
| (void)wc_InitEccsiKey(genKey, HEAP_HINT, devId); | ||
| (void)wc_MakeEccsiKey(genKey, &gRng); | ||
| (void)wc_MakeEccsiPair(genKey, &gRng, WC_HASH_TYPE_SHA256, id, sizeof(id), | ||
| ssk, pvt); | ||
|
|
@@ -13843,7 +13843,7 @@ void bench_sakkeKeyGen(void) | |
| bench_stats_start(&count, &start); | ||
| do { | ||
| for (i = 0; i < genTimes; i++) { | ||
| wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, NULL, INVALID_DEVID); | ||
| wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, HEAP_HINT, devId); | ||
| ret = wc_MakeSakkeKey(genKey, &gRng); | ||
| if (ret != 0) { | ||
| printf("wc_MakeSakkeKey failed: %d\n", ret); | ||
|
|
@@ -13885,7 +13885,7 @@ void bench_sakkeRskGen(void) | |
| WC_ALLOC_VAR(genKey, SakkeKey, 1, HEAP_HINT); | ||
|
|
||
| rsk = wc_ecc_new_point(); | ||
| wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, NULL, INVALID_DEVID); | ||
| wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, HEAP_HINT, devId); | ||
| (void)wc_MakeSakkeKey(genKey, &gRng); | ||
|
|
||
| /* RSK Gen */ | ||
|
|
@@ -13938,7 +13938,7 @@ void bench_sakkeValidate(void) | |
| WC_ALLOC_VAR(genKey, SakkeKey, 1, HEAP_HINT); | ||
|
|
||
| rsk = wc_ecc_new_point(); | ||
| (void)wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, NULL, INVALID_DEVID); | ||
| (void)wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, HEAP_HINT, devId); | ||
| (void)wc_MakeSakkeKey(genKey, &gRng); | ||
| (void)wc_MakeSakkeRsk(genKey, id, sizeof(id), rsk); | ||
| (void)wc_ValidateSakkeRsk(genKey, id, sizeof(id), rsk, &valid); | ||
|
|
@@ -14002,7 +14002,7 @@ void bench_sakke(void) | |
| XMEMCPY(ssv, ssv_init, sizeof ssv); | ||
|
|
||
| rsk = wc_ecc_new_point(); | ||
| (void)wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, NULL, INVALID_DEVID); | ||
| (void)wc_InitSakkeKey_ex(genKey, 128, ECC_SAKKE_1, HEAP_HINT, devId); | ||
| (void)wc_MakeSakkeKey(genKey, &gRng); | ||
| (void)wc_MakeSakkeRsk(genKey, id, sizeof(id), rsk); | ||
| (void)wc_SetSakkeRsk(genKey, rsk, NULL, 0); | ||
|
|
@@ -14229,9 +14229,9 @@ void bench_falconKeySign(byte level) | |
|
|
||
| bench_stats_prepare(); | ||
|
|
||
| ret = wc_falcon_init(&key); | ||
| ret = wc_falcon_init_ex(&key, HEAP_HINT, devId); | ||
| if (ret != 0) { | ||
| printf("wc_falcon_init failed %d\n", ret); | ||
| printf("wc_falcon_init_ex failed %d\n", ret); | ||
|
Comment on lines
+14232
to
+14234
|
||
| return; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Device-id usage is inconsistent across benchmarks: many call sites in this PR were changed to pass
devId, but AES-OFB still usesINVALID_DEVID. IfdevIdis the benchmark’s intended device selection mechanism, consider standardizing ondevIdhere too for consistent behavior and easier benchmarking comparisons across algorithms.