diff options
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r-- | fs/cifs/cifsencrypt.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 63c460e503b6..db768cb67e38 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -47,20 +47,20 @@ static int cifs_calc_signature(const struct kvec *iov, int n_vec, | |||
47 | return -EINVAL; | 47 | return -EINVAL; |
48 | 48 | ||
49 | if (!server->secmech.sdescmd5) { | 49 | if (!server->secmech.sdescmd5) { |
50 | cERROR(1, "%s: Can't generate signature\n", __func__); | 50 | cERROR(1, "%s: Can't generate signature", __func__); |
51 | return -1; | 51 | return -1; |
52 | } | 52 | } |
53 | 53 | ||
54 | rc = crypto_shash_init(&server->secmech.sdescmd5->shash); | 54 | rc = crypto_shash_init(&server->secmech.sdescmd5->shash); |
55 | if (rc) { | 55 | if (rc) { |
56 | cERROR(1, "%s: Could not init md5\n", __func__); | 56 | cERROR(1, "%s: Could not init md5", __func__); |
57 | return rc; | 57 | return rc; |
58 | } | 58 | } |
59 | 59 | ||
60 | rc = crypto_shash_update(&server->secmech.sdescmd5->shash, | 60 | rc = crypto_shash_update(&server->secmech.sdescmd5->shash, |
61 | server->session_key.response, server->session_key.len); | 61 | server->session_key.response, server->session_key.len); |
62 | if (rc) { | 62 | if (rc) { |
63 | cERROR(1, "%s: Could not update with response\n", __func__); | 63 | cERROR(1, "%s: Could not update with response", __func__); |
64 | return rc; | 64 | return rc; |
65 | } | 65 | } |
66 | 66 | ||
@@ -85,7 +85,7 @@ static int cifs_calc_signature(const struct kvec *iov, int n_vec, | |||
85 | iov[i].iov_base, iov[i].iov_len); | 85 | iov[i].iov_base, iov[i].iov_len); |
86 | } | 86 | } |
87 | if (rc) { | 87 | if (rc) { |
88 | cERROR(1, "%s: Could not update with payload\n", | 88 | cERROR(1, "%s: Could not update with payload", |
89 | __func__); | 89 | __func__); |
90 | return rc; | 90 | return rc; |
91 | } | 91 | } |
@@ -93,7 +93,7 @@ static int cifs_calc_signature(const struct kvec *iov, int n_vec, | |||
93 | 93 | ||
94 | rc = crypto_shash_final(&server->secmech.sdescmd5->shash, signature); | 94 | rc = crypto_shash_final(&server->secmech.sdescmd5->shash, signature); |
95 | if (rc) | 95 | if (rc) |
96 | cERROR(1, "%s: Could not generate md5 hash\n", __func__); | 96 | cERROR(1, "%s: Could not generate md5 hash", __func__); |
97 | 97 | ||
98 | return rc; | 98 | return rc; |
99 | } | 99 | } |
@@ -399,7 +399,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
399 | wchar_t *server; | 399 | wchar_t *server; |
400 | 400 | ||
401 | if (!ses->server->secmech.sdeschmacmd5) { | 401 | if (!ses->server->secmech.sdeschmacmd5) { |
402 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash\n"); | 402 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash"); |
403 | return -1; | 403 | return -1; |
404 | } | 404 | } |
405 | 405 | ||
@@ -415,7 +415,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
415 | 415 | ||
416 | rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); | 416 | rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); |
417 | if (rc) { | 417 | if (rc) { |
418 | cERROR(1, "calc_ntlmv2_hash: could not init hmacmd5\n"); | 418 | cERROR(1, "calc_ntlmv2_hash: could not init hmacmd5"); |
419 | return rc; | 419 | return rc; |
420 | } | 420 | } |
421 | 421 | ||
@@ -423,7 +423,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
423 | len = ses->user_name ? strlen(ses->user_name) : 0; | 423 | len = ses->user_name ? strlen(ses->user_name) : 0; |
424 | user = kmalloc(2 + (len * 2), GFP_KERNEL); | 424 | user = kmalloc(2 + (len * 2), GFP_KERNEL); |
425 | if (user == NULL) { | 425 | if (user == NULL) { |
426 | cERROR(1, "calc_ntlmv2_hash: user mem alloc failure\n"); | 426 | cERROR(1, "calc_ntlmv2_hash: user mem alloc failure"); |
427 | rc = -ENOMEM; | 427 | rc = -ENOMEM; |
428 | return rc; | 428 | return rc; |
429 | } | 429 | } |
@@ -439,7 +439,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
439 | (char *)user, 2 * len); | 439 | (char *)user, 2 * len); |
440 | kfree(user); | 440 | kfree(user); |
441 | if (rc) { | 441 | if (rc) { |
442 | cERROR(1, "%s: Could not update with user\n", __func__); | 442 | cERROR(1, "%s: Could not update with user", __func__); |
443 | return rc; | 443 | return rc; |
444 | } | 444 | } |
445 | 445 | ||
@@ -460,7 +460,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
460 | (char *)domain, 2 * len); | 460 | (char *)domain, 2 * len); |
461 | kfree(domain); | 461 | kfree(domain); |
462 | if (rc) { | 462 | if (rc) { |
463 | cERROR(1, "%s: Could not update with domain\n", | 463 | cERROR(1, "%s: Could not update with domain", |
464 | __func__); | 464 | __func__); |
465 | return rc; | 465 | return rc; |
466 | } | 466 | } |
@@ -480,7 +480,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
480 | (char *)server, 2 * len); | 480 | (char *)server, 2 * len); |
481 | kfree(server); | 481 | kfree(server); |
482 | if (rc) { | 482 | if (rc) { |
483 | cERROR(1, "%s: Could not update with server\n", | 483 | cERROR(1, "%s: Could not update with server", |
484 | __func__); | 484 | __func__); |
485 | return rc; | 485 | return rc; |
486 | } | 486 | } |
@@ -489,7 +489,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, | |||
489 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, | 489 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, |
490 | ntlmv2_hash); | 490 | ntlmv2_hash); |
491 | if (rc) | 491 | if (rc) |
492 | cERROR(1, "%s: Could not generate md5 hash\n", __func__); | 492 | cERROR(1, "%s: Could not generate md5 hash", __func__); |
493 | 493 | ||
494 | return rc; | 494 | return rc; |
495 | } | 495 | } |
@@ -501,7 +501,7 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) | |||
501 | unsigned int offset = CIFS_SESS_KEY_SIZE + 8; | 501 | unsigned int offset = CIFS_SESS_KEY_SIZE + 8; |
502 | 502 | ||
503 | if (!ses->server->secmech.sdeschmacmd5) { | 503 | if (!ses->server->secmech.sdeschmacmd5) { |
504 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash\n"); | 504 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash"); |
505 | return -1; | 505 | return -1; |
506 | } | 506 | } |
507 | 507 | ||
@@ -527,14 +527,14 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) | |||
527 | rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, | 527 | rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, |
528 | ses->auth_key.response + offset, ses->auth_key.len - offset); | 528 | ses->auth_key.response + offset, ses->auth_key.len - offset); |
529 | if (rc) { | 529 | if (rc) { |
530 | cERROR(1, "%s: Could not update with response\n", __func__); | 530 | cERROR(1, "%s: Could not update with response", __func__); |
531 | return rc; | 531 | return rc; |
532 | } | 532 | } |
533 | 533 | ||
534 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, | 534 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, |
535 | ses->auth_key.response + CIFS_SESS_KEY_SIZE); | 535 | ses->auth_key.response + CIFS_SESS_KEY_SIZE); |
536 | if (rc) | 536 | if (rc) |
537 | cERROR(1, "%s: Could not generate md5 hash\n", __func__); | 537 | cERROR(1, "%s: Could not generate md5 hash", __func__); |
538 | 538 | ||
539 | return rc; | 539 | return rc; |
540 | } | 540 | } |
@@ -613,7 +613,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) | |||
613 | 613 | ||
614 | rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); | 614 | rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); |
615 | if (rc) { | 615 | if (rc) { |
616 | cERROR(1, "%s: Could not init hmacmd5\n", __func__); | 616 | cERROR(1, "%s: Could not init hmacmd5", __func__); |
617 | goto setup_ntlmv2_rsp_ret; | 617 | goto setup_ntlmv2_rsp_ret; |
618 | } | 618 | } |
619 | 619 | ||
@@ -621,14 +621,14 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) | |||
621 | ses->auth_key.response + CIFS_SESS_KEY_SIZE, | 621 | ses->auth_key.response + CIFS_SESS_KEY_SIZE, |
622 | CIFS_HMAC_MD5_HASH_SIZE); | 622 | CIFS_HMAC_MD5_HASH_SIZE); |
623 | if (rc) { | 623 | if (rc) { |
624 | cERROR(1, "%s: Could not update with response\n", __func__); | 624 | cERROR(1, "%s: Could not update with response", __func__); |
625 | goto setup_ntlmv2_rsp_ret; | 625 | goto setup_ntlmv2_rsp_ret; |
626 | } | 626 | } |
627 | 627 | ||
628 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, | 628 | rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, |
629 | ses->auth_key.response); | 629 | ses->auth_key.response); |
630 | if (rc) | 630 | if (rc) |
631 | cERROR(1, "%s: Could not generate md5 hash\n", __func__); | 631 | cERROR(1, "%s: Could not generate md5 hash", __func__); |
632 | 632 | ||
633 | setup_ntlmv2_rsp_ret: | 633 | setup_ntlmv2_rsp_ret: |
634 | kfree(tiblob); | 634 | kfree(tiblob); |
@@ -650,7 +650,7 @@ calc_seckey(struct cifs_ses *ses) | |||
650 | tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 650 | tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
651 | if (IS_ERR(tfm_arc4)) { | 651 | if (IS_ERR(tfm_arc4)) { |
652 | rc = PTR_ERR(tfm_arc4); | 652 | rc = PTR_ERR(tfm_arc4); |
653 | cERROR(1, "could not allocate crypto API arc4\n"); | 653 | cERROR(1, "could not allocate crypto API arc4"); |
654 | return rc; | 654 | return rc; |
655 | } | 655 | } |
656 | 656 | ||
@@ -668,7 +668,7 @@ calc_seckey(struct cifs_ses *ses) | |||
668 | 668 | ||
669 | rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, CIFS_CPHTXT_SIZE); | 669 | rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, CIFS_CPHTXT_SIZE); |
670 | if (rc) { | 670 | if (rc) { |
671 | cERROR(1, "could not encrypt session key rc: %d\n", rc); | 671 | cERROR(1, "could not encrypt session key rc: %d", rc); |
672 | crypto_free_blkcipher(tfm_arc4); | 672 | crypto_free_blkcipher(tfm_arc4); |
673 | return rc; | 673 | return rc; |
674 | } | 674 | } |
@@ -705,13 +705,13 @@ cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | |||
705 | 705 | ||
706 | server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0); | 706 | server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0); |
707 | if (IS_ERR(server->secmech.hmacmd5)) { | 707 | if (IS_ERR(server->secmech.hmacmd5)) { |
708 | cERROR(1, "could not allocate crypto hmacmd5\n"); | 708 | cERROR(1, "could not allocate crypto hmacmd5"); |
709 | return PTR_ERR(server->secmech.hmacmd5); | 709 | return PTR_ERR(server->secmech.hmacmd5); |
710 | } | 710 | } |
711 | 711 | ||
712 | server->secmech.md5 = crypto_alloc_shash("md5", 0, 0); | 712 | server->secmech.md5 = crypto_alloc_shash("md5", 0, 0); |
713 | if (IS_ERR(server->secmech.md5)) { | 713 | if (IS_ERR(server->secmech.md5)) { |
714 | cERROR(1, "could not allocate crypto md5\n"); | 714 | cERROR(1, "could not allocate crypto md5"); |
715 | rc = PTR_ERR(server->secmech.md5); | 715 | rc = PTR_ERR(server->secmech.md5); |
716 | goto crypto_allocate_md5_fail; | 716 | goto crypto_allocate_md5_fail; |
717 | } | 717 | } |
@@ -720,7 +720,7 @@ cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | |||
720 | crypto_shash_descsize(server->secmech.hmacmd5); | 720 | crypto_shash_descsize(server->secmech.hmacmd5); |
721 | server->secmech.sdeschmacmd5 = kmalloc(size, GFP_KERNEL); | 721 | server->secmech.sdeschmacmd5 = kmalloc(size, GFP_KERNEL); |
722 | if (!server->secmech.sdeschmacmd5) { | 722 | if (!server->secmech.sdeschmacmd5) { |
723 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc hmacmd5\n"); | 723 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc hmacmd5"); |
724 | rc = -ENOMEM; | 724 | rc = -ENOMEM; |
725 | goto crypto_allocate_hmacmd5_sdesc_fail; | 725 | goto crypto_allocate_hmacmd5_sdesc_fail; |
726 | } | 726 | } |
@@ -732,7 +732,7 @@ cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | |||
732 | crypto_shash_descsize(server->secmech.md5); | 732 | crypto_shash_descsize(server->secmech.md5); |
733 | server->secmech.sdescmd5 = kmalloc(size, GFP_KERNEL); | 733 | server->secmech.sdescmd5 = kmalloc(size, GFP_KERNEL); |
734 | if (!server->secmech.sdescmd5) { | 734 | if (!server->secmech.sdescmd5) { |
735 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc md5\n"); | 735 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc md5"); |
736 | rc = -ENOMEM; | 736 | rc = -ENOMEM; |
737 | goto crypto_allocate_md5_sdesc_fail; | 737 | goto crypto_allocate_md5_sdesc_fail; |
738 | } | 738 | } |