(Added inline functions, with appropriate casts, for data conversion.)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19280
dc483132-0cff-0310-8789-
dd5450dbe970
#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);
#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);
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,
{
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;