From: Ken Raeburn Date: Sun, 25 Mar 2007 23:09:48 +0000 (+0000) Subject: Convert keyblock or padata types to krb5_data without compiler warnings. X-Git-Tag: krb5-1.7-alpha1~1222 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c978ebd447e168fdd9f617f6ffa460d736e6963b;p=krb5.git Convert keyblock or padata types to krb5_data without compiler warnings. (Added inline functions, with appropriate casts, for data conversion.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19280 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/gen_seqnum.c b/src/lib/krb5/krb/gen_seqnum.c index 373764097..06564ee4a 100644 --- a/src/lib/krb5/krb/gen_seqnum.c +++ b/src/lib/krb5/krb/gen_seqnum.c @@ -35,14 +35,23 @@ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif +static inline krb5_data +key2data (krb5_keyblock k) +{ + krb5_data d; + d.magic = KV5M_DATA; + d.length = k.length; + d.data = (char *) k.contents; + return d; +} + krb5_error_code krb5_generate_seq_number(krb5_context context, const krb5_keyblock *key, krb5_ui_4 *seqno) { krb5_data seed; krb5_error_code retval; - seed.length = key->length; - seed.data = key->contents; + seed = key2data(*key); if ((retval = krb5_c_random_add_entropy(context, KRB5_C_RANDSOURCE_TRUSTEDPARTY, &seed))) return(retval); diff --git a/src/lib/krb5/krb/gen_subkey.c b/src/lib/krb5/krb/gen_subkey.c index 7ffc91f13..ad8d4bba3 100644 --- a/src/lib/krb5/krb/gen_subkey.c +++ b/src/lib/krb5/krb/gen_subkey.c @@ -29,14 +29,23 @@ #include "k5-int.h" +static inline krb5_data +key2data (krb5_keyblock k) +{ + krb5_data d; + d.magic = KV5M_DATA; + d.length = k.length; + d.data = (char *) k.contents; + return d; +} + krb5_error_code krb5_generate_subkey(krb5_context context, const krb5_keyblock *key, krb5_keyblock **subkey) { krb5_error_code retval; krb5_data seed; - seed.length = key->length; - seed.data = key->contents; + seed = key2data(*key); if ((retval = krb5_c_random_add_entropy(context, KRB5_C_RANDSOURCE_TRUSTEDPARTY, &seed))) return(retval); diff --git a/src/lib/krb5/krb/preauth2.c b/src/lib/krb5/krb/preauth2.c index 2a2756f33..18d737c34 100644 --- a/src/lib/krb5/krb/preauth2.c +++ b/src/lib/krb5/krb/preauth2.c @@ -566,6 +566,16 @@ krb5_run_preauth_plugins(krb5_context kcontext, return 0; } +static inline krb5_data +padata2data(krb5_pa_data p) +{ + krb5_data d; + d.magic = KV5M_DATA; + d.length = p.length; + d.data = (char *) p.contents; + return d; +} + static krb5_error_code pa_salt(krb5_context context, krb5_kdc_req *request, @@ -579,11 +589,9 @@ krb5_error_code pa_salt(krb5_context context, { krb5_data tmp; - tmp.data = in_padata->contents; - tmp.length = in_padata->length; + tmp = padata2data(*in_padata); krb5_free_data_contents(context, salt); krb5int_copy_data_contents(context, &tmp, salt); - if (in_padata->pa_type == KRB5_PADATA_AFS3_SALT) salt->length = SALT_TYPE_AFS_LENGTH;