aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2011-09-21 15:33:31 -0400
committerSteve French <smfrench@gmail.com>2011-10-13 00:42:21 -0400
commitd02616869221517582dea7972c9b5063ac9a2ae7 (patch)
tree63768325153cbb945b453492c6176d0da5beb5a0 /fs/cifs
parent3d3ea8e64efbeb3e4289675dbbfab82333395642 (diff)
cifs: clean up unused encryption code
Remove unsed #if 0 encryption code. Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smbencrypt.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 42b9fff48751..ac1221d969d6 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -265,91 +265,6 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
265 return rc; 265 return rc;
266} 266}
267 267
268#if 0 /* currently unused */
269/* Does both the NT and LM owfs of a user's password */
270static void
271nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
272{
273 char passwd[514];
274
275 memset(passwd, '\0', 514);
276 if (strlen(pwd) < 513)
277 strcpy(passwd, pwd);
278 else
279 memcpy(passwd, pwd, 512);
280 /* Calculate the MD4 hash (NT compatible) of the password */
281 memset(nt_p16, '\0', 16);
282 E_md4hash(passwd, nt_p16);
283
284 /* Mangle the passwords into Lanman format */
285 passwd[14] = '\0';
286/* strupper(passwd); */
287
288 /* Calculate the SMB (lanman) hash functions of the password */
289
290 memset(p16, '\0', 16);
291 E_P16((unsigned char *) passwd, (unsigned char *) p16);
292
293 /* clear out local copy of user's password (just being paranoid). */
294 memset(passwd, '\0', sizeof(passwd));
295}
296#endif
297
298/* Does the NTLMv2 owfs of a user's password */
299#if 0 /* function not needed yet - but will be soon */
300static void
301ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
302 const char *domain_n, unsigned char kr_buf[16],
303 const struct nls_table *nls_codepage)
304{
305 wchar_t *user_u;
306 wchar_t *dom_u;
307 int user_l, domain_l;
308 struct HMACMD5Context ctx;
309
310 /* might as well do one alloc to hold both (user_u and dom_u) */
311 user_u = kmalloc(2048 * sizeof(wchar_t), GFP_KERNEL);
312 if (user_u == NULL)
313 return;
314 dom_u = user_u + 1024;
315
316 /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2,
317 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER);
318 push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2,
319 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */
320
321 /* BB user and domain may need to be uppercased */
322 user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage);
323 domain_l = cifs_strtoUCS(dom_u, domain_n, 511, nls_codepage);
324
325 user_l++; /* trailing null */
326 domain_l++;
327
328 hmac_md5_init_limK_to_64(owf, 16, &ctx);
329 hmac_md5_update((const unsigned char *) user_u, user_l * 2, &ctx);
330 hmac_md5_update((const unsigned char *) dom_u, domain_l * 2, &ctx);
331 hmac_md5_final(kr_buf, &ctx);
332
333 kfree(user_u);
334}
335#endif
336
337/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
338#if 0 /* currently unused */
339static void
340NTLMSSPOWFencrypt(unsigned char passwd[8],
341 unsigned char *ntlmchalresp, unsigned char p24[24])
342{
343 unsigned char p21[21];
344
345 memset(p21, '\0', 21);
346 memcpy(p21, passwd, 8);
347 memset(p21 + 8, 0xbd, 8);
348
349 E_P24(p21, ntlmchalresp, p24);
350}
351#endif
352
353/* Does the NT MD4 hash then des encryption. */ 268/* Does the NT MD4 hash then des encryption. */
354int 269int
355SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) 270SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
@@ -369,39 +284,3 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
369 rc = E_P24(p21, c8, p24); 284 rc = E_P24(p21, c8, p24);
370 return rc; 285 return rc;
371} 286}
372
373
374/* Does the md5 encryption from the NT hash for NTLMv2. */
375/* These routines will be needed later */
376#if 0
377static void
378SMBOWFencrypt_ntv2(const unsigned char kr[16],
379 const struct data_blob *srv_chal,
380 const struct data_blob *cli_chal, unsigned char resp_buf[16])
381{
382 struct HMACMD5Context ctx;
383
384 hmac_md5_init_limK_to_64(kr, 16, &ctx);
385 hmac_md5_update(srv_chal->data, srv_chal->length, &ctx);
386 hmac_md5_update(cli_chal->data, cli_chal->length, &ctx);
387 hmac_md5_final(resp_buf, &ctx);
388}
389
390static void
391SMBsesskeygen_ntv2(const unsigned char kr[16],
392 const unsigned char *nt_resp, __u8 sess_key[16])
393{
394 struct HMACMD5Context ctx;
395
396 hmac_md5_init_limK_to_64(kr, 16, &ctx);
397 hmac_md5_update(nt_resp, 16, &ctx);
398 hmac_md5_final((unsigned char *) sess_key, &ctx);
399}
400
401static void
402SMBsesskeygen_ntv1(const unsigned char kr[16],
403 const unsigned char *nt_resp, __u8 sess_key[16])
404{
405 mdfour((unsigned char *) sess_key, (unsigned char *) kr, 16);
406}
407#endif