lib/krb5: use krb5_verify_checksum() in krb5_c_verify_checksum()
This allows the optimized checksum->verify() function to be used. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from Samba commit fb318ab0203297019c5e47c6bef4a9abfdeea8a5)
This commit is contained in:

committed by
Nico Williams

parent
641105bfbd
commit
6fa09c001f
@@ -67,22 +67,23 @@ krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key,
|
||||
const krb5_checksum *cksum, krb5_boolean *valid)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_checksum data_cksum;
|
||||
krb5_crypto crypto;
|
||||
|
||||
*valid = 0;
|
||||
|
||||
ret = krb5_c_make_checksum(context, cksum->cksumtype,
|
||||
key, usage, data, &data_cksum);
|
||||
ret = krb5_crypto_init(context, key, 0, &crypto);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (data_cksum.cksumtype == cksum->cksumtype
|
||||
&& krb5_data_ct_cmp(&data_cksum.checksum, &cksum->checksum) == 0)
|
||||
ret = krb5_verify_checksum(context, crypto, usage,
|
||||
data->data, data->length, cksum);
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
|
||||
if (ret == 0) {
|
||||
*valid = 1;
|
||||
}
|
||||
|
||||
krb5_free_checksum_contents(context, &data_cksum);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
|
Reference in New Issue
Block a user