Add krb5_k_prf, the krb5_key version of krb5_c_prf
authorGreg Hudson <ghudson@mit.edu>
Fri, 27 Nov 2009 00:00:06 +0000 (00:00 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 27 Nov 2009 00:00:06 +0000 (00:00 +0000)
ticket: 6576

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23365 dc483132-0cff-0310-8789-dd5450dbe970

src/include/krb5/krb5.hin
src/lib/crypto/krb/prf.c
src/lib/crypto/libk5crypto.exports

index 0f1d400076ef518f0eef9cdf96ef7c095bb52f4c..61f318f2be3676ddd0a5fb656805eb29d5d721e6 100644 (file)
@@ -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
index 141390f63ab3651f4eb0f42cf845f62dab62cfce..27286c34853e8bca744bfcddcd23444a80df44d1 100644 (file)
@@ -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;
 }
index 291c2f058012ea402afb7a4c80136630f3a53026..f014dd68c8623c7156ff087d594ba4a0663272fb 100644 (file)
@@ -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