Benchmark AES-OFB: initialize and free AES object

Device ID is not initialized unless wc_AesInit() is called.
Call wc_AesFree() for possible hardware implementations.
pull/5878/head
Sean Parkinson 2022-12-12 10:45:21 +10:00
parent 11c4a0e228
commit 819d40a76f
1 changed files with 8 additions and 0 deletions

View File

@ -3423,6 +3423,12 @@ static void bench_aesofb_internal(const byte* key, word32 keySz, const byte* iv,
double start; double start;
int i, ret, count; int i, ret, count;
ret = wc_AesInit(&enc, NULL, INVALID_DEVID);
if (ret != 0) {
printf("AesInit failed, ret = %d\n", ret);
return;
}
ret = wc_AesSetKey(&enc, key, keySz, iv, AES_ENCRYPTION); ret = wc_AesSetKey(&enc, key, keySz, iv, AES_ENCRYPTION);
if (ret != 0) { if (ret != 0) {
printf("AesSetKey failed, ret = %d\n", ret); printf("AesSetKey failed, ret = %d\n", ret);
@ -3441,6 +3447,8 @@ static void bench_aesofb_internal(const byte* key, word32 keySz, const byte* iv,
count += i; count += i;
} while (bench_stats_check(start)); } while (bench_stats_check(start));
bench_stats_sym_finish(label, 0, count, bench_size, start, ret); bench_stats_sym_finish(label, 0, count, bench_size, start, ret);
wc_AesFree(&enc);
} }
void bench_aesofb(void) void bench_aesofb(void)