Skip to content

Commit a83307f

Browse files
Eric Biggerssmfrench
authored andcommitted
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: Steve French <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent dd1c537 commit a83307f

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

fs/smb/client/smb2transport.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ smb2_find_smb_tcon(struct TCP_Server_Info *server, __u64 ses_id, __u32 tid)
204204
}
205205

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

442441
static int
443-
smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
444-
bool allocate_crypto)
442+
smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
445443
{
446444
int rc;
447445
unsigned char smb3_signature[SMB2_CMACAES_SIZE];
@@ -453,7 +451,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
453451
u8 key[SMB3_SIGN_KEY_SIZE];
454452

455453
if (server->vals->protocol_id <= SMB21_PROT_ID)
456-
return smb2_calc_signature(rqst, server, allocate_crypto);
454+
return smb2_calc_signature(rqst, server);
457455

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

527-
return smb3_calc_signature(rqst, server, false);
525+
return smb3_calc_signature(rqst, server);
528526
}
529527

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

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

563-
rc = smb3_calc_signature(rqst, server, true);
561+
rc = smb3_calc_signature(rqst, server);
564562

565563
if (rc)
566564
return rc;

0 commit comments

Comments
 (0)