aboutsummaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-10-23 18:05:31 -0400
committerPaul Selkirk <paul@psgd.org>2017-10-23 18:05:31 -0400
commitca84af553cbaae45b17cce04d457b2e61cc4277c (patch)
tree90f2bc5e96d2f1ae3fece3dfb9075edda08c4ace /hash.c
parent12a3c63b75044b207dd7982ce3ed170231bd4467 (diff)
Cleanup signed/unsigned mismatches, mostly in loop counters
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hash.c b/hash.c
index fa30b60..d1e55ff 100644
--- a/hash.c
+++ b/hash.c
@@ -302,7 +302,7 @@ static inline hal_hash_state_t *alloc_static_hash_state(void)
#if HAL_STATIC_HASH_STATE_BLOCKS > 0
- for (int i = 0; i < sizeof(static_hash_state)/sizeof(*static_hash_state); i++)
+ for (size_t i = 0; i < sizeof(static_hash_state)/sizeof(*static_hash_state); i++)
if ((static_hash_state[i].flags & STATE_FLAG_STATE_ALLOCATED) == 0)
return &static_hash_state[i];
@@ -316,7 +316,7 @@ static inline hal_hmac_state_t *alloc_static_hmac_state(void)
#if HAL_STATIC_HMAC_STATE_BLOCKS > 0
- for (int i = 0; i < sizeof(static_hmac_state)/sizeof(*static_hmac_state); i++)
+ for (size_t i = 0; i < sizeof(static_hmac_state)/sizeof(*static_hmac_state); i++)
if ((static_hmac_state[i].hash_state.flags & STATE_FLAG_STATE_ALLOCATED) == 0)
return &static_hmac_state[i];
@@ -347,8 +347,8 @@ static inline void swytebop(void *out_, const void * const in_, const size_t n,
return;
case 0x04030201:
- for (int i = 0; i < n; i += w)
- for (int j = 0; j < w && i + j < n; j++)
+ for (size_t i = 0; i < n; i += w)
+ for (size_t j = 0; j < w && i + j < n; j++)
out[i + j] = in[i + w - j - 1];
return;
@@ -647,7 +647,7 @@ hal_error_t hal_hash_finalize(hal_hash_state_t *state, /* Opaqu
hal_error_t err;
uint8_t *p;
size_t n;
- int i;
+ size_t i;
if (state == NULL || digest_buffer == NULL)
return HAL_ERROR_BAD_ARGUMENTS;
@@ -745,7 +745,7 @@ hal_error_t hal_hmac_initialize(hal_core_t *core,
const hal_hash_driver_t * const driver = check_driver(descriptor);
hal_hmac_state_t *state = state_buffer;
hal_error_t err;
- int i;
+ size_t i;
if (descriptor == NULL || driver == NULL || state_ == NULL)
return HAL_ERROR_BAD_ARGUMENTS;