[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multiple krb5 salted des keys
Derrick J Brashear <shadow@dementia.org> writes:
> + if ((salttype == 0) ||
> + (!k->salt && ((salttype == KRB5_PW_SALT) && (saltlen == 0))) ||
> + ((salttype == k->salt->type) &&
> + ((salttype != KRB5_PW_SALT) ||
> + (((saltlen == 0) && (k->salt->salt.length == 0)) ||
> + ((saltlen > 0) && (k->salt->salt.length > 0)))))) {
> + *key = k;
> + return 0;
> + }
This looks, uhm.. bewildering.
krb5_error_code
hdb_encsalt2key(krb5_context context,
hdb_entry *e,
krb5_enctype enctype,
krb5_salttype salttype,
krb5_boolean zerosalt,
Key **key)
{
krb5_error_code ret;
*key = NULL;
while(1) {
ret = hdb_next_enctype2key(context, e, enctype, key);
if(ret)
break;
if(salttype == 0)
break;
if((*key)->salt == NULL) {
if(salttype == KRB5_PW_SALT && !zerosalt)
break;
continue;
}
if(salttype == (*key)->salt->type &&
(zerosalt && (*key)->salt->salt.length == 0) ||
(!zerosalt && (*key)->salt->salt.length > 0))
break;
}
return ret;
}
/Johan