From: Ezra Peisach Date: Wed, 24 Aug 2011 20:04:49 +0000 (+0000) Subject: Fix signed/unsigned warnings in tests X-Git-Tag: krb5-1.10-alpha1~262 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7bd583158912d1e19b1b117d076d5917009e0cd6;p=krb5.git Fix signed/unsigned warnings in tests git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25113 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/builtin/aes/aes-gen.c b/src/lib/crypto/builtin/aes/aes-gen.c index 855e6a470..573de52b2 100644 --- a/src/lib/crypto/builtin/aes/aes-gen.c +++ b/src/lib/crypto/builtin/aes/aes-gen.c @@ -21,7 +21,7 @@ aes_ctx ctx, dctx; static void init () { - int i, j, r; + unsigned int i, j, r; srand(42); for (i = 0; i < 16; i++) @@ -40,7 +40,7 @@ static void init () static void hexdump(const unsigned char *ptr, size_t len) { - int i; + size_t i; for (i = 0; i < len; i++) printf ("%s%02X", (i % 16 == 0) ? "\n " : " ", ptr[i]); } @@ -88,7 +88,7 @@ static void fips_test () static void xor (unsigned char *out, const unsigned char *a, const unsigned char *b) { - int i; + unsigned int i; for (i = 0; i < B; i++) out[i] = a[i] ^ b[i]; } @@ -96,7 +96,7 @@ xor (unsigned char *out, const unsigned char *a, const unsigned char *b) static void ecb_enc (unsigned char *out, unsigned char *in, unsigned int len) { - int i, r; + unsigned int i, r; for (i = 0; i < len; i += 16) { r = aes_enc_blk (in + i, out + i, &ctx); if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1); @@ -107,7 +107,7 @@ ecb_enc (unsigned char *out, unsigned char *in, unsigned int len) static void ecb_dec (unsigned char *out, unsigned char *in, unsigned int len) { - int i, r; + unsigned int i, r; for (i = 0; i < len; i += 16) { r = aes_dec_blk (in + i, out + i, &dctx); if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1); @@ -124,7 +124,7 @@ static void cbc_enc (unsigned char *out, unsigned char *in, unsigned char *iv, unsigned int len) { - int i, r; + unsigned int i, r; unsigned char tmp[B]; D(iv); memcpy (tmp, iv, B); @@ -144,7 +144,7 @@ static void cbc_dec (unsigned char *out, unsigned char *in, unsigned char *iv, unsigned int len) { - int i, r; + unsigned int i, r; unsigned char tmp[B]; memcpy (tmp, iv, B); for (i = 0; i < len; i += B) { @@ -230,7 +230,7 @@ cts_dec (unsigned char *out, unsigned char *in, unsigned char *iv, static void ecb_test () { - int testno; + unsigned int testno; unsigned char tmp[4*B]; printf ("ECB tests:\n"); @@ -261,7 +261,7 @@ unsigned char ivec[16] = { 0 }; static void cbc_test () { - int testno; + unsigned int testno; unsigned char tmp[4*B]; printf ("CBC tests:\n"); @@ -290,7 +290,7 @@ static void cbc_test () static void cts_test () { - int testno; + unsigned int testno; unsigned char tmp[4*B]; printf ("CTS tests:\n"); diff --git a/src/lib/crypto/builtin/sha1/t_shs3.c b/src/lib/crypto/builtin/sha1/t_shs3.c index d05ac6d79..ca985fbcf 100644 --- a/src/lib/crypto/builtin/sha1/t_shs3.c +++ b/src/lib/crypto/builtin/sha1/t_shs3.c @@ -350,11 +350,11 @@ unsigned char results6[SHS_DIGESTSIZE] = { static void test6(void) { struct { - long pad1; + unsigned long pad1; SHS_INFO si1; - long pad2; + unsigned long pad2; SHS_INFO si2; - long pad3; + unsigned long pad3; } sdata; unsigned char digest[SHS_DIGESTSIZE]; int failed; @@ -481,11 +481,11 @@ unsigned int kfsize[] = {0,1,31,32,33,55,56,63}; static void test7(void) { struct { - long pad1; + unsigned long pad1; SHS_INFO si1; - long pad2; + unsigned long pad2; SHS_INFO si2; - long pad3; + unsigned long pad3; } sdata; unsigned char digest[SHS_DIGESTSIZE]; int failed; diff --git a/src/lib/crypto/crypto_tests/t_crc.c b/src/lib/crypto/crypto_tests/t_crc.c index 7161fb083..190773252 100644 --- a/src/lib/crypto/crypto_tests/t_crc.c +++ b/src/lib/crypto/crypto_tests/t_crc.c @@ -148,7 +148,7 @@ static void gethexstr(char *data, size_t *outlen, unsigned char *outbuf, inlen = strlen(data); *outlen = 0; - for (cp = data; cp - data < inlen; cp += 2) { + for (cp = data; (size_t) (cp - data) < inlen; cp += 2) { strncpy(buf, cp, 2); buf[2] = '\0'; n = strtol(buf, NULL, 16); diff --git a/src/lib/krb5/ccache/t_cccursor.c b/src/lib/krb5/ccache/t_cccursor.c index 355484f6f..b708aa6f9 100644 --- a/src/lib/krb5/ccache/t_cccursor.c +++ b/src/lib/krb5/ccache/t_cccursor.c @@ -209,7 +209,8 @@ main(int argc, char *argv[]) { krb5_error_code ret = 0; krb5_context context; - int i, good = 1; + unsigned int i; + int good = 1; ret = krb5_init_context(&context); if (ret) exit(1); diff --git a/src/lib/krb5/krb/t_ser.c b/src/lib/krb5/krb/t_ser.c index f2d5118d5..b16c2dc3d 100644 --- a/src/lib/krb5/krb/t_ser.c +++ b/src/lib/krb5/krb/t_ser.c @@ -41,7 +41,7 @@ can't safely dereference. This test file used to make this mistake, often."; static void print_erep(krb5_octet *erep, size_t elen) { - int i, j; + unsigned int i, j; for (i=0; i