Skip to content

Commit 702b6c2

Browse files
author
Andras Fekete
committed
Fix conversion error in benchmark.c
1 parent 692a7d5 commit 702b6c2

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

wolfcrypt/benchmark/benchmark.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,7 @@ static void* benchmarks_do(void* args)
30183018

30193019
#ifndef NO_FILESYSTEM
30203020
if (hash_input) {
3021-
int rawSz;
3021+
size_t rawSz;
30223022
XFILE file;
30233023
file = XFOPEN(hash_input, "rb");
30243024
if (file == XBADFILE)
@@ -3037,7 +3037,7 @@ static void* benchmarks_do(void* args)
30373037

30383038
XFREE(bench_plain, HEAP_HINT, DYNAMIC_TYPE_WOLF_BIGINT);
30393039

3040-
rawSz = (int)bench_buf_size;
3040+
rawSz = (size_t)bench_buf_size;
30413041
if (bench_buf_size % 16)
30423042
bench_buf_size += 16 - (bench_buf_size % 16);
30433043

@@ -3052,7 +3052,7 @@ static void* benchmarks_do(void* args)
30523052
}
30533053

30543054
if ((size_t)XFREAD(bench_plain, 1, rawSz, file)
3055-
!= (size_t)rawSz) {
3055+
!= rawSz) {
30563056
XFCLOSE(file);
30573057
goto exit;
30583058
}
@@ -3064,7 +3064,7 @@ static void* benchmarks_do(void* args)
30643064
}
30653065

30663066
if (cipher_input) {
3067-
int rawSz;
3067+
size_t rawSz;
30683068
XFILE file;
30693069
file = XFOPEN(cipher_input, "rb");
30703070
if (file == XBADFILE)
@@ -3083,7 +3083,7 @@ static void* benchmarks_do(void* args)
30833083

30843084
XFREE(bench_cipher, HEAP_HINT, DYNAMIC_TYPE_WOLF_BIGINT);
30853085

3086-
rawSz = (int)bench_buf_size;
3086+
rawSz = (size_t)bench_buf_size;
30873087
if (bench_buf_size % 16)
30883088
bench_buf_size += 16 - (bench_buf_size % 16);
30893089

@@ -3099,7 +3099,7 @@ static void* benchmarks_do(void* args)
30993099
}
31003100

31013101
if ((size_t)XFREAD(bench_cipher, 1, rawSz, file)
3102-
!= (size_t)rawSz) {
3102+
!= rawSz) {
31033103
XFCLOSE(file);
31043104
goto exit;
31053105
}
@@ -4743,9 +4743,9 @@ static void bench_aesecb_internal(int useDeviceID,
47434743
double start;
47444744
DECLARE_MULTI_VALUE_STATS_VARS()
47454745
#ifdef HAVE_FIPS
4746-
const int benchSz = AES_BLOCK_SIZE;
4746+
const word32 benchSz = AES_BLOCK_SIZE;
47474747
#else
4748-
const int benchSz = (int)bench_size;
4748+
const word32 benchSz = bench_size;
47494749
#endif
47504750

47514751
WC_CALLOC_ARRAY(enc, Aes, BENCH_MAX_PENDING,
@@ -4768,7 +4768,7 @@ static void bench_aesecb_internal(int useDeviceID,
47684768

47694769
bench_stats_start(&count, &start);
47704770
do {
4771-
int outer_loop_limit = (((int)bench_size / benchSz) * 10) + 1;
4771+
int outer_loop_limit = (int)((bench_size / benchSz) * 10) + 1;
47724772
for (times = 0;
47734773
times < outer_loop_limit /* numBlocks */ || pending > 0;
47744774
) {
@@ -4821,7 +4821,7 @@ static void bench_aesecb_internal(int useDeviceID,
48214821

48224822
bench_stats_start(&count, &start);
48234823
do {
4824-
int outer_loop_limit = (10 * ((int)bench_size / benchSz)) + 1;
4824+
int outer_loop_limit = (int)(10 * (bench_size / benchSz)) + 1;
48254825
for (times = 0; times < outer_loop_limit || pending > 0; ) {
48264826
bench_async_poll(&pending);
48274827

0 commit comments

Comments
 (0)