Skip to content

Commit 2c09630

Browse files
Eric Biggerssmfrench
authored andcommitted
smb: client: Remove obsolete crypto_shash allocations
Now that the SMB client accesses MD5, HMAC-MD5, HMAC-SHA256, and SHA-512 only via the library API and not via crypto_shash, allocating crypto_shash objects for these algorithms is no longer necessary. Remove all these allocations, their corresponding kconfig selections, and their corresponding module soft dependencies. Reviewed-by: Stefan Metzmacher <metze@samba.org> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 395a77b commit 2c09630

File tree

5 files changed

+2
-47
lines changed

5 files changed

+2
-47
lines changed

fs/smb/client/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ config CIFS
55
select NLS
66
select NLS_UCS2_UTILS
77
select CRYPTO
8-
select CRYPTO_MD5
9-
select CRYPTO_SHA256
10-
select CRYPTO_SHA512
118
select CRYPTO_CMAC
12-
select CRYPTO_HMAC
139
select CRYPTO_AEAD2
1410
select CRYPTO_CCM
1511
select CRYPTO_GCM

fs/smb/client/cifsencrypt.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,6 @@ void
693693
cifs_crypto_secmech_release(struct TCP_Server_Info *server)
694694
{
695695
cifs_free_hash(&server->secmech.aes_cmac);
696-
cifs_free_hash(&server->secmech.hmacsha256);
697-
cifs_free_hash(&server->secmech.md5);
698-
cifs_free_hash(&server->secmech.sha512);
699696

700697
if (server->secmech.enc) {
701698
crypto_free_aead(server->secmech.enc);

fs/smb/client/cifsfs.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,13 +2139,9 @@ MODULE_DESCRIPTION
21392139
"also older servers complying with the SNIA CIFS Specification)");
21402140
MODULE_VERSION(CIFS_VERSION);
21412141
MODULE_SOFTDEP("ecb");
2142-
MODULE_SOFTDEP("hmac");
2143-
MODULE_SOFTDEP("md5");
21442142
MODULE_SOFTDEP("nls");
21452143
MODULE_SOFTDEP("aes");
21462144
MODULE_SOFTDEP("cmac");
2147-
MODULE_SOFTDEP("sha256");
2148-
MODULE_SOFTDEP("sha512");
21492145
MODULE_SOFTDEP("aead2");
21502146
MODULE_SOFTDEP("ccm");
21512147
MODULE_SOFTDEP("gcm");

fs/smb/client/cifsglob.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ struct session_key {
222222

223223
/* crypto hashing related structure/fields, not specific to a sec mech */
224224
struct cifs_secmech {
225-
struct shash_desc *md5; /* md5 hash function, for CIFS/SMB1 signatures */
226-
struct shash_desc *hmacsha256; /* hmac-sha256 hash function, for SMB2 signatures */
227-
struct shash_desc *sha512; /* sha512 hash function, for SMB3.1.1 preauth hash */
228225
struct shash_desc *aes_cmac; /* block-cipher based MAC function, for SMB3 signatures */
229226

230227
struct crypto_aead *enc; /* smb3 encryption AEAD TFM (AES-CCM and AES-GCM) */

fs/smb/client/smb2transport.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,18 @@ static int
3131
smb3_crypto_shash_allocate(struct TCP_Server_Info *server)
3232
{
3333
struct cifs_secmech *p = &server->secmech;
34-
int rc;
35-
36-
rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
37-
if (rc)
38-
goto err;
39-
40-
rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
41-
if (rc)
42-
goto err;
4334

44-
return 0;
45-
err:
46-
cifs_free_hash(&p->hmacsha256);
47-
return rc;
35+
return cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
4836
}
4937

5038
int
5139
smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
5240
{
5341
struct cifs_secmech *p = &server->secmech;
54-
int rc = 0;
5542

56-
rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
57-
if (rc)
58-
return rc;
59-
60-
rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
61-
if (rc)
62-
goto err;
63-
64-
rc = cifs_alloc_hash("sha512", &p->sha512);
65-
if (rc)
66-
goto err;
67-
68-
return 0;
69-
70-
err:
71-
cifs_free_hash(&p->aes_cmac);
72-
cifs_free_hash(&p->hmacsha256);
73-
return rc;
43+
return cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
7444
}
7545

76-
7746
static
7847
int smb3_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key)
7948
{

0 commit comments

Comments
 (0)