summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/crypto/des/ChangeLog6
-rw-r--r--src/lib/crypto/des/string2key.c22
2 files changed, 18 insertions, 10 deletions
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 <raeburn@mit.edu>
+
+ * 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 <epeisach@mit.edu>
* 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);