summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-03-10 14:03:50 +0100
committerJeremy Allison <jra@samba.org>2021-03-17 00:49:32 +0000
commitf65e609fd165b2639d5ae25d59c2e0fb7496c7df (patch)
tree95df8376903d58f0731454df41832157319dde97 /libcli
parent7c8707613e76777daa95494e5bca66380b9f59b1 (diff)
downloadsamba-f65e609fd165b2639d5ae25d59c2e0fb7496c7df.tar.gz
libcli/smb: no longer pass protocol to smb2_signing_{encrypt,decrypt}_pdu()
The cipher algorithm is already passed via smb2_signing_key->chipher_algo_id. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14512 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smb2_signing.c6
-rw-r--r--libcli/smb/smb2_signing.h2
-rw-r--r--libcli/smb/smbXcli_base.c2
3 files changed, 4 insertions, 6 deletions
diff --git a/libcli/smb/smb2_signing.c b/libcli/smb/smb2_signing.c
index dd5784361d5..a4effb8b31e 100644
--- a/libcli/smb/smb2_signing.c
+++ b/libcli/smb/smb2_signing.c
@@ -620,10 +620,10 @@ NTSTATUS smb2_key_derivation(const uint8_t *KI, size_t KI_len,
}
NTSTATUS smb2_signing_encrypt_pdu(struct smb2_signing_key *encryption_key,
- uint16_t cipher_id,
struct iovec *vector,
int count)
{
+ uint16_t cipher_id;
uint8_t *tf;
size_t a_total;
ssize_t m_total;
@@ -651,6 +651,7 @@ NTSTATUS smb2_signing_encrypt_pdu(struct smb2_signing_key *encryption_key,
DBG_WARNING("No encryption key for SMB2 signing\n");
return NT_STATUS_ACCESS_DENIED;
}
+ cipher_id = encryption_key->cipher_algo_id;
a_total = SMB2_TF_HDR_SIZE - SMB2_TF_NONCE;
@@ -826,10 +827,10 @@ out:
}
NTSTATUS smb2_signing_decrypt_pdu(struct smb2_signing_key *decryption_key,
- uint16_t cipher_id,
struct iovec *vector,
int count)
{
+ uint16_t cipher_id;
uint8_t *tf;
uint16_t flags;
size_t a_total;
@@ -859,6 +860,7 @@ NTSTATUS smb2_signing_decrypt_pdu(struct smb2_signing_key *decryption_key,
DBG_WARNING("No decryption key for SMB2 signing\n");
return NT_STATUS_ACCESS_DENIED;
}
+ cipher_id = decryption_key->cipher_algo_id;
a_total = SMB2_TF_HDR_SIZE - SMB2_TF_NONCE;
diff --git a/libcli/smb/smb2_signing.h b/libcli/smb/smb2_signing.h
index 94d63c23042..cf6fbe50db8 100644
--- a/libcli/smb/smb2_signing.h
+++ b/libcli/smb/smb2_signing.h
@@ -91,11 +91,9 @@ NTSTATUS smb2_key_derivation(const uint8_t *KI, size_t KI_len,
uint8_t *KO, size_t KO_len);
NTSTATUS smb2_signing_encrypt_pdu(struct smb2_signing_key *encryption_key,
- uint16_t cipher_id,
struct iovec *vector,
int count);
NTSTATUS smb2_signing_decrypt_pdu(struct smb2_signing_key *decryption_key,
- uint16_t cipher_id,
struct iovec *vector,
int count);
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index d188cc8a1b6..01a8e921156 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3390,7 +3390,6 @@ skip_credits:
}
status = smb2_signing_encrypt_pdu(encryption_key,
- state->conn->smb2.server.cipher,
&iov[tf_iov], num_iov - tf_iov);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -3578,7 +3577,6 @@ static NTSTATUS smb2cli_inbuf_parse_compound(struct smbXcli_conn *conn,
tf_iov[1].iov_len = enc_len;
status = smb2_signing_decrypt_pdu(s->smb2->decryption_key,
- conn->smb2.server.cipher,
tf_iov, 2);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(iov);