[CIFS] NTLMv2 support part 4
Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
6d027cfdb1
commit
a8ee03441f
2 changed files with 41 additions and 1 deletions
|
@ -889,7 +889,7 @@ security_flags_write(struct file *file, const char __user *buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags & ~CIFSSEC_MASK) {
|
if(flags & ~CIFSSEC_MASK) {
|
||||||
cERROR(1,("attempt to set unsupported security flags 0x%d",
|
cERROR(1,("attempt to set unsupported security flags 0x%x",
|
||||||
flags & ~CIFSSEC_MASK));
|
flags & ~CIFSSEC_MASK));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,8 +305,44 @@ void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key)
|
||||||
}
|
}
|
||||||
#endif /* CIFS_WEAK_PW_HASH */
|
#endif /* CIFS_WEAK_PW_HASH */
|
||||||
|
|
||||||
|
static int calc_ntlmv2_hash(const struct cifsSesInfo *ses,
|
||||||
|
char * ntv2_hash)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
int len;
|
||||||
|
char nt_hash[16];
|
||||||
|
struct HMACMD5Context * pctxt;
|
||||||
|
|
||||||
|
pctxt = kmalloc(sizeof(struct HMACMD5Context), GFP_KERNEL);
|
||||||
|
|
||||||
|
if(pctxt == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/* calculate md4 hash of password */
|
||||||
|
E_md4hash(ses->password, nt_hash);
|
||||||
|
|
||||||
|
/* convERT Domainname to unicode and uppercase */
|
||||||
|
hmac_md5_init_limK_to_64(nt_hash, 16, pctxt);
|
||||||
|
|
||||||
|
/* convert ses->userName to unicode and uppercase */
|
||||||
|
|
||||||
|
/* len = ... */ /* BB FIXME BB */
|
||||||
|
|
||||||
|
/* hmac_md5_update(user, len, pctxt); */
|
||||||
|
|
||||||
|
/* convert ses->domainName to unicode and uppercase */
|
||||||
|
|
||||||
|
/* len = ... */ /* BB FIXME BB */
|
||||||
|
/* hmac_md5_update(domain, len, pctxt); */
|
||||||
|
|
||||||
|
hmac_md5_final(ntv2_hash, pctxt);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf)
|
void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
struct ntlmv2_resp * buf = (struct ntlmv2_resp *)resp_buf;
|
struct ntlmv2_resp * buf = (struct ntlmv2_resp *)resp_buf;
|
||||||
|
|
||||||
buf->blob_signature = cpu_to_le32(0x00000101);
|
buf->blob_signature = cpu_to_le32(0x00000101);
|
||||||
|
@ -316,7 +352,11 @@ void setup_ntlmv2_rsp(const struct cifsSesInfo * ses, char * resp_buf)
|
||||||
buf->reserved2 = 0;
|
buf->reserved2 = 0;
|
||||||
buf->names[0].type = 0;
|
buf->names[0].type = 0;
|
||||||
buf->names[0].length = 0;
|
buf->names[0].length = 0;
|
||||||
|
|
||||||
/* calculate buf->ntlmv2_hash */
|
/* calculate buf->ntlmv2_hash */
|
||||||
|
rc = calc_ntlmv2_hash(ses,buf->ntlmv2_hash);
|
||||||
|
if(rc)
|
||||||
|
cERROR(1,("could not get v2 hash rc %d",rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response)
|
void CalcNTLMv2_response(const struct cifsSesInfo * ses,char * v2_session_response)
|
||||||
|
|
Loading…
Reference in a new issue