Skip to content

Commit

Permalink
Fix int / size_t comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
SWilson4 committed Jan 22, 2024
1 parent 231611c commit 6ab46f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/kat_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static OQS_STATUS kem_kat(const char *method_name, bool all) {
uint8_t *shared_secret_d = NULL;
OQS_STATUS rc, ret = OQS_ERROR;
int rv;
int max_count;
size_t max_count;
OQS_KAT_PRNG *prng;

prng = OQS_KAT_PRNG_new(method_name);
Expand Down Expand Up @@ -67,8 +67,8 @@ static OQS_STATUS kem_kat(const char *method_name, bool all) {

max_count = all ? prng->max_kats : 1;

for (int count = 0; count < max_count; ++count) {
fprintf(fh, "count = %d\n", count);
for (size_t count = 0; count < max_count; ++count) {
fprintf(fh, "count = %zu\n", count);
OQS_randombytes(seed, 48);
OQS_fprintBstr(fh, "seed = ", seed, 48);

Expand Down
6 changes: 3 additions & 3 deletions tests/kat_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ OQS_STATUS sig_kat(const char *method_name, bool all) {
size_t signed_msg_len = 0;
OQS_STATUS rc, ret = OQS_ERROR;
OQS_KAT_PRNG *prng = NULL;
int max_count;
size_t max_count;

prng = OQS_KAT_PRNG_new(method_name);
if (prng == NULL) {
Expand Down Expand Up @@ -277,8 +277,8 @@ OQS_STATUS sig_kat(const char *method_name, bool all) {
goto err;
}

for (int count = 0; count < max_count; ++count) {
fprintf(fh, "count = %d\n", count);
for (size_t count = 0; count < max_count; ++count) {
fprintf(fh, "count = %zu\n", count);
OQS_randombytes(seed, 48);
OQS_fprintBstr(fh, "seed = ", seed, 48);

Expand Down
2 changes: 1 addition & 1 deletion tests/test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ typedef union {
} OQS_KAT_PRNG_state;

typedef struct {
int max_kats;
size_t max_kats;
OQS_KAT_PRNG_state saved_state;
// The caller should use the OQS_KAT_PRNG_* functions instead of these callbacks.
void (*seed)(const uint8_t *, const uint8_t *);
Expand Down

0 comments on commit 6ab46f9

Please sign in to comment.