svn rev #25113: trunk/src/lib/ crypto/builtin/aes/ crypto/builtin/sha1/ crypto/crypto_tests/ ...

epeisach@MIT.EDU epeisach at MIT.EDU
Wed Aug 24 16:04:49 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25113
Commit By: epeisach
Log Message:
Fix signed/unsigned warnings in tests




Changed Files:
U   trunk/src/lib/crypto/builtin/aes/aes-gen.c
U   trunk/src/lib/crypto/builtin/sha1/t_shs3.c
U   trunk/src/lib/crypto/crypto_tests/t_crc.c
U   trunk/src/lib/krb5/ccache/t_cccursor.c
U   trunk/src/lib/krb5/krb/t_ser.c
Modified: trunk/src/lib/crypto/builtin/aes/aes-gen.c
===================================================================
--- trunk/src/lib/crypto/builtin/aes/aes-gen.c	2011-08-24 02:48:07 UTC (rev 25112)
+++ trunk/src/lib/crypto/builtin/aes/aes-gen.c	2011-08-24 20:04:49 UTC (rev 25113)
@@ -21,7 +21,7 @@
 
 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 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
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 
 static void ecb_test ()
 {
-    int testno;
+    unsigned int testno;
     unsigned char tmp[4*B];
 
     printf ("ECB tests:\n");
@@ -261,7 +261,7 @@
 
 static void cbc_test ()
 {
-    int testno;
+    unsigned int testno;
     unsigned char tmp[4*B];
 
     printf ("CBC tests:\n");
@@ -290,7 +290,7 @@
 
 static void cts_test ()
 {
-    int testno;
+    unsigned int testno;
     unsigned char tmp[4*B];
 
     printf ("CTS tests:\n");

Modified: trunk/src/lib/crypto/builtin/sha1/t_shs3.c
===================================================================
--- trunk/src/lib/crypto/builtin/sha1/t_shs3.c	2011-08-24 02:48:07 UTC (rev 25112)
+++ trunk/src/lib/crypto/builtin/sha1/t_shs3.c	2011-08-24 20:04:49 UTC (rev 25113)
@@ -350,11 +350,11 @@
 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 @@
 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;

Modified: trunk/src/lib/crypto/crypto_tests/t_crc.c
===================================================================
--- trunk/src/lib/crypto/crypto_tests/t_crc.c	2011-08-24 02:48:07 UTC (rev 25112)
+++ trunk/src/lib/crypto/crypto_tests/t_crc.c	2011-08-24 20:04:49 UTC (rev 25113)
@@ -148,7 +148,7 @@
 
     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);

Modified: trunk/src/lib/krb5/ccache/t_cccursor.c
===================================================================
--- trunk/src/lib/krb5/ccache/t_cccursor.c	2011-08-24 02:48:07 UTC (rev 25112)
+++ trunk/src/lib/krb5/ccache/t_cccursor.c	2011-08-24 20:04:49 UTC (rev 25113)
@@ -209,7 +209,8 @@
 {
     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);

Modified: trunk/src/lib/krb5/krb/t_ser.c
===================================================================
--- trunk/src/lib/krb5/krb/t_ser.c	2011-08-24 02:48:07 UTC (rev 25112)
+++ trunk/src/lib/krb5/krb/t_ser.c	2011-08-24 20:04:49 UTC (rev 25113)
@@ -41,7 +41,7 @@
 static void
 print_erep(krb5_octet *erep, size_t elen)
 {
-    int i, j;
+    unsigned int i, j;
 
     for (i=0; i<elen; ) {
         printf("%08d: ", i);




More information about the cvs-krb5 mailing list