From: Ken Raeburn Date: Tue, 10 Apr 2001 08:39:54 +0000 (+0000) Subject: fix/add casts as needed X-Git-Tag: krb5-1.3-alpha1~1576 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8614bc3c7e820c9e14ce4dc9ad2b552a3022e8a;p=krb5.git fix/add casts as needed git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13170 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/ChangeLog b/src/lib/crypto/ChangeLog index c3f4aacab..3268c3701 100644 --- a/src/lib/crypto/ChangeLog +++ b/src/lib/crypto/ChangeLog @@ -1,3 +1,12 @@ +2001-04-10 Ken Raeburn + + * make_checksum.c (krb5_c_make_checksum): Add cast assigning to + krb5_data data field. + * make_random_key.c (krb5_c_make_random_key): Likewise. + + * keyed_cksum.c (is_keyed_cksum): Use -1U to keep compiler quiet, + since return type is not signed. + 2001-03-14 Ken Raeburn * t_nfold.c: Include assert.h. diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index af3bd971f..dc89e2c82 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,5 +1,7 @@ 2001-04-10 Ken Raeburn + * t_afss2k.c (do_it): Add cast to keep compiler quiet. + * f_cksum.c (mit_des_cbc_cksum): Use const for input, key schedule, and initial vector. Get rid of casts when possible. * f_cbc.c (mit_des_cbc_encrypt): Likewise. diff --git a/src/lib/crypto/des/t_afss2k.c b/src/lib/crypto/des/t_afss2k.c index 851465006..a6d0aa58d 100644 --- a/src/lib/crypto/des/t_afss2k.c +++ b/src/lib/crypto/des/t_afss2k.c @@ -116,10 +116,13 @@ do_it (struct test_case *tcase) abort (); } + /* Run another pass to make sure the characters after the + password in the buffer aren't influencing the output. The + password is *not* required to be null-terminated. */ memset (longpass, '!', sizeof (longpass)); longpass[sizeof (longpass)-1] = '\0'; memcpy (longpass, "My Password", strlen ("My Password")); - passwd.data = longpass; + passwd.data = (char *) longpass; for (i = 0; i < 12; i++) { passwd.length = i; err = mit_afs_string_to_key (&key, &passwd, &salt); diff --git a/src/lib/crypto/dk/ChangeLog b/src/lib/crypto/dk/ChangeLog index 7e9c1900b..af1ccab65 100644 --- a/src/lib/crypto/dk/ChangeLog +++ b/src/lib/crypto/dk/ChangeLog @@ -1,3 +1,10 @@ +2001-04-10 Ken Raeburn + + * checksum.c (krb5_dk_make_checksum): Add casts when mixing + pointers with different target signedness. + * dk_decrypt.c (krb5_dk_decrypt): Likewise. + * stringtokey.c (krb5_dk_string_to_key): Likewise. + 2001-03-05 Ken Raeburn * checksum.c, derive.c, dk.h, dk_decrypt.c, dk_encrypt.c, diff --git a/src/lib/crypto/dk/checksum.c b/src/lib/crypto/dk/checksum.c index ab1d00a92..efa3f2172 100644 --- a/src/lib/crypto/dk/checksum.c +++ b/src/lib/crypto/dk/checksum.c @@ -73,7 +73,7 @@ krb5_dk_make_checksum(hash, key, usage, input, output) /* derive the key */ - datain.data = constantdata; + datain.data = (char *) constantdata; datain.length = K5CLENGTH; datain.data[0] = (usage>>24)&0xff; diff --git a/src/lib/crypto/dk/dk_decrypt.c b/src/lib/crypto/dk/dk_decrypt.c index cd43c09a8..adc4d2348 100644 --- a/src/lib/crypto/dk/dk_decrypt.c +++ b/src/lib/crypto/dk/dk_decrypt.c @@ -79,7 +79,7 @@ krb5_dk_decrypt(enc, hash, key, usage, ivec, input, output) /* derive the keys */ - d1.data = constantdata; + d1.data = (char *) constantdata; d1.length = K5CLENGTH; d1.data[0] = (usage>>24)&0xff; @@ -103,20 +103,20 @@ krb5_dk_decrypt(enc, hash, key, usage, ivec, input, output) d1.data = input->data; d2.length = enclen; - d2.data = plaindata; + d2.data = (char *) plaindata; if ((ret = ((*(enc->decrypt))(&ke, ivec, &d1, &d2))) != 0) goto cleanup; if (ivec != NULL && ivec->length == blocksize) - cn = d1.data + d1.length - blocksize; + cn = (unsigned char *) d1.data + d1.length - blocksize; else cn = NULL; /* verify the hash */ d1.length = hashsize; - d1.data = cksum; + d1.data = (char *) cksum; if ((ret = krb5_hmac(hash, &ki, 1, &d2, &d1)) != 0) goto cleanup; diff --git a/src/lib/crypto/dk/stringtokey.c b/src/lib/crypto/dk/stringtokey.c index 1bbbe5731..57371cdf6 100644 --- a/src/lib/crypto/dk/stringtokey.c +++ b/src/lib/crypto/dk/stringtokey.c @@ -78,7 +78,7 @@ krb5_dk_string_to_key(enc, string, salt, key) /* now derive the key from this one */ indata.length = kerberos_len; - indata.data = (unsigned char *) kerberos; + indata.data = (char *) kerberos; if ((ret = krb5_derive_key(enc, &foldkey, key, &indata))) memset(key->contents, 0, key->length); diff --git a/src/lib/crypto/enc_provider/ChangeLog b/src/lib/crypto/enc_provider/ChangeLog index 67678779a..7c9c1b049 100644 --- a/src/lib/crypto/enc_provider/ChangeLog +++ b/src/lib/crypto/enc_provider/ChangeLog @@ -1,3 +1,9 @@ +2001-04-10 Ken Raeburn + + * des.c (k5_des_docrypt): Add casts when mixing pointer types with + different target signedness. + * des3.c (k5_des3_docrypt): Likewise. + 2001-03-09 Ken Raeburn * des.c, des3.c, enc_provider.h: Use krb5int_ prefix for internal diff --git a/src/lib/crypto/enc_provider/des.c b/src/lib/crypto/enc_provider/des.c index 983bc47b7..90cf6d01f 100644 --- a/src/lib/crypto/enc_provider/des.c +++ b/src/lib/crypto/enc_provider/des.c @@ -71,7 +71,10 @@ k5_des_docrypt(const krb5_keyblock *key, const krb5_data *ivec, mit_des_cbc_encrypt((krb5_pointer) input->data, (krb5_pointer) output->data, input->length, - schedule, ivec?ivec->data:(char *)mit_des_zeroblock, + schedule, + (ivec + ? (unsigned char *) ivec->data + : (unsigned char *) mit_des_zeroblock), encrypt); memset(schedule, 0, sizeof(schedule)); diff --git a/src/lib/crypto/enc_provider/des3.c b/src/lib/crypto/enc_provider/des3.c index 48ee99ee9..965032923 100644 --- a/src/lib/crypto/enc_provider/des3.c +++ b/src/lib/crypto/enc_provider/des3.c @@ -72,7 +72,7 @@ k5_des3_docrypt(const krb5_keyblock *key, const krb5_data *ivec, mit_des3_cbc_encrypt((krb5_pointer) input->data, (krb5_pointer) output->data, input->length, schedule[0], schedule[1], schedule[2], - ivec?ivec->data:(char *)mit_des_zeroblock, + ivec?(unsigned char *) ivec->data:(unsigned char *)mit_des_zeroblock, encrypt); memset(schedule, 0, sizeof(schedule)); diff --git a/src/lib/crypto/keyed_cksum.c b/src/lib/crypto/keyed_cksum.c index 39979c056..e7b45ac12 100644 --- a/src/lib/crypto/keyed_cksum.c +++ b/src/lib/crypto/keyed_cksum.c @@ -46,5 +46,5 @@ is_keyed_cksum(ctype) /* ick, but it's better than coredumping, which is what the old code would have done */ - return(-1); + return -1U; } diff --git a/src/lib/crypto/make_checksum.c b/src/lib/crypto/make_checksum.c index afd512533..ae38f9e77 100644 --- a/src/lib/crypto/make_checksum.c +++ b/src/lib/crypto/make_checksum.c @@ -62,7 +62,7 @@ krb5_c_make_checksum(context, cksumtype, key, usage, input, cksum) return(ENOMEM); data.length = cksum->length; - data.data = cksum->contents; + data.data = (char *) cksum->contents; if (krb5_cksumtypes_list[i].keyhash) { /* check if key is compatible */ diff --git a/src/lib/crypto/make_random_key.c b/src/lib/crypto/make_random_key.c index 6c6ff2639..ccac66460 100644 --- a/src/lib/crypto/make_random_key.c +++ b/src/lib/crypto/make_random_key.c @@ -59,7 +59,7 @@ krb5_c_make_random_key(context, enctype, random_key) return(ENOMEM); } - random_data.data = bytes; + random_data.data = (char *) bytes; random_data.length = keybytes; if ((ret = krb5_c_random_make_octets(context, &random_data))) diff --git a/src/lib/crypto/old/ChangeLog b/src/lib/crypto/old/ChangeLog index 890042edb..ed05469a2 100644 --- a/src/lib/crypto/old/ChangeLog +++ b/src/lib/crypto/old/ChangeLog @@ -1,3 +1,8 @@ +2001-04-10 Ken Raeburn + + * old_decrypt.c (krb5_old_decrypt): Fix casts. + * old_encrypt.c (krb5_old_encrypt): Likewise. + 2001-03-13 Ken Raeburn * Makefile.in (STLIBOBJS): Undo last change. diff --git a/src/lib/crypto/old/old_decrypt.c b/src/lib/crypto/old/old_decrypt.c index 38c1c2446..a43090c27 100644 --- a/src/lib/crypto/old/old_decrypt.c +++ b/src/lib/crypto/old/old_decrypt.c @@ -59,7 +59,7 @@ krb5_old_decrypt(const struct krb5_enc_provider *enc, if (arg_output->length < input->length) { output.length = input->length; - if ((output.data = (krb5_octet *) malloc(output.length)) == NULL) { + if ((output.data = (char *) malloc(output.length)) == NULL) { free(cksumdata); return(ENOMEM); } @@ -89,7 +89,7 @@ krb5_old_decrypt(const struct krb5_enc_provider *enc, /* XXX this is gross, but I don't have much choice */ if ((key->enctype == ENCTYPE_DES_CBC_CRC) && (ivec == 0)) { crcivec.length = key->length; - crcivec.data = key->contents; + crcivec.data = (char *) key->contents; ivec = &crcivec; } diff --git a/src/lib/crypto/old/old_encrypt.c b/src/lib/crypto/old/old_encrypt.c index 8ed8d769b..0f7ea8d0c 100644 --- a/src/lib/crypto/old/old_encrypt.c +++ b/src/lib/crypto/old/old_encrypt.c @@ -89,7 +89,7 @@ krb5_old_encrypt(const struct krb5_enc_provider *enc, /* XXX this is gross, but I don't have much choice */ if ((key->enctype == ENCTYPE_DES_CBC_CRC) && (ivec == 0)) { crcivec.length = key->length; - crcivec.data = key->contents; + crcivec.data = (char *) key->contents; ivec = &crcivec; real_ivec = 0; } else