diff options
| -rw-r--r-- | fs/cifs/cifsencrypt.c | 57 | ||||
| -rw-r--r-- | fs/cifs/cifsproto.h | 2 |
2 files changed, 0 insertions, 59 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 847628dfdc44..35042d8f7338 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
| @@ -223,63 +223,6 @@ int cifs_calculate_mac_key(struct mac_key *key, const char *rn, | |||
| 223 | return 0; | 223 | return 0; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *ses, | ||
| 227 | const struct nls_table *nls_info) | ||
| 228 | { | ||
| 229 | char temp_hash[16]; | ||
| 230 | struct HMACMD5Context ctx; | ||
| 231 | char *ucase_buf; | ||
| 232 | __le16 *unicode_buf; | ||
| 233 | unsigned int i, user_name_len, dom_name_len; | ||
| 234 | |||
| 235 | if (ses == NULL) | ||
| 236 | return -EINVAL; | ||
| 237 | |||
| 238 | E_md4hash(ses->password, temp_hash); | ||
| 239 | |||
| 240 | hmac_md5_init_limK_to_64(temp_hash, 16, &ctx); | ||
| 241 | user_name_len = strlen(ses->userName); | ||
| 242 | if (user_name_len > MAX_USERNAME_SIZE) | ||
| 243 | return -EINVAL; | ||
| 244 | if (ses->domainName == NULL) | ||
| 245 | return -EINVAL; /* BB should we use CIFS_LINUX_DOM */ | ||
| 246 | dom_name_len = strlen(ses->domainName); | ||
| 247 | if (dom_name_len > MAX_USERNAME_SIZE) | ||
| 248 | return -EINVAL; | ||
| 249 | |||
| 250 | ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL); | ||
| 251 | if (ucase_buf == NULL) | ||
| 252 | return -ENOMEM; | ||
| 253 | unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL); | ||
| 254 | if (unicode_buf == NULL) { | ||
| 255 | kfree(ucase_buf); | ||
| 256 | return -ENOMEM; | ||
| 257 | } | ||
| 258 | |||
| 259 | for (i = 0; i < user_name_len; i++) | ||
| 260 | ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]]; | ||
| 261 | ucase_buf[i] = 0; | ||
| 262 | user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, | ||
| 263 | MAX_USERNAME_SIZE*2, nls_info); | ||
| 264 | unicode_buf[user_name_len] = 0; | ||
| 265 | user_name_len++; | ||
| 266 | |||
| 267 | for (i = 0; i < dom_name_len; i++) | ||
| 268 | ucase_buf[i] = nls_info->charset2upper[(int)ses->domainName[i]]; | ||
| 269 | ucase_buf[i] = 0; | ||
| 270 | dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, | ||
| 271 | MAX_USERNAME_SIZE*2, nls_info); | ||
| 272 | |||
| 273 | unicode_buf[user_name_len + dom_name_len] = 0; | ||
| 274 | hmac_md5_update((const unsigned char *) unicode_buf, | ||
| 275 | (user_name_len+dom_name_len)*2, &ctx); | ||
| 276 | |||
| 277 | hmac_md5_final(ses->server->ntlmv2_hash, &ctx); | ||
| 278 | kfree(ucase_buf); | ||
| 279 | kfree(unicode_buf); | ||
| 280 | return 0; | ||
| 281 | } | ||
| 282 | |||
| 283 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 226 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
| 284 | void calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt, | 227 | void calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt, |
| 285 | char *lnm_session_key) | 228 | char *lnm_session_key) |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1f5450814087..f399b16cb7d5 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
| @@ -365,8 +365,6 @@ extern int cifs_verify_signature(struct smb_hdr *, | |||
| 365 | __u32 expected_sequence_number); | 365 | __u32 expected_sequence_number); |
| 366 | extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn, | 366 | extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn, |
| 367 | const char *pass); | 367 | const char *pass); |
| 368 | extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, | ||
| 369 | const struct nls_table *); | ||
| 370 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); | 368 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); |
| 371 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, | 369 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, |
| 372 | const struct nls_table *); | 370 | const struct nls_table *); |
