mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 17:12:50 -04:00
smb: client: Make generate_key() return void
Since the crypto library API is now being used instead of crypto_shash, generate_key() can no longer fail. Make it return void and simplify the callers accordingly. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
committed by
Steve French
parent
4c1c07820a
commit
dd1c537bec
@@ -251,8 +251,8 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int generate_key(struct cifs_ses *ses, struct kvec label,
|
||||
struct kvec context, __u8 *key, unsigned int key_size)
|
||||
static void generate_key(struct cifs_ses *ses, struct kvec label,
|
||||
struct kvec context, __u8 *key, unsigned int key_size)
|
||||
{
|
||||
unsigned char zero = 0x0;
|
||||
__u8 i[4] = {0, 0, 0, 1};
|
||||
@@ -281,7 +281,6 @@ static int generate_key(struct cifs_ses *ses, struct kvec label,
|
||||
hmac_sha256_final(&hmac_ctx, prfhash);
|
||||
|
||||
memcpy(key, prfhash, key_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct derivation {
|
||||
@@ -300,7 +299,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
|
||||
struct TCP_Server_Info *server,
|
||||
const struct derivation_triplet *ptriplet)
|
||||
{
|
||||
int rc;
|
||||
bool is_binding = false;
|
||||
int chan_index = 0;
|
||||
|
||||
@@ -331,19 +329,14 @@ generate_smb3signingkey(struct cifs_ses *ses,
|
||||
*/
|
||||
|
||||
if (is_binding) {
|
||||
rc = generate_key(ses, ptriplet->signing.label,
|
||||
ptriplet->signing.context,
|
||||
ses->chans[chan_index].signkey,
|
||||
SMB3_SIGN_KEY_SIZE);
|
||||
if (rc)
|
||||
return rc;
|
||||
generate_key(ses, ptriplet->signing.label,
|
||||
ptriplet->signing.context,
|
||||
ses->chans[chan_index].signkey,
|
||||
SMB3_SIGN_KEY_SIZE);
|
||||
} else {
|
||||
rc = generate_key(ses, ptriplet->signing.label,
|
||||
ptriplet->signing.context,
|
||||
ses->smb3signingkey,
|
||||
SMB3_SIGN_KEY_SIZE);
|
||||
if (rc)
|
||||
return rc;
|
||||
generate_key(ses, ptriplet->signing.label,
|
||||
ptriplet->signing.context,
|
||||
ses->smb3signingkey, SMB3_SIGN_KEY_SIZE);
|
||||
|
||||
/* safe to access primary channel, since it will never go away */
|
||||
spin_lock(&ses->chan_lock);
|
||||
@@ -351,18 +344,12 @@ generate_smb3signingkey(struct cifs_ses *ses,
|
||||
SMB3_SIGN_KEY_SIZE);
|
||||
spin_unlock(&ses->chan_lock);
|
||||
|
||||
rc = generate_key(ses, ptriplet->encryption.label,
|
||||
ptriplet->encryption.context,
|
||||
ses->smb3encryptionkey,
|
||||
SMB3_ENC_DEC_KEY_SIZE);
|
||||
if (rc)
|
||||
return rc;
|
||||
rc = generate_key(ses, ptriplet->decryption.label,
|
||||
ptriplet->decryption.context,
|
||||
ses->smb3decryptionkey,
|
||||
SMB3_ENC_DEC_KEY_SIZE);
|
||||
if (rc)
|
||||
return rc;
|
||||
generate_key(ses, ptriplet->encryption.label,
|
||||
ptriplet->encryption.context,
|
||||
ses->smb3encryptionkey, SMB3_ENC_DEC_KEY_SIZE);
|
||||
generate_key(ses, ptriplet->decryption.label,
|
||||
ptriplet->decryption.context,
|
||||
ses->smb3decryptionkey, SMB3_ENC_DEC_KEY_SIZE);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
|
||||
@@ -391,7 +378,7 @@ generate_smb3signingkey(struct cifs_ses *ses,
|
||||
SMB3_GCM128_CRYPTKEY_SIZE, ses->smb3decryptionkey);
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user