summaryrefslogtreecommitdiff
path: root/com32/libutil
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-05-12 15:40:46 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-05-12 15:40:46 -0700
commit9b9087c159bc9eccbb55c1cc4e71228fbcb86cbf (patch)
treea0dd6d179f5b9e79129c87d5343bbb633132f526 /com32/libutil
parent61a46c8daf71553b099fe1926b9c0574aa4ccc66 (diff)
downloadsyslinux-9b9087c159bc9eccbb55c1cc4e71228fbcb86cbf.tar.gz
sha256/512: fix signedness errors
Fix signedness errors as part of -Werror cleanup. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'com32/libutil')
-rw-r--r--com32/libutil/sha256crypt.c12
-rw-r--r--com32/libutil/sha512crypt.c10
2 files changed, 11 insertions, 11 deletions
diff --git a/com32/libutil/sha256crypt.c b/com32/libutil/sha256crypt.c
index 2e945351..adc7b091 100644
--- a/com32/libutil/sha256crypt.c
+++ b/com32/libutil/sha256crypt.c
@@ -276,13 +276,13 @@ static const char sha256_salt_prefix[] = "$5$";
static const char sha256_rounds_prefix[] = "rounds=";
/* Maximum salt string length. */
-#define SALT_LEN_MAX 16
+#define SALT_LEN_MAX 16U
/* Default number of rounds if not explicitly specified. */
-#define ROUNDS_DEFAULT 5000
+#define ROUNDS_DEFAULT 5000UL
/* Minimum number of rounds. */
-#define ROUNDS_MIN 1000
+#define ROUNDS_MIN 1000UL
/* Maximum number of rounds. */
-#define ROUNDS_MAX 999999999
+#define ROUNDS_MAX 999999999UL
/* Table with characters for base64 transformation. */
static const char b64t[64] =
@@ -379,7 +379,7 @@ static char *sha256_crypt_r(const char *key, const char *salt, char *buffer,
/* Take the binary representation of the length of the key and for every
1 add the alternate sum, for every 0 the key. */
- for (cnt = key_len; cnt > 0; cnt >>= 1)
+ for (cnt = key_len; cnt; cnt >>= 1)
if ((cnt & 1) != 0)
sha256_process_bytes(alt_result, 32, &ctx);
else
@@ -408,7 +408,7 @@ static char *sha256_crypt_r(const char *key, const char *salt, char *buffer,
sha256_init_ctx(&alt_ctx);
/* For every character in the password add the entire password. */
- for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
+ for (cnt = 0; cnt < (size_t)16 + alt_result[0]; ++cnt)
sha256_process_bytes(salt, salt_len, &alt_ctx);
/* Finish the digest. */
diff --git a/com32/libutil/sha512crypt.c b/com32/libutil/sha512crypt.c
index df839afa..9db9c0c8 100644
--- a/com32/libutil/sha512crypt.c
+++ b/com32/libutil/sha512crypt.c
@@ -311,13 +311,13 @@ static const char sha512_salt_prefix[] = "$6$";
static const char sha512_rounds_prefix[] = "rounds=";
/* Maximum salt string length. */
-#define SALT_LEN_MAX 16
+#define SALT_LEN_MAX 16U
/* Default number of rounds if not explicitly specified. */
-#define ROUNDS_DEFAULT 5000
+#define ROUNDS_DEFAULT 5000UL
/* Minimum number of rounds. */
-#define ROUNDS_MIN 1000
+#define ROUNDS_MIN 1000UL
/* Maximum number of rounds. */
-#define ROUNDS_MAX 999999999
+#define ROUNDS_MAX 999999999UL
/* Table with characters for base64 transformation. */
static const char b64t[64] =
@@ -443,7 +443,7 @@ static char *sha512_crypt_r(const char *key, const char *salt, char *buffer,
sha512_init_ctx(&alt_ctx);
/* For every character in the password add the entire password. */
- for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
+ for (cnt = 0; cnt < (size_t)16 + alt_result[0]; ++cnt)
sha512_process_bytes(salt, salt_len, &alt_ctx);
/* Finish the digest. */