aboutsummaryrefslogtreecommitdiff
path: root/rsa.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 /rsa.c
parent12a3c63b75044b207dd7982ce3ed170231bd4467 (diff)
Cleanup signed/unsigned mismatches, mostly in loop counters
Diffstat (limited to 'rsa.c')
-rw-r--r--rsa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/rsa.c b/rsa.c
index eeb611c..9af67d3 100644
--- a/rsa.c
+++ b/rsa.c
@@ -677,7 +677,7 @@ static hal_error_t find_prime(const unsigned prime_length,
fp_read_unsigned_bin(result, buffer, sizeof(buffer));
- for (int i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++) {
+ for (size_t i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++) {
fp_digit d;
fp_mod_d(result, small_prime[i], &d);
remainder[i] = d;
@@ -686,10 +686,10 @@ static hal_error_t find_prime(const unsigned prime_length,
for (;;) {
int possible = 1;
- for (int i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++)
+ for (size_t i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++)
possible &= remainder[i] != 0;
- for (int i = 0; possible && i < HAL_RSA_MILLER_RABIN_TESTS; i++) {
+ for (size_t i = 0; possible && i < HAL_RSA_MILLER_RABIN_TESTS; i++) {
fp_set(t, small_prime[i]);
fp_prime_miller_rabin(result, t, &possible);
}
@@ -707,7 +707,7 @@ static hal_error_t find_prime(const unsigned prime_length,
fp_add_d(result, 2, result);
- for (int i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++)
+ for (size_t i = 0; i < sizeof(small_prime)/sizeof(*small_prime); i++)
if ((remainder[i] += 2) >= small_prime[i])
remainder[i] -= small_prime[i];
}