From 16007fbb9361745cef2a9c322e0b7e1ec2b9d77a Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 11 Mar 2011 17:47:21 +0000 Subject: [PATCH] Fix NSS PBKDF2 in the v4 salt (i.e. empty salt) case git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24700 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/nss/pbkdf2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/nss/pbkdf2.c b/src/lib/crypto/nss/pbkdf2.c index 9a0d4fd66..10272c8d2 100644 --- a/src/lib/crypto/nss/pbkdf2.c +++ b/src/lib/crypto/nss/pbkdf2.c @@ -62,8 +62,9 @@ krb5int_pbkdf2_hmac_sha1(const krb5_data *out, unsigned long count, if (slot == NULL) return k5_nss_map_last_error(); + /* NSS treats a null saltItem.data as a request for a random salt. */ saltItem.type = siBuffer; - saltItem.data = (unsigned char *)salt->data; + saltItem.data = (salt->data == NULL) ? "" : (unsigned char *)salt->data; saltItem.len = salt->length; /* PKCS 5 was designed to be DER encoded. Algid's carry all the -- 2.26.2