Commit 2c09630d authored by Eric Biggers's avatar Eric Biggers Committed by Steve French
Browse files

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: default avatarStefan Metzmacher <metze@samba.org>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarEric Biggers <ebiggers@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 395a77b0
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -5,11 +5,7 @@ config CIFS
	select NLS
	select NLS_UCS2_UTILS
	select CRYPTO
	select CRYPTO_MD5
	select CRYPTO_SHA256
	select CRYPTO_SHA512
	select CRYPTO_CMAC
	select CRYPTO_HMAC
	select CRYPTO_AEAD2
	select CRYPTO_CCM
	select CRYPTO_GCM
+0 −3
Original line number Diff line number Diff line
@@ -693,9 +693,6 @@ void
cifs_crypto_secmech_release(struct TCP_Server_Info *server)
{
	cifs_free_hash(&server->secmech.aes_cmac);
	cifs_free_hash(&server->secmech.hmacsha256);
	cifs_free_hash(&server->secmech.md5);
	cifs_free_hash(&server->secmech.sha512);

	if (server->secmech.enc) {
		crypto_free_aead(server->secmech.enc);
+0 −4
Original line number Diff line number Diff line
@@ -2139,13 +2139,9 @@ MODULE_DESCRIPTION
	"also older servers complying with the SNIA CIFS Specification)");
MODULE_VERSION(CIFS_VERSION);
MODULE_SOFTDEP("ecb");
MODULE_SOFTDEP("hmac");
MODULE_SOFTDEP("md5");
MODULE_SOFTDEP("nls");
MODULE_SOFTDEP("aes");
MODULE_SOFTDEP("cmac");
MODULE_SOFTDEP("sha256");
MODULE_SOFTDEP("sha512");
MODULE_SOFTDEP("aead2");
MODULE_SOFTDEP("ccm");
MODULE_SOFTDEP("gcm");
+0 −3
Original line number Diff line number Diff line
@@ -222,9 +222,6 @@ struct session_key {

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

	struct crypto_aead *enc; /* smb3 encryption AEAD TFM (AES-CCM and AES-GCM) */
+2 −33
Original line number Diff line number Diff line
@@ -31,49 +31,18 @@ static int
smb3_crypto_shash_allocate(struct TCP_Server_Info *server)
{
	struct cifs_secmech *p = &server->secmech;
	int rc;

	rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
	if (rc)
		goto err;

	rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
	if (rc)
		goto err;

	return 0;
err:
	cifs_free_hash(&p->hmacsha256);
	return rc;
	return cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
}

int
smb311_crypto_shash_allocate(struct TCP_Server_Info *server)
{
	struct cifs_secmech *p = &server->secmech;
	int rc = 0;

	rc = cifs_alloc_hash("hmac(sha256)", &p->hmacsha256);
	if (rc)
		return rc;

	rc = cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
	if (rc)
		goto err;

	rc = cifs_alloc_hash("sha512", &p->sha512);
	if (rc)
		goto err;

	return 0;

err:
	cifs_free_hash(&p->aes_cmac);
	cifs_free_hash(&p->hmacsha256);
	return rc;
	return cifs_alloc_hash("cmac(aes)", &p->aes_cmac);
}


static
int smb3_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key)
{