From: Ken Raeburn Date: Thu, 21 Jun 2001 03:18:25 +0000 (+0000) Subject: fix salt length for afs case X-Git-Tag: krb5-1.3-alpha1~1352 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c87d36d6bbe2cc68ee9924ee45e034ca7dff92ce;p=krb5.git fix salt length for afs case git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13426 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 243993a47..65742691f 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,9 @@ +2001-06-20 Ken Raeburn + + * string2key.c (mit_des_string_to_key_int): Construct a krb5_data + object with proper length for the AFS case (indicated by a -1 salt + length on input). + 2001-06-12 Ezra Peisach * destest.c: main returns int instead of void. Add "const" to diff --git a/src/lib/crypto/des/string2key.c b/src/lib/crypto/des/string2key.c index 45a8500ec..65f401410 100644 --- a/src/lib/crypto/des/string2key.c +++ b/src/lib/crypto/des/string2key.c @@ -71,9 +71,9 @@ krb5_error_code mit_des_string_to_key_int (keyblock, data, salt) -krb5_keyblock FAR * keyblock; -const krb5_data FAR * data; -const krb5_data FAR * salt; + krb5_keyblock FAR * keyblock; + const krb5_data FAR * data; + const krb5_data FAR * salt; { register krb5_octet *str, *copystr; register krb5_octet *key; @@ -97,13 +97,15 @@ const krb5_data FAR * salt; key = keyblock->contents; if (salt) { - if (salt->length == SALT_TYPE_AFS_LENGTH || salt->length == (unsigned) -1) { - /* cheat and do AFS string2key instead */ - return mit_afs_string_to_key (keyblock, data, salt); - } else - length = data->length + salt->length; - } - else + if (salt->length == SALT_TYPE_AFS_LENGTH || salt->length == (unsigned) -1) { + krb5_data salt2; + salt2.data = salt->data; + salt2.length = strlen (salt2.data); + /* cheat and do AFS string2key instead */ + return mit_afs_string_to_key (keyblock, data, &salt2); + } else + length = data->length + salt->length; + } else length = data->length; copystr = malloc((size_t) length);