cpukit/libcrypt: Address -Wsign-compare warnings

This warning occurs when comparing a signed variable to an unsigned one.
This is frequently an int or ssize_t variable compared to a uint32_t or
size_t. Sometimes the size_t is from a sizeof() use.
This commit is contained in:
Joel Sherrill
2026-01-28 10:36:30 -06:00
committed by Gedare Bloom
parent 5be6a2ea4f
commit 939d18ba4e
2 changed files with 8 additions and 0 deletions

View File

@@ -165,7 +165,11 @@ crypt_sha256_r(const char *key, const char *salt, struct crypt_data *data)
SHA256_Init(&alt_ctx);
/* For every character in the password add the entire password. */
#ifdef __rtems__
for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt)
#else
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
#endif
SHA256_Update(&alt_ctx, salt, salt_len);
/* Finish the digest. */

View File

@@ -165,7 +165,11 @@ crypt_sha512_r(const char *key, const char *salt, struct crypt_data *data)
SHA512_Init(&alt_ctx);
/* For every character in the password add the entire password. */
#ifdef __rtems__
for (cnt = 0; cnt < (size_t) (16 + alt_result[0]); ++cnt)
#else
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
#endif
SHA512_Update(&alt_ctx, salt, salt_len);
/* Finish the digest. */