Skip to content

Commit 138d699

Browse files
author
Lealem Amedie
committed
Apply changes to new srtp-kdf code
1 parent c0f3fe4 commit 138d699

1 file changed

Lines changed: 57 additions & 4 deletions

File tree

wolfcrypt/benchmark/benchmark.c

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7938,50 +7938,103 @@ void bench_srtpkdf(void)
79387938
const byte index[6] = { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA };
79397939
int kdrIdx = 0;
79407940
int i;
7941+
DECLARE_MULTI_VALUE_STATS_VARS()
7942+
7943+
#ifdef MULTI_VALUE_STATISTICS
7944+
XMEMSET(deltas, 0, sizeof(deltas));
7945+
#endif
79417946

79427947
bench_stats_start(&count, &start);
79437948
do {
79447949
for (i = 0; i < numBlocks; i++) {
79457950
ret = wc_SRTP_KDF(key, AES_128_KEY_SIZE, salt, sizeof(salt),
79467951
kdrIdx, index, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
79477952
keyS, sizeof(keyS));
7953+
RECORD_MULTI_VALUE_STATS();
79487954
}
79497955
count += i;
7950-
} while (bench_stats_check(start));
7956+
} while (bench_stats_check(start)
7957+
#ifdef MULTI_VALUE_STATISTICS
7958+
|| runs < minimum_runs
7959+
#endif
7960+
);
79517961
bench_stats_asym_finish("KDF", 128, "SRTP", 0, count, start, ret);
7962+
#ifdef MULTI_VALUE_STATISTICS
7963+
bench_multi_value_stats(deltas, max, min, sum, runs);
7964+
7965+
XMEMSET(deltas, 0, sizeof(deltas));
7966+
prev = 0;
7967+
runs = 0;
7968+
sum = 0;
7969+
#endif
79527970

79537971
bench_stats_start(&count, &start);
79547972
do {
79557973
for (i = 0; i < numBlocks; i++) {
79567974
ret = wc_SRTP_KDF(key, AES_256_KEY_SIZE, salt, sizeof(salt),
79577975
kdrIdx, index, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
79587976
keyS, sizeof(keyS));
7977+
RECORD_MULTI_VALUE_STATS();
79597978
}
79607979
count += i;
7961-
} while (bench_stats_check(start));
7980+
} while (bench_stats_check(start)
7981+
#ifdef MULTI_VALUE_STATISTICS
7982+
|| runs < minimum_runs
7983+
#endif
7984+
);
79627985
bench_stats_asym_finish("KDF", 256, "SRTP", 0, count, start, ret);
7986+
#ifdef MULTI_VALUE_STATISTICS
7987+
bench_multi_value_stats(deltas, max, min, sum, runs);
7988+
7989+
XMEMSET(deltas, 0, sizeof(deltas));
7990+
prev = 0;
7991+
runs = 0;
7992+
sum = 0;
7993+
#endif
79637994

79647995
bench_stats_start(&count, &start);
79657996
do {
79667997
for (i = 0; i < numBlocks; i++) {
79677998
ret = wc_SRTCP_KDF(key, AES_128_KEY_SIZE, salt, sizeof(salt),
79687999
kdrIdx, index, keyE, AES_128_KEY_SIZE, keyA, sizeof(keyA),
79698000
keyS, sizeof(keyS));
8001+
RECORD_MULTI_VALUE_STATS();
79708002
}
79718003
count += i;
7972-
} while (bench_stats_check(start));
8004+
} while (bench_stats_check(start)
8005+
#ifdef MULTI_VALUE_STATISTICS
8006+
|| runs < minimum_runs
8007+
#endif
8008+
);
79738009
bench_stats_asym_finish("KDF", 128, "SRTCP", 0, count, start, ret);
8010+
#ifdef MULTI_VALUE_STATISTICS
8011+
bench_multi_value_stats(deltas, max, min, sum, runs);
8012+
8013+
XMEMSET(deltas, 0, sizeof(deltas));
8014+
prev = 0;
8015+
runs = 0;
8016+
sum = 0;
8017+
#endif
79748018

79758019
bench_stats_start(&count, &start);
79768020
do {
79778021
for (i = 0; i < numBlocks; i++) {
79788022
ret = wc_SRTCP_KDF(key, AES_256_KEY_SIZE, salt, sizeof(salt),
79798023
kdrIdx, index, keyE, AES_256_KEY_SIZE, keyA, sizeof(keyA),
79808024
keyS, sizeof(keyS));
8025+
RECORD_MULTI_VALUE_STATS();
79818026
}
79828027
count += i;
7983-
} while (bench_stats_check(start));
8028+
} while (bench_stats_check(start)
8029+
#ifdef MULTI_VALUE_STATISTICS
8030+
|| runs < minimum_runs
8031+
#endif
8032+
);
79848033
bench_stats_asym_finish("KDF", 256, "SRTCP", 0, count, start, ret);
8034+
#ifdef MULTI_VALUE_STATISTICS
8035+
bench_multi_value_stats(deltas, max, min, sum, runs);
8036+
#endif
8037+
79858038
}
79868039
#endif
79878040

0 commit comments

Comments
 (0)