tuning win warnings fixes

This commit is contained in:
Karel Miko 2017-05-09 22:05:30 +02:00
parent e2cf11da25
commit a69e55ba54
4 changed files with 20 additions and 20 deletions

View File

@ -747,14 +747,14 @@ void gcm_gen(void)
void base64_gen(void) void base64_gen(void)
{ {
FILE *out; FILE *out;
unsigned char dst[256], src[32]; unsigned char dst[256], src[32], ch;
unsigned long x, y, len; unsigned long x, len;
out = fopen("base64_tv.txt", "w"); 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"); 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 (x = 0; x <= 32; x++) {
for (y = 0; y < x; y++) { for (ch = 0; ch < x; ch++) {
src[y] = (unsigned char)y; src[ch] = ch;
} }
len = sizeof(dst); len = sizeof(dst);
base64_encode(src, x, dst, &len); base64_encode(src, x, dst, &len);

View File

@ -10,7 +10,7 @@
int dh_test (void) int dh_test (void)
{ {
unsigned char buf[3][4096]; unsigned char buf[3][4096], ch;
unsigned long x, y, z; unsigned long x, y, z;
int stat, stat2; int stat, stat2;
dh_key usera, userb; dh_key usera, userb;
@ -74,8 +74,8 @@ int dh_test (void)
/* test encrypt_key */ /* test encrypt_key */
dh_make_key (&yarrow_prng, find_prng ("yarrow"), KEYSIZE/8, &usera); dh_make_key (&yarrow_prng, find_prng ("yarrow"), KEYSIZE/8, &usera);
for (x = 0; x < 16; x++) { for (ch = 0; ch < 16; ch++) {
buf[0][x] = (unsigned char)x; buf[0][ch] = ch;
} }
y = sizeof (buf[1]); y = sizeof (buf[1]);
DO(dh_encrypt_key (buf[0], 16, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("md5"), &usera)); 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); dh_free (&usera);
return 1; return 1;
} }
for (x = 0; x < 16; x++) for (ch = 0; ch < 16; ch++)
if (buf[0][x] != x) { if (buf[0][ch] != ch) {
fprintf(stderr, "Failed (contents)\n"); fprintf(stderr, "Failed (contents)\n");
dh_free (&usera); dh_free (&usera);
return 1; return 1;
} }
/* test sign_hash */ /* test sign_hash */
for (x = 0; x < 16; x++) { for (ch = 0; ch < 16; ch++) {
buf[0][x] = (unsigned char)x; buf[0][ch] = ch;
} }
x = sizeof (buf[1]); x = sizeof (buf[1]);
DO(dh_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &usera)); DO(dh_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &usera));

View File

@ -171,7 +171,7 @@ static int dsa_compat_test(void)
int dsa_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; unsigned long x, y;
int stat1, stat2; int stat1, stat2;
dsa_key key, key2; dsa_key key, key2;
@ -186,7 +186,7 @@ int dsa_test(void)
if (stat1 == 0) { fprintf(stderr, "dsa_verify_key "); return 1; } if (stat1 == 0) { fprintf(stderr, "dsa_verify_key "); return 1; }
/* encrypt a message */ /* 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); x = sizeof(out);
DO(dsa_encrypt_key(msg, 16, out, &x, &yarrow_prng, find_prng("yarrow"), find_hash("sha1"), &key)); DO(dsa_encrypt_key(msg, 16, out, &x, &yarrow_prng, find_prng("yarrow"), find_hash("sha1"), &key));

View File

@ -107,7 +107,7 @@ int ecc_test_shamir(void)
int ecc_tests (void) int ecc_tests (void)
{ {
unsigned char buf[4][4096]; unsigned char buf[4][4096], ch;
unsigned long x, y, z, s; unsigned long x, y, z, s;
int stat, stat2; int stat, stat2;
ecc_key usera, userb, pubKey, privKey; 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_export(buf[0], &x, PK_PRIVATE, &usera));
DO(ecc_import(buf[0], x, &privKey)); DO(ecc_import(buf[0], x, &privKey));
for (x = 0; x < 32; x++) { for (ch = 0; ch < 32; ch++) {
buf[0][x] = (unsigned char)x; buf[0][ch] = ch;
} }
y = sizeof (buf[1]); y = sizeof (buf[1]);
DO(ecc_encrypt_key (buf[0], 32, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("sha256"), &pubKey)); 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)"); fprintf(stderr, "Failed (length)");
return 1; return 1;
} }
for (x = 0; x < 32; x++) { for (ch = 0; ch < 32; ch++) {
if (buf[0][x] != x) { if (buf[0][ch] != ch) {
fprintf(stderr, "Failed (contents)"); fprintf(stderr, "Failed (contents)");
return 1; return 1;
} }
} }
/* test sign_hash */ /* test sign_hash */
for (x = 0; x < 16; x++) { for (ch = 0; ch < 16; ch++) {
buf[0][x] = (unsigned char)x; buf[0][ch] = ch;
} }
x = sizeof (buf[1]); x = sizeof (buf[1]);
DO(ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey)); DO(ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));