From: Greg Hudson Date: Fri, 27 Nov 2009 00:00:06 +0000 (+0000) Subject: Add krb5_k_prf, the krb5_key version of krb5_c_prf X-Git-Tag: krb5-1.8-alpha1~141 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c8572c103a04a852c81747f249317bc42be1dc13;p=krb5.git Add krb5_k_prf, the krb5_key version of krb5_c_prf ticket: 6576 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23365 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index 0f1d40007..61f318f2b 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -744,6 +744,9 @@ krb5_k_verify_checksum_iov(krb5_context context, krb5_cksumtype cksumtype, const krb5_crypto_iov *data, size_t num_data, krb5_boolean *valid); +krb5_error_code KRB5_CALLCONV +krb5_k_prf(krb5_context context, krb5_key key, krb5_data *in, krb5_data *out); + #ifdef KRB5_OLD_CRYPTO /* * old cryptosystem routine prototypes. These are now layered diff --git a/src/lib/crypto/krb/prf.c b/src/lib/crypto/krb/prf.c index 141390f63..27286c348 100644 --- a/src/lib/crypto/krb/prf.c +++ b/src/lib/crypto/krb/prf.c @@ -50,17 +50,16 @@ krb5_c_prf_length(krb5_context context, krb5_enctype enctype, size_t *len) } krb5_error_code KRB5_CALLCONV -krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, +krb5_k_prf(krb5_context context, krb5_key key, krb5_data *input, krb5_data *output) { const struct krb5_keytypes *ktp; - krb5_key key; krb5_error_code ret; assert(input && output); assert(output->data); - ktp = find_enctype(keyblock->enctype); + ktp = find_enctype(key->keyblock.enctype); if (ktp == NULL) return KRB5_BAD_ENCTYPE; if (ktp->prf == NULL) @@ -69,10 +68,21 @@ krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, output->magic = KV5M_DATA; if (ktp->prf_length != output->length) return KRB5_CRYPTO_INTERNAL; + ret = (*ktp->prf)(ktp->enc, ktp->hash, key, input, output); + return ret; +} + +krb5_error_code KRB5_CALLCONV +krb5_c_prf(krb5_context context, const krb5_keyblock *keyblock, + krb5_data *input, krb5_data *output) +{ + krb5_key key; + krb5_error_code ret; + ret = krb5_k_create_key(context, keyblock, &key); if (ret != 0) return ret; - ret = (*ktp->prf)(ktp->enc, ktp->hash, key, input, output); + ret = krb5_k_prf(context, key, input, output); krb5_k_free_key(context, key); return ret; } diff --git a/src/lib/crypto/libk5crypto.exports b/src/lib/crypto/libk5crypto.exports index 291c2f058..f014dd68c 100644 --- a/src/lib/crypto/libk5crypto.exports +++ b/src/lib/crypto/libk5crypto.exports @@ -80,6 +80,7 @@ krb5_k_key_enctype krb5_k_key_keyblock krb5_k_make_checksum krb5_k_make_checksum_iov +krb5_k_prf krb5_k_verify_checksum krb5_k_verify_checksum_iov krb5int_keyhash_md4des