fix/add casts as needed
authorKen Raeburn <raeburn@mit.edu>
Tue, 10 Apr 2001 08:39:54 +0000 (08:39 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 10 Apr 2001 08:39:54 +0000 (08:39 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13170 dc483132-0cff-0310-8789-dd5450dbe970

16 files changed:
src/lib/crypto/ChangeLog
src/lib/crypto/des/ChangeLog
src/lib/crypto/des/t_afss2k.c
src/lib/crypto/dk/ChangeLog
src/lib/crypto/dk/checksum.c
src/lib/crypto/dk/dk_decrypt.c
src/lib/crypto/dk/stringtokey.c
src/lib/crypto/enc_provider/ChangeLog
src/lib/crypto/enc_provider/des.c
src/lib/crypto/enc_provider/des3.c
src/lib/crypto/keyed_cksum.c
src/lib/crypto/make_checksum.c
src/lib/crypto/make_random_key.c
src/lib/crypto/old/ChangeLog
src/lib/crypto/old/old_decrypt.c
src/lib/crypto/old/old_encrypt.c

index c3f4aacabaff17ae4e41eb99d74b12b6d0fbd02d..3268c3701c17331266e174a0540039328f90169f 100644 (file)
@@ -1,3 +1,12 @@
+2001-04-10  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <raeburn@mit.edu>
 
        * t_nfold.c: Include assert.h.
index af3bd971f25029d0c9239594ebf2290a85dae1f5..dc89e2c826aebfb53e3430c0c9ac46738670791d 100644 (file)
@@ -1,5 +1,7 @@
 2001-04-10  Ken Raeburn  <raeburn@mit.edu>
 
+       * 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.
index 851465006ef8b7db62f76e194877d1cbb1fa66e7..a6d0aa58d08f6bed47a1cbf8ce0bd72676be1701 100644 (file)
@@ -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);
index 7e9c1900bceacb88c954995502776d9f90af4066..af1ccab65c9d993b19cfec67e0c60a8d772e646d 100644 (file)
@@ -1,3 +1,10 @@
+2001-04-10  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <raeburn@mit.edu>
 
        * checksum.c, derive.c, dk.h, dk_decrypt.c, dk_encrypt.c,
index ab1d00a926a2e4b95ae7da8bd40d8e7df24745e2..efa3f21721128de00958b50de318870bf460a026 100644 (file)
@@ -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;
index cd43c09a8c8304c8083273d67f4455e8fd038cd0..adc4d2348f1e30e1c285a358793c973674d4fb06 100644 (file)
@@ -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;
index 1bbbe5731873e85bf20e28dee47151831375be7e..57371cdf6f03dfc63d4a89f99ef21ca1e1d7b249 100644 (file)
@@ -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);
index 67678779aa3c0bfc4b166eac6077954eebb501db..7c9c1b049b3b1d2d9cc7b94b20be635e765e71ca 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-10  Ken Raeburn  <raeburn@mit.edu>
+
+       * 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  <raeburn@mit.edu>
 
        * des.c, des3.c, enc_provider.h: Use krb5int_ prefix for internal
index 983bc47b7a28f8e90aedaeb82eca67306640e95e..90cf6d01fcb1cf19176361f73bf1d538d5b9de73 100644 (file)
@@ -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));
index 48ee99ee9f48161e7fd2b09d020944d86ddea540..96503292304c3852a6920d722f4d9818981fe111 100644 (file)
@@ -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));
index 39979c056eccf7006d2be8d026392291e91a592a..e7b45ac1265fc9963bf8d5c278d54603c0db640f 100644 (file)
@@ -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;
 }
index afd512533427110175f3bee48f8976027ae01589..ae38f9e772eb15dce38c108eb38caa1fb7cd6cea 100644 (file)
@@ -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 */
index 6c6ff26399a01de35c43e0c7aaebf7031dc979dd..ccac66460ba48496bfc7692e532644dae8809ae4 100644 (file)
@@ -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)))
index 890042edb79c1353d30265926ed6c07d5e47b786..ed05469a28d8dce9af98696a11cd6b35a6f0aa59 100644 (file)
@@ -1,3 +1,8 @@
+2001-04-10  Ken Raeburn  <raeburn@mit.edu>
+
+       * old_decrypt.c (krb5_old_decrypt): Fix casts.
+       * old_encrypt.c (krb5_old_encrypt): Likewise.
+
 2001-03-13  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in (STLIBOBJS): Undo last change.
index 38c1c24468163bbd5ceadeee662580a8edf8ed4a..a43090c27d8062bb57d2c43fdaaafe425d755ea3 100644 (file)
@@ -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;
     }
 
index 8ed8d769bd9db76abf8e5a3ef67559788cc24fd4..0f7ea8d0cd3eab847d878f7bff60092677dff838 100644 (file)
@@ -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