aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsencrypt.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-06-05 19:34:19 -0400
committerSteve French <sfrench@us.ibm.com>2006-06-05 19:34:19 -0400
commita8ee03441f66e0674e641c0cbe1a9534cdee968f (patch)
treedcc0f590c417cddea20a40efdf82bc5b1b21d155 /fs/cifs/cifsencrypt.c
parent6d027cfdb19c26df3151a519ed55acfe2c4cb7c3 (diff)
[CIFS] NTLMv2 support part 4
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r--fs/cifs/cifsencrypt.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 09f94617e534..8bcb1da3270e 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -305,8 +305,44 @@ void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key)
305} 305}
306#endif /* CIFS_WEAK_PW_HASH */ 306#endif /* CIFS_WEAK_PW_HASH */
307 307
308static int calc_ntlmv2_hash(const struct cifsSesInfo *ses,
309 char * ntv2_hash)
310{
311 int rc = 0;
312 int len;
313 char nt_hash[16];
314 struct HMACMD5Context * pctxt;
315
316 pctxt = kmalloc(sizeof(struct HMACMD5Context), GFP_KERNEL);
317
318 if(pctxt == NULL)
319 return -ENOMEM;
320
321 /* calculate md4 hash of password */
322 E_md4hash(ses->password, nt_hash);
323
324 /* convERT Domainname to unicode and uppercase */
325 hmac_md5_init_limK_to_64(nt_hash, 16, pctxt);
326
327 /* convert ses->userName to unicode and uppercase */
328
329 /* len = ... */ /* BB FIXME BB */
330
331 /* hmac_md5_update(user, len, pctxt); */
332
333 /* convert ses->domainName to unicode and uppercase */
334
335 /* len = ... */ /* BB FIXME BB */
336 /* hmac_md5_update(domain, len, pctxt); */
337
338 hmac_md5_final(ntv2_hash, pctxt);
339
340 return rc;
341}
342
308void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf) 343void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf)
309{ 344{
345 int rc;
310 struct ntlmv2_resp * buf = (struct ntlmv2_resp *)resp_buf; 346 struct ntlmv2_resp * buf = (struct ntlmv2_resp *)resp_buf;
311 347
312 buf->blob_signature = cpu_to_le32(0x00000101); 348 buf->blob_signature = cpu_to_le32(0x00000101);
@@ -316,7 +352,11 @@ void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf)
316 buf->reserved2 = 0; 352 buf->reserved2 = 0;
317 buf->names[0].type = 0; 353 buf->names[0].type = 0;
318 buf->names[0].length = 0; 354 buf->names[0].length = 0;
355
319 /* calculate buf->ntlmv2_hash */ 356 /* calculate buf->ntlmv2_hash */
357 rc = calc_ntlmv2_hash(ses,buf->ntlmv2_hash);
358 if(rc)
359 cERROR(1,("could not get v2 hash rc %d",rc));
320} 360}
321 361
322void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response) 362void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response)