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

smb: client: Drop 'allocate_crypto' arg from smb*_calc_signature()



Since the crypto library API is now being used instead of crypto_shash,
all structs for MAC computation are now just fixed-size structs
allocated on the stack; no dynamic allocations are ever required.
Besides being much more efficient, this also means that the
'allocate_crypto' argument to smb2_calc_signature() and
smb3_calc_signature() is no longer used.  Remove this unused argument.

Acked-by: default avatarSteve French <stfrench@microsoft.com>
Reviewed-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 dd1c537b
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -204,8 +204,7 @@ smb2_find_smb_tcon(struct TCP_Server_Info *server, __u64 ses_id, __u32 tid)
}

static int
smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
		    bool allocate_crypto)
smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
{
	int rc;
	unsigned char smb2_signature[SMB2_HMACSHA256_SIZE];
@@ -440,8 +439,7 @@ generate_smb311signingkey(struct cifs_ses *ses,
}

static int
smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
		    bool allocate_crypto)
smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
{
	int rc;
	unsigned char smb3_signature[SMB2_CMACAES_SIZE];
@@ -453,7 +451,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
	u8 key[SMB3_SIGN_KEY_SIZE];

	if (server->vals->protocol_id <= SMB21_PROT_ID)
		return smb2_calc_signature(rqst, server, allocate_crypto);
		return smb2_calc_signature(rqst, server);

	rc = smb3_get_sign_key(le64_to_cpu(shdr->SessionId), server, key);
	if (unlikely(rc)) {
@@ -524,7 +522,7 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server)
		return 0;
	}

	return smb3_calc_signature(rqst, server, false);
	return smb3_calc_signature(rqst, server);
}

int
@@ -560,7 +558,7 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)

	memset(shdr->Signature, 0, SMB2_SIGNATURE_SIZE);

	rc = smb3_calc_signature(rqst, server, true);
	rc = smb3_calc_signature(rqst, server);

	if (rc)
		return rc;