(create_checksum): change so that `type == 0' means pick from the

`crypto' (context) and otherwise use that type.  this is not a large
change in practice and allows callers to specify the exact checksum
algorithm to use


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9760 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-03-26 00:49:12 +00:00
parent 629ce48728
commit b201faa9a6

View File

@@ -1404,19 +1404,20 @@ static krb5_error_code
create_checksum(krb5_context context, create_checksum(krb5_context context,
krb5_crypto crypto, krb5_crypto crypto,
unsigned usage, /* not krb5_key_usage */ unsigned usage, /* not krb5_key_usage */
krb5_cksumtype type, /* if crypto == NULL */ krb5_cksumtype type, /* 0 -> pick from crypto */
void *data, void *data,
size_t len, size_t len,
Checksum *result) Checksum *result)
{ {
struct checksum_type *ct; struct checksum_type *ct = NULL;
if(crypto) { if (type)
ct = _find_checksum(type);
else if(crypto) {
ct = crypto->et->keyed_checksum; ct = crypto->et->keyed_checksum;
if(ct == NULL) if(ct == NULL)
ct = crypto->et->cksumtype; ct = crypto->et->cksumtype;
} else }
ct = _find_checksum(type);
if(ct == NULL) if(ct == NULL)
return KRB5_PROG_SUMTYPE_NOSUPP; return KRB5_PROG_SUMTYPE_NOSUPP;
return do_checksum (context, ct, crypto, usage, data, len, result); return do_checksum (context, ct, crypto, usage, data, len, result);