diff options
author | Steve French <sfrench@us.ibm.com> | 2006-06-05 19:34:19 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-06-05 19:34:19 -0400 |
commit | a8ee03441f66e0674e641c0cbe1a9534cdee968f (patch) | |
tree | dcc0f590c417cddea20a40efdf82bc5b1b21d155 /fs/cifs | |
parent | 6d027cfdb19c26df3151a519ed55acfe2c4cb7c3 (diff) |
[CIFS] NTLMv2 support part 4
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifs_debug.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifsencrypt.c | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 2f55edf2eeea..96abeb738978 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -889,7 +889,7 @@ security_flags_write(struct file *file, const char __user *buffer, | |||
889 | } | 889 | } |
890 | 890 | ||
891 | if(flags & ~CIFSSEC_MASK) { | 891 | if(flags & ~CIFSSEC_MASK) { |
892 | cERROR(1,("attempt to set unsupported security flags 0x%d", | 892 | cERROR(1,("attempt to set unsupported security flags 0x%x", |
893 | flags & ~CIFSSEC_MASK)); | 893 | flags & ~CIFSSEC_MASK)); |
894 | return -EINVAL; | 894 | return -EINVAL; |
895 | } | 895 | } |
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 | ||
308 | static 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 | |||
308 | void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf) | 343 | void 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 | ||
322 | void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response) | 362 | void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response) |