summaryrefslogtreecommitdiff
path: root/src/lib/crypto/krb/string_to_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/crypto/krb/string_to_key.c')
-rw-r--r--src/lib/crypto/krb/string_to_key.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/crypto/krb/string_to_key.c b/src/lib/crypto/krb/string_to_key.c
index b55ee75d2f34..352a8e8dcce2 100644
--- a/src/lib/crypto/krb/string_to_key.c
+++ b/src/lib/crypto/krb/string_to_key.c
@@ -43,6 +43,7 @@ krb5_c_string_to_key_with_params(krb5_context context, krb5_enctype enctype,
const krb5_data *params, krb5_keyblock *key)
{
krb5_error_code ret;
+ krb5_data empty = empty_data();
const struct krb5_keytypes *ktp;
size_t keylength;
@@ -51,8 +52,12 @@ krb5_c_string_to_key_with_params(krb5_context context, krb5_enctype enctype,
return KRB5_BAD_ENCTYPE;
keylength = ktp->enc->keylength;
+ /* For compatibility with past behavior, treat a null salt as empty. */
+ if (salt == NULL)
+ salt = ∅
+
/* Fail gracefully if someone is using the old AFS string-to-key hack. */
- if (salt != NULL && salt->length == SALT_TYPE_AFS_LENGTH)
+ if (salt->length == SALT_TYPE_AFS_LENGTH)
return EINVAL;
key->contents = malloc(keylength);