summaryrefslogtreecommitdiffstats
path: root/src/lib/crypto/krb/dk/stringtokey.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-02-27 19:08:14 +0000
committerGreg Hudson <ghudson@mit.edu>2011-02-27 19:08:14 +0000
commitec044ad8e3eafb829a43fbd1cb11b94fea6027fb (patch)
tree62695fd64027f1041cd18453fe41b1a9b6c08898 /src/lib/crypto/krb/dk/stringtokey.c
parent73b80b790cb90d012600d74c9ce2b36be45c3090 (diff)
downloadkrb5-ec044ad8e3eafb829a43fbd1cb11b94fea6027fb.tar.gz
krb5-ec044ad8e3eafb829a43fbd1cb11b94fea6027fb.tar.xz
krb5-ec044ad8e3eafb829a43fbd1cb11b94fea6027fb.zip
Reference random-to-key handlers through the enctype instead of the
enc_provider, for consistency with string-to-key and the place of implementation (other enc_provider functions are implemented in the back end, but random-to-key handlers are in krb). Use a single handler for non-DES/DES3 enctypes since it's always just directly copying the bits. Collapse the three implementations (des, des3, and direct) into random_to_key.c, as they're very short, and eliminate the lib/crypto/krb/rand2key directory. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24669 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/krb/dk/stringtokey.c')
-rw-r--r--src/lib/crypto/krb/dk/stringtokey.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/crypto/krb/dk/stringtokey.c b/src/lib/crypto/krb/dk/stringtokey.c
index 779f51bdf0..2c5188bdb8 100644
--- a/src/lib/crypto/krb/dk/stringtokey.c
+++ b/src/lib/crypto/krb/dk/stringtokey.c
@@ -35,7 +35,6 @@ krb5int_dk_string_to_key(const struct krb5_keytypes *ktp,
const krb5_data *string, const krb5_data *salt,
const krb5_data *parms, krb5_keyblock *keyblock)
{
- const struct krb5_enc_provider *enc = ktp->enc;
krb5_error_code ret;
size_t keybytes, keylength, concatlen;
unsigned char *concat = NULL, *foldstring = NULL, *foldkeydata = NULL;
@@ -45,8 +44,8 @@ krb5int_dk_string_to_key(const struct krb5_keytypes *ktp,
/* keyblock->length is checked by krb5int_derive_key. */
- keybytes = enc->keybytes;
- keylength = enc->keylength;
+ keybytes = ktp->enc->keybytes;
+ keylength = ktp->enc->keylength;
concatlen = string->length + (salt ? salt->length : 0);
@@ -74,7 +73,7 @@ krb5int_dk_string_to_key(const struct krb5_keytypes *ktp,
foldkeyblock.contents = foldkeydata;
foldkeyblock.enctype = ktp->etype;
- ret = enc->make_key(&indata, &foldkeyblock);
+ ret = ktp->rand2key(&indata, &foldkeyblock);
if (ret != 0)
goto cleanup;
@@ -87,7 +86,7 @@ krb5int_dk_string_to_key(const struct krb5_keytypes *ktp,
indata.length = kerberos_len;
indata.data = (char *) kerberos;
- ret = krb5int_derive_keyblock(enc, foldkey, keyblock, &indata,
+ ret = krb5int_derive_keyblock(ktp->enc, foldkey, keyblock, &indata,
DERIVE_RFC3961);
if (ret != 0)
memset(keyblock->contents, 0, keyblock->length);