Fix various gcc warnings about pointer target signedness and qualifiers
authorKen Raeburn <raeburn@mit.edu>
Thu, 10 May 2007 04:24:38 +0000 (04:24 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 10 May 2007 04:24:38 +0000 (04:24 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19548 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/arcfour/arcfour_s2k.c
src/lib/crypto/dk/derive.c
src/lib/crypto/dk/dk_encrypt.c
src/lib/crypto/enc_provider/aes.c
src/lib/crypto/enc_provider/des.c
src/lib/crypto/enc_provider/des3.c
src/lib/crypto/keyhash_provider/descbc.c
src/lib/crypto/keyhash_provider/k5_md4des.c
src/lib/crypto/keyhash_provider/k5_md5des.c
src/lib/crypto/yarrow/ycipher.c
src/lib/krb5/asn.1/asn1_k_decode.c

index efa92bfb11c3c92fc8af38a07ac2b5af56023fbb..6ccfdb78322646d723d88475689d5a66fa59b134 100644 (file)
@@ -43,7 +43,7 @@ krb5int_arcfour_string_to_key(const struct krb5_enc_provider *enc,
     return ENOMEM;
 
   /* make the string.  start by creating the unicode version of the password*/
-  asctouni(copystr, string->data, slen );
+  asctouni(copystr, (unsigned char *) string->data, slen);
 
   /* the actual MD4 hash of the data */
   krb5_MD4Init(&md4_context);
index 81dac4b57c5ee918353e435bc649c24e605dbdc1..77b05fa1abcdf3c5e550110dcaf2e982dbd7d7e6 100644 (file)
@@ -60,10 +60,10 @@ krb5_derive_key(const struct krb5_enc_provider *enc,
        return(ENOMEM);
     }
 
-    inblock.data = inblockdata;
+    inblock.data = (char *) inblockdata;
     inblock.length = blocksize;
 
-    outblock.data = outblockdata;
+    outblock.data = (char *) outblockdata;
     outblock.length = blocksize;
 
     /* initialize the input block */
@@ -71,8 +71,8 @@ krb5_derive_key(const struct krb5_enc_provider *enc,
     if (in_constant->length == inblock.length) {
        memcpy(inblock.data, in_constant->data, inblock.length);
     } else {
-       krb5_nfold(in_constant->length*8, in_constant->data,
-                  inblock.length*8, inblock.data);
+       krb5_nfold(in_constant->length*8, (unsigned char *) in_constant->data,
+                  inblock.length*8, (unsigned char *) inblock.data);
     }
 
     /* loop encrypting the blocks until enough key bytes are generated */
@@ -93,7 +93,7 @@ krb5_derive_key(const struct krb5_enc_provider *enc,
 
     /* postprocess the key */
 
-    inblock.data = rawkey;
+    inblock.data = (char *) rawkey;
     inblock.length = keybytes;
 
     (*(enc->make_key))(&inblock, outkey);
@@ -145,10 +145,10 @@ krb5_derive_random(const struct krb5_enc_provider *enc,
        return(ENOMEM);
     }
 
-    inblock.data = inblockdata;
+    inblock.data = (char *) inblockdata;
     inblock.length = blocksize;
 
-    outblock.data = outblockdata;
+    outblock.data = (char *) outblockdata;
     outblock.length = blocksize;
 
     /* initialize the input block */
@@ -156,8 +156,8 @@ krb5_derive_random(const struct krb5_enc_provider *enc,
     if (in_constant->length == inblock.length) {
        memcpy(inblock.data, in_constant->data, inblock.length);
     } else {
-       krb5_nfold(in_constant->length*8, in_constant->data,
-                  inblock.length*8, inblock.data);
+       krb5_nfold(in_constant->length*8, (unsigned char *) in_constant->data,
+                  inblock.length*8, (unsigned char *) inblock.data);
     }
 
     /* loop encrypting the blocks until enough key bytes are generated */
index dfa7e07da1abcd0f31b7ac9473f2c0e6aeaaff4f..5b2d3e793746a556ba2b3dc63119746d6e900b1d 100644 (file)
@@ -59,7 +59,8 @@ krb5_dk_encrypt(const struct krb5_enc_provider *enc,
     krb5_error_code ret;
     unsigned char constantdata[K5CLENGTH];
     krb5_data d1, d2;
-    unsigned char *plaintext, *kedata, *kidata, *cn;
+    unsigned char *plaintext, *kedata, *kidata;
+    char *cn;
     krb5_keyblock ke, ki;
 
     /* allocate and set up plaintext and to-be-derived keys */
@@ -95,7 +96,7 @@ krb5_dk_encrypt(const struct krb5_enc_provider *enc,
 
     /* derive the keys */
 
-    d1.data = constantdata;
+    d1.data = (char *) constantdata;
     d1.length = K5CLENGTH;
 
     d1.data[0] = (usage>>24)&0xff;
@@ -116,7 +117,7 @@ krb5_dk_encrypt(const struct krb5_enc_provider *enc,
     /* put together the plaintext */
 
     d1.length = blocksize;
-    d1.data = plaintext;
+    d1.data = (char *) plaintext;
 
     if ((ret = krb5_c_random_make_octets(/* XXX */ 0, &d1)))
        goto cleanup;
@@ -129,7 +130,7 @@ krb5_dk_encrypt(const struct krb5_enc_provider *enc,
     /* encrypt the plaintext */
 
     d1.length = plainlen;
-    d1.data = plaintext;
+    d1.data = (char *) plaintext;
 
     d2.length = plainlen;
     d2.data = output->data;
@@ -224,7 +225,8 @@ krb5int_aes_dk_encrypt(const struct krb5_enc_provider *enc,
     krb5_error_code ret;
     unsigned char constantdata[K5CLENGTH];
     krb5_data d1, d2;
-    unsigned char *plaintext, *kedata, *kidata, *cn;
+    unsigned char *plaintext, *kedata, *kidata;
+    char *cn;
     krb5_keyblock ke, ki;
 
     /* allocate and set up plaintext and to-be-derived keys */
@@ -260,7 +262,7 @@ krb5int_aes_dk_encrypt(const struct krb5_enc_provider *enc,
 
     /* derive the keys */
 
-    d1.data = constantdata;
+    d1.data = (char *) constantdata;
     d1.length = K5CLENGTH;
 
     d1.data[0] = (usage>>24)&0xff;
@@ -281,7 +283,7 @@ krb5int_aes_dk_encrypt(const struct krb5_enc_provider *enc,
     /* put together the plaintext */
 
     d1.length = blocksize;
-    d1.data = plaintext;
+    d1.data = (char *) plaintext;
 
     if ((ret = krb5_c_random_make_octets(/* XXX */ 0, &d1)))
        goto cleanup;
@@ -295,7 +297,7 @@ krb5int_aes_dk_encrypt(const struct krb5_enc_provider *enc,
     /* encrypt the plaintext */
 
     d1.length = plainlen;
-    d1.data = plaintext;
+    d1.data = (char *) plaintext;
 
     d2.length = plainlen;
     d2.data = output->data;
index 45019692d4cc0920d1e668c76a9e6e97b5422693..9a71424f22f740396af5f25cfc46aa56328b790d 100644 (file)
@@ -37,8 +37,18 @@ static void printd (const char *descr, krb5_data *d) {
 }
 #endif
 
-#define enc(OUT, IN, CTX) (aes_enc_blk((IN),(OUT),(CTX)) == aes_good ? (void) 0 : abort())
-#define dec(OUT, IN, CTX) (aes_dec_blk((IN),(OUT),(CTX)) == aes_good ? (void) 0 : abort())
+static inline void enc(char *out, const char *in, aes_ctx *ctx)
+{
+    if (aes_enc_blk((const unsigned char *)in, (unsigned char *)out, ctx)
+       != aes_good)
+       abort();
+}
+static inline void dec(char *out, const char *in, aes_ctx *ctx)
+{
+    if (aes_dec_blk((const unsigned char *)in, (unsigned char *)out, ctx)
+       != aes_good)
+       abort();
+}
 
 static void xorblock(char *out, const char *in)
 {
@@ -52,7 +62,7 @@ krb5int_aes_encrypt(const krb5_keyblock *key, const krb5_data *ivec,
                    const krb5_data *input, krb5_data *output)
 {
     aes_ctx ctx;
-    unsigned char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
+    char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
     int nblocks = 0, blockno;
 
 /*    CHECK_SIZES; */
@@ -106,7 +116,7 @@ krb5int_aes_decrypt(const krb5_keyblock *key, const krb5_data *ivec,
                    const krb5_data *input, krb5_data *output)
 {
     aes_ctx ctx;
-    unsigned char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
+    char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
     int nblocks = 0, blockno;
 
     CHECK_SIZES;
index 561e980f8795dad26a11d1693ec9fd9524c49841..6c1e6064c2e9efac8e5ea0f8b4caea520e10d7fc 100644 (file)
@@ -58,8 +58,8 @@ k5_des_docrypt(const krb5_keyblock *key, const krb5_data *ivec,
                        (krb5_pointer) output->data, input->length,
                        schedule,
                        (ivec
-                        ? (unsigned char *) ivec->data
-                        : (unsigned char *) mit_des_zeroblock),
+                        ? (const unsigned char *) ivec->data
+                        : (const unsigned char *) mit_des_zeroblock),
                        enc);
 
     memset(schedule, 0, sizeof(schedule));
index f844747c85bb6821ef21d91846a4eddbc2e965fd..51e4ce7967a03ac1ebce98b2099887eafd5d0c35 100644 (file)
@@ -68,7 +68,7 @@ k5_des3_encrypt(const krb5_keyblock *key, const krb5_data *ivec,
     krb5int_des3_cbc_encrypt((krb5_pointer) input->data,
                             (krb5_pointer) output->data, input->length,
                             schedule[0], schedule[1], schedule[2],
-                            ivec?(unsigned char *) ivec->data:(unsigned char *)mit_des_zeroblock);
+                            ivec?(const unsigned char *) ivec->data:(const unsigned char *)mit_des_zeroblock);
 
     zap(schedule, sizeof(schedule));
 
@@ -90,7 +90,7 @@ k5_des3_decrypt(const krb5_keyblock *key, const krb5_data *ivec,
     krb5int_des3_cbc_decrypt((krb5_pointer) input->data,
                             (krb5_pointer) output->data, input->length,
                             schedule[0], schedule[1], schedule[2],
-                            ivec?(unsigned char *) ivec->data:(unsigned char *)mit_des_zeroblock);
+                            ivec?(const unsigned char *) ivec->data:(const unsigned char *)mit_des_zeroblock);
 
     zap(schedule, sizeof(schedule));
 
index fcccbfa7c0d853a2f71024ae8701d4b3b652b5a8..23b33fc07d6c3ba79716bebbfd427ce64962ab77 100644 (file)
@@ -55,8 +55,8 @@ k5_descbc_hash(const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *i
     mit_des_cbc_cksum((unsigned char *) input->data, 
                      (unsigned char *) output->data, input->length,
                      schedule, 
-                     ivec? (unsigned char *)ivec->data: 
-                           (unsigned char *)mit_des_zeroblock);
+                     ivec? (const unsigned char *)ivec->data: 
+                           (const unsigned char *)mit_des_zeroblock);
 
     memset(schedule, 0, sizeof(schedule));
 
index 8e962390164412807ef6c7e206b2d529c12a4b6c..dc1026f23e9c6b63f2ffcbf1a0460cc590f9b2ae 100644 (file)
@@ -96,7 +96,8 @@ k5_md4des_hash(const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *i
 
     mit_des_cbc_encrypt((krb5_pointer) output->data,
                        (krb5_pointer) output->data, output->length,
-                       schedule, (unsigned char *) mit_des_zeroblock, 1);
+                       schedule, (const unsigned char *) mit_des_zeroblock,
+                       1);
 
     return(0);
 }
@@ -150,7 +151,8 @@ k5_md4des_verify(const krb5_keyblock *key, krb5_keyusage usage,
     if (!compathash) {
        mit_des_cbc_encrypt((krb5_pointer) hash->data,
                            (krb5_pointer) plaintext, hash->length,
-                           schedule, (unsigned char *) mit_des_zeroblock, 0);
+                           schedule,
+                           (const unsigned char *) mit_des_zeroblock, 0);
     } else {
        mit_des_cbc_encrypt((krb5_pointer) hash->data,
                            (krb5_pointer) plaintext, hash->length,
index 4f7b89812d0693b75f6fa03495bc548db4ac18ae..6180bbca6f268f332978f32755a9642de2afa4cb 100644 (file)
@@ -96,7 +96,8 @@ k5_md5des_hash(const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *i
 
     mit_des_cbc_encrypt((krb5_pointer) output->data,
                        (krb5_pointer) output->data, output->length,
-                       schedule, (unsigned char *) mit_des_zeroblock, 1);
+                       schedule, (const unsigned char *) mit_des_zeroblock,
+                       1);
 
     return(0);
 }
@@ -148,7 +149,8 @@ k5_md5des_verify(const krb5_keyblock *key, krb5_keyusage usage, const krb5_data
     if (!compathash) {
        mit_des_cbc_encrypt((krb5_pointer) hash->data,
                            (krb5_pointer) plaintext, hash->length,
-                           schedule, (unsigned char *) mit_des_zeroblock, 0);
+                           schedule,
+                           (const unsigned char *) mit_des_zeroblock, 0);
     } else {
        mit_des_cbc_encrypt((krb5_pointer) hash->data,
                            (krb5_pointer) plaintext, hash->length,
index 01d105ffec375a01301421865b92ef10aa0da7ad..2af410440d649dfd4fba72461ea31612682f303c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lib/crypto/yarrow/ycipher.c
  *
- * Copyright (C) 2001 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2001, 2007 by the Massachusetts Institute of Technology.
  * All rights reserved.
  *
  * Export of this software from the United States of America may
@@ -74,7 +74,7 @@ int krb5int_yarrow_cipher_encrypt_block
   const struct krb5_enc_provider *enc = &yarrow_enc_provider;
   ind.data = (char *) in;
   ind.length = CIPHER_BLOCK_SIZE;
-  outd.data = out;
+  outd.data = (char *) out;
   outd.length = CIPHER_BLOCK_SIZE;
   ret = enc->encrypt (&ctx->key, 0, &ind, &outd);
   if (ret)
index 3ffb701fe4d12e5969b1b4d099291c0c84e5b1fd..6c20147a1e143f9fed859cff7d3ebddedb8aa008 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * src/lib/krb5/asn.1/asn1_k_decode.c
  * 
- * Copyright 1994 by the Massachusetts Institute of Technology.
+ * Copyright 1994, 2007 by the Massachusetts Institute of Technology.
  * All Rights Reserved.
  *
  * Export of this software from the United States of America may
@@ -813,7 +813,9 @@ static asn1_error_code asn1_decode_etype_info2_entry(asn1buf *buf, krb5_etype_in
   { begin_structure();
     get_field(val->etype,0,asn1_decode_enctype);
     if (tagnum == 1) {
-           get_lenfield(val->length,val->salt,1,asn1_decode_generalstring);
+       char *salt;
+       get_lenfield(val->length,salt,1,asn1_decode_generalstring);
+       val->salt = (krb5_octet *) salt;
     } else {
            val->length = KRB5_ETYPE_NO_SALT;
            val->salt = 0;