diff options
author | Steve French <smfrench@gmail.com> | 2013-06-27 00:45:05 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-06-27 00:45:05 -0400 |
commit | 429b46f4fdaf9c9007b7c0fc371b94e40c3764b2 (patch) | |
tree | 7643a60439f4e81159e6327539a0983270e38331 /fs/cifs/cifsencrypt.c | |
parent | f87ab88b4065a9ef00620224c4fafadc201a430c (diff) |
[CIFS] SMB3 Signing enablement
SMB3 uses a much faster method of signing (which is also better in other ways),
AES-CMAC. With the kernel now supporting AES-CMAC since last release, we
are overdue to allow SMB3 signing (today only CIFS and SMB2 and SMB2.1,
but not SMB3 and SMB3.1 can sign) - and we need this also for checking
secure negotation and also per-share encryption (two other new SMB3 features
which we need to implement).
This patch needs some work in a few areas - for example we need to
move signing for SMB2/SMB3 from per-socket to per-user (we may be able to
use the "nosharesock" mount option in the interim for the multiuser case),
and Shirish found a bug in the earlier authentication overhaul
(setting signing flags properly) - but those can be done in followon
patches.
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r-- | fs/cifs/cifsencrypt.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 330875948f18..3d8bf941d126 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -705,6 +705,9 @@ calc_seckey(struct cifs_ses *ses) | |||
705 | void | 705 | void |
706 | cifs_crypto_shash_release(struct TCP_Server_Info *server) | 706 | cifs_crypto_shash_release(struct TCP_Server_Info *server) |
707 | { | 707 | { |
708 | if (server->secmech.cmacaes) | ||
709 | crypto_free_shash(server->secmech.cmacaes); | ||
710 | |||
708 | if (server->secmech.hmacsha256) | 711 | if (server->secmech.hmacsha256) |
709 | crypto_free_shash(server->secmech.hmacsha256); | 712 | crypto_free_shash(server->secmech.hmacsha256); |
710 | 713 | ||
@@ -714,6 +717,8 @@ cifs_crypto_shash_release(struct TCP_Server_Info *server) | |||
714 | if (server->secmech.hmacmd5) | 717 | if (server->secmech.hmacmd5) |
715 | crypto_free_shash(server->secmech.hmacmd5); | 718 | crypto_free_shash(server->secmech.hmacmd5); |
716 | 719 | ||
720 | kfree(server->secmech.sdesccmacaes); | ||
721 | |||
717 | kfree(server->secmech.sdeschmacsha256); | 722 | kfree(server->secmech.sdeschmacsha256); |
718 | 723 | ||
719 | kfree(server->secmech.sdeschmacmd5); | 724 | kfree(server->secmech.sdeschmacmd5); |
@@ -747,6 +752,13 @@ cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | |||
747 | goto crypto_allocate_hmacsha256_fail; | 752 | goto crypto_allocate_hmacsha256_fail; |
748 | } | 753 | } |
749 | 754 | ||
755 | server->secmech.cmacaes = crypto_alloc_shash("cmac(aes)", 0, 0); | ||
756 | if (IS_ERR(server->secmech.cmacaes)) { | ||
757 | cifs_dbg(VFS, "could not allocate crypto cmac-aes"); | ||
758 | rc = PTR_ERR(server->secmech.cmacaes); | ||
759 | goto crypto_allocate_cmacaes_fail; | ||
760 | } | ||
761 | |||
750 | size = sizeof(struct shash_desc) + | 762 | size = sizeof(struct shash_desc) + |
751 | crypto_shash_descsize(server->secmech.hmacmd5); | 763 | crypto_shash_descsize(server->secmech.hmacmd5); |
752 | server->secmech.sdeschmacmd5 = kmalloc(size, GFP_KERNEL); | 764 | server->secmech.sdeschmacmd5 = kmalloc(size, GFP_KERNEL); |
@@ -777,8 +789,22 @@ cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | |||
777 | server->secmech.sdeschmacsha256->shash.tfm = server->secmech.hmacsha256; | 789 | server->secmech.sdeschmacsha256->shash.tfm = server->secmech.hmacsha256; |
778 | server->secmech.sdeschmacsha256->shash.flags = 0x0; | 790 | server->secmech.sdeschmacsha256->shash.flags = 0x0; |
779 | 791 | ||
792 | size = sizeof(struct shash_desc) + | ||
793 | crypto_shash_descsize(server->secmech.cmacaes); | ||
794 | server->secmech.sdesccmacaes = kmalloc(size, GFP_KERNEL); | ||
795 | if (!server->secmech.sdesccmacaes) { | ||
796 | cifs_dbg(VFS, "%s: Can't alloc cmacaes\n", __func__); | ||
797 | rc = -ENOMEM; | ||
798 | goto crypto_allocate_cmacaes_sdesc_fail; | ||
799 | } | ||
800 | server->secmech.sdesccmacaes->shash.tfm = server->secmech.cmacaes; | ||
801 | server->secmech.sdesccmacaes->shash.flags = 0x0; | ||
802 | |||
780 | return 0; | 803 | return 0; |
781 | 804 | ||
805 | crypto_allocate_cmacaes_sdesc_fail: | ||
806 | kfree(server->secmech.sdeschmacsha256); | ||
807 | |||
782 | crypto_allocate_hmacsha256_sdesc_fail: | 808 | crypto_allocate_hmacsha256_sdesc_fail: |
783 | kfree(server->secmech.sdescmd5); | 809 | kfree(server->secmech.sdescmd5); |
784 | 810 | ||
@@ -786,6 +812,9 @@ crypto_allocate_md5_sdesc_fail: | |||
786 | kfree(server->secmech.sdeschmacmd5); | 812 | kfree(server->secmech.sdeschmacmd5); |
787 | 813 | ||
788 | crypto_allocate_hmacmd5_sdesc_fail: | 814 | crypto_allocate_hmacmd5_sdesc_fail: |
815 | crypto_free_shash(server->secmech.cmacaes); | ||
816 | |||
817 | crypto_allocate_cmacaes_fail: | ||
789 | crypto_free_shash(server->secmech.hmacsha256); | 818 | crypto_free_shash(server->secmech.hmacsha256); |
790 | 819 | ||
791 | crypto_allocate_hmacsha256_fail: | 820 | crypto_allocate_hmacsha256_fail: |