From: Ken Raeburn Date: Thu, 10 May 2007 04:24:38 +0000 (+0000) Subject: Fix various gcc warnings about pointer target signedness and qualifiers X-Git-Tag: krb5-1.7-alpha1~1110 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c3da88c50011473240e206b40c38bd90e42c7f73;p=krb5.git Fix various gcc warnings about pointer target signedness and qualifiers git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19548 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/arcfour/arcfour_s2k.c b/src/lib/crypto/arcfour/arcfour_s2k.c index efa92bfb1..6ccfdb783 100644 --- a/src/lib/crypto/arcfour/arcfour_s2k.c +++ b/src/lib/crypto/arcfour/arcfour_s2k.c @@ -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); diff --git a/src/lib/crypto/dk/derive.c b/src/lib/crypto/dk/derive.c index 81dac4b57..77b05fa1a 100644 --- a/src/lib/crypto/dk/derive.c +++ b/src/lib/crypto/dk/derive.c @@ -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 */ diff --git a/src/lib/crypto/dk/dk_encrypt.c b/src/lib/crypto/dk/dk_encrypt.c index dfa7e07da..5b2d3e793 100644 --- a/src/lib/crypto/dk/dk_encrypt.c +++ b/src/lib/crypto/dk/dk_encrypt.c @@ -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; diff --git a/src/lib/crypto/enc_provider/aes.c b/src/lib/crypto/enc_provider/aes.c index 45019692d..9a71424f2 100644 --- a/src/lib/crypto/enc_provider/aes.c +++ b/src/lib/crypto/enc_provider/aes.c @@ -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; diff --git a/src/lib/crypto/enc_provider/des.c b/src/lib/crypto/enc_provider/des.c index 561e980f8..6c1e6064c 100644 --- a/src/lib/crypto/enc_provider/des.c +++ b/src/lib/crypto/enc_provider/des.c @@ -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)); diff --git a/src/lib/crypto/enc_provider/des3.c b/src/lib/crypto/enc_provider/des3.c index f844747c8..51e4ce796 100644 --- a/src/lib/crypto/enc_provider/des3.c +++ b/src/lib/crypto/enc_provider/des3.c @@ -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)); diff --git a/src/lib/crypto/keyhash_provider/descbc.c b/src/lib/crypto/keyhash_provider/descbc.c index fcccbfa7c..23b33fc07 100644 --- a/src/lib/crypto/keyhash_provider/descbc.c +++ b/src/lib/crypto/keyhash_provider/descbc.c @@ -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)); diff --git a/src/lib/crypto/keyhash_provider/k5_md4des.c b/src/lib/crypto/keyhash_provider/k5_md4des.c index 8e9623901..dc1026f23 100644 --- a/src/lib/crypto/keyhash_provider/k5_md4des.c +++ b/src/lib/crypto/keyhash_provider/k5_md4des.c @@ -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, diff --git a/src/lib/crypto/keyhash_provider/k5_md5des.c b/src/lib/crypto/keyhash_provider/k5_md5des.c index 4f7b89812..6180bbca6 100644 --- a/src/lib/crypto/keyhash_provider/k5_md5des.c +++ b/src/lib/crypto/keyhash_provider/k5_md5des.c @@ -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, diff --git a/src/lib/crypto/yarrow/ycipher.c b/src/lib/crypto/yarrow/ycipher.c index 01d105ffe..2af410440 100644 --- a/src/lib/crypto/yarrow/ycipher.c +++ b/src/lib/crypto/yarrow/ycipher.c @@ -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) diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index 3ffb701fe..6c20147a1 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -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;