diff --git a/demos/tv_gen.c b/demos/tv_gen.c index 7108fea..e754a7d 100644 --- a/demos/tv_gen.c +++ b/demos/tv_gen.c @@ -747,14 +747,14 @@ void gcm_gen(void) void base64_gen(void) { FILE *out; - unsigned char dst[256], src[32]; - unsigned long x, y, len; + unsigned char dst[256], src[32], ch; + unsigned long x, len; out = fopen("base64_tv.txt", "w"); fprintf(out, "Base64 vectors. These are the base64 encodings of the strings 00,01,02...NN-1\n\n"); for (x = 0; x <= 32; x++) { - for (y = 0; y < x; y++) { - src[y] = (unsigned char)y; + for (ch = 0; ch < x; ch++) { + src[ch] = ch; } len = sizeof(dst); base64_encode(src, x, dst, &len); diff --git a/testprof/dh_test.c b/testprof/dh_test.c index f2cc0bb..e2bd980 100644 --- a/testprof/dh_test.c +++ b/testprof/dh_test.c @@ -10,7 +10,7 @@ int dh_test (void) { - unsigned char buf[3][4096]; + unsigned char buf[3][4096], ch; unsigned long x, y, z; int stat, stat2; dh_key usera, userb; @@ -74,8 +74,8 @@ int dh_test (void) /* test encrypt_key */ dh_make_key (&yarrow_prng, find_prng ("yarrow"), KEYSIZE/8, &usera); - for (x = 0; x < 16; x++) { - buf[0][x] = (unsigned char)x; + for (ch = 0; ch < 16; ch++) { + buf[0][ch] = ch; } y = sizeof (buf[1]); DO(dh_encrypt_key (buf[0], 16, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("md5"), &usera)); @@ -87,16 +87,16 @@ int dh_test (void) dh_free (&usera); return 1; } - for (x = 0; x < 16; x++) - if (buf[0][x] != x) { + for (ch = 0; ch < 16; ch++) + if (buf[0][ch] != ch) { fprintf(stderr, "Failed (contents)\n"); dh_free (&usera); return 1; } /* test sign_hash */ - for (x = 0; x < 16; x++) { - buf[0][x] = (unsigned char)x; + for (ch = 0; ch < 16; ch++) { + buf[0][ch] = ch; } x = sizeof (buf[1]); DO(dh_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &usera)); diff --git a/testprof/dsa_test.c b/testprof/dsa_test.c index 5db4edf..37f06d7 100644 --- a/testprof/dsa_test.c +++ b/testprof/dsa_test.c @@ -171,7 +171,7 @@ static int dsa_compat_test(void) int dsa_test(void) { - unsigned char msg[16], out[1024], out2[1024]; + unsigned char msg[16], out[1024], out2[1024], ch; unsigned long x, y; int stat1, stat2; dsa_key key, key2; @@ -186,7 +186,7 @@ int dsa_test(void) if (stat1 == 0) { fprintf(stderr, "dsa_verify_key "); return 1; } /* encrypt a message */ - for (x = 0; x < 16; x++) { msg[x] = (unsigned char)x; } + for (ch = 0; ch < 16; ch++) { msg[ch] = ch; } x = sizeof(out); DO(dsa_encrypt_key(msg, 16, out, &x, &yarrow_prng, find_prng("yarrow"), find_hash("sha1"), &key)); diff --git a/testprof/ecc_test.c b/testprof/ecc_test.c index 069e27b..b4668d0 100644 --- a/testprof/ecc_test.c +++ b/testprof/ecc_test.c @@ -107,7 +107,7 @@ int ecc_test_shamir(void) int ecc_tests (void) { - unsigned char buf[4][4096]; + unsigned char buf[4][4096], ch; unsigned long x, y, z, s; int stat, stat2; ecc_key usera, userb, pubKey, privKey; @@ -191,8 +191,8 @@ int ecc_tests (void) DO(ecc_export(buf[0], &x, PK_PRIVATE, &usera)); DO(ecc_import(buf[0], x, &privKey)); - for (x = 0; x < 32; x++) { - buf[0][x] = (unsigned char)x; + for (ch = 0; ch < 32; ch++) { + buf[0][ch] = ch; } y = sizeof (buf[1]); DO(ecc_encrypt_key (buf[0], 32, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("sha256"), &pubKey)); @@ -203,15 +203,15 @@ int ecc_tests (void) fprintf(stderr, "Failed (length)"); return 1; } - for (x = 0; x < 32; x++) { - if (buf[0][x] != x) { + for (ch = 0; ch < 32; ch++) { + if (buf[0][ch] != ch) { fprintf(stderr, "Failed (contents)"); return 1; } } /* test sign_hash */ - for (x = 0; x < 16; x++) { - buf[0][x] = (unsigned char)x; + for (ch = 0; ch < 16; ch++) { + buf[0][ch] = ch; } x = sizeof (buf[1]); DO(ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));