aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsencrypt.c
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2010-10-27 16:20:36 -0400
committerSteve French <sfrench@us.ibm.com>2010-10-28 21:47:30 -0400
commitd3ba50b17aa7a391bb5b3dcd8d6ba7a02c4f031c (patch)
tree452ddaeb1d52387a852d0c3cf46c4253347d0a27 /fs/cifs/cifsencrypt.c
parent6b03590412c977ae8fa1635c9b80854ab19a5b78 (diff)
NTLM auth and sign - Use appropriate server challenge
Need to have cryptkey or server challenge in smb connection (struct TCP_Server_Info) for ntlm and ntlmv2 auth types for which cryptkey (Encryption Key) is supplied just once in Negotiate Protocol response during an smb connection setup for all the smb sessions over that smb connection. For ntlmssp, cryptkey or server challenge is provided for every smb session in type 2 packet of ntlmssp negotiation, the cryptkey provided during Negotiation Protocol response before smb connection does not count. Rename cryptKey to cryptkey and related changes. Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r--fs/cifs/cifsencrypt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 17d603ad5e34..ef95a272f73d 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -249,7 +249,7 @@ int setup_ntlm_response(struct cifsSesInfo *ses)
249 } 249 }
250 ses->auth_key.len = temp_len; 250 ses->auth_key.len = temp_len;
251 251
252 SMBNTencrypt(ses->password, ses->cryptKey, 252 SMBNTencrypt(ses->password, ses->server->cryptkey,
253 ses->auth_key.response + CIFS_SESS_KEY_SIZE); 253 ses->auth_key.response + CIFS_SESS_KEY_SIZE);
254 254
255 E_md4hash(ses->password, temp_key); 255 E_md4hash(ses->password, temp_key);
@@ -537,8 +537,12 @@ CalcNTLMv2_response(const struct cifsSesInfo *ses)
537 return rc; 537 return rc;
538 } 538 }
539 539
540 memcpy(ses->auth_key.response + offset, 540 if (ses->server->secType == RawNTLMSSP)
541 ses->cryptKey, CIFS_SERVER_CHALLENGE_SIZE); 541 memcpy(ses->auth_key.response + offset,
542 ses->cryptkey, CIFS_SERVER_CHALLENGE_SIZE);
543 else
544 memcpy(ses->auth_key.response + offset,
545 ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE);
542 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, 546 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash,
543 ses->auth_key.response + offset, ses->auth_key.len - offset); 547 ses->auth_key.response + offset, ses->auth_key.len - offset);
544 548