diff options
author | Stefan Metzmacher <metze@samba.org> | 2020-11-11 13:18:24 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-03-17 00:49:32 +0000 |
commit | 7c8707613e76777daa95494e5bca66380b9f59b1 (patch) | |
tree | f16bed9c1be0729a51efe25121a71cb269ee7b0f /libcli | |
parent | 5d4c63d83879eba86d3fe8d834553a0a7b35217f (diff) | |
download | samba-7c8707613e76777daa95494e5bca66380b9f59b1.tar.gz |
libcli/smb: no longer pass protocol to smb2_signing_{sign,check}_pdu()
The signing algorithm is already passed via
smb2_signing_key->sign_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.c | 14 | ||||
-rw-r--r-- | libcli/smb/smb2_signing.h | 2 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.c | 4 |
3 files changed, 2 insertions, 18 deletions
diff --git a/libcli/smb/smb2_signing.c b/libcli/smb/smb2_signing.c index 58a7fabd913..dd5784361d5 100644 --- a/libcli/smb/smb2_signing.c +++ b/libcli/smb/smb2_signing.c @@ -411,7 +411,6 @@ static NTSTATUS smb2_signing_calc_signature(struct smb2_signing_key *signing_key } NTSTATUS smb2_signing_sign_pdu(struct smb2_signing_key *signing_key, - enum protocol_types protocol, struct iovec *vector, int count) { @@ -452,11 +451,7 @@ NTSTATUS smb2_signing_sign_pdu(struct smb2_signing_key *signing_key, SIVAL(hdr, SMB2_HDR_FLAGS, IVAL(hdr, SMB2_HDR_FLAGS) | SMB2_HDR_FLAG_SIGNED); - if (protocol >= PROTOCOL_SMB2_24) { - sign_algo_id = SMB2_SIGNING_AES128_CMAC; - } else { - sign_algo_id = SMB2_SIGNING_HMAC_SHA256; - } + sign_algo_id = signing_key->sign_algo_id; status = smb2_signing_calc_signature(signing_key, sign_algo_id, @@ -478,7 +473,6 @@ NTSTATUS smb2_signing_sign_pdu(struct smb2_signing_key *signing_key, } NTSTATUS smb2_signing_check_pdu(struct smb2_signing_key *signing_key, - enum protocol_types protocol, const struct iovec *vector, int count) { @@ -518,11 +512,7 @@ NTSTATUS smb2_signing_check_pdu(struct smb2_signing_key *signing_key, sig = hdr+SMB2_HDR_SIGNATURE; - if (protocol >= PROTOCOL_SMB2_24) { - sign_algo_id = SMB2_SIGNING_AES128_CMAC; - } else { - sign_algo_id = SMB2_SIGNING_HMAC_SHA256; - } + sign_algo_id = signing_key->sign_algo_id; status = smb2_signing_calc_signature(signing_key, sign_algo_id, diff --git a/libcli/smb/smb2_signing.h b/libcli/smb/smb2_signing.h index af090fd937f..94d63c23042 100644 --- a/libcli/smb/smb2_signing.h +++ b/libcli/smb/smb2_signing.h @@ -78,12 +78,10 @@ NTSTATUS smb2_signing_key_cipher_create(TALLOC_CTX *mem_ctx, bool smb2_signing_key_valid(const struct smb2_signing_key *key); NTSTATUS smb2_signing_sign_pdu(struct smb2_signing_key *signing_key, - enum protocol_types protocol, struct iovec *vector, int count); NTSTATUS smb2_signing_check_pdu(struct smb2_signing_key *signing_key, - enum protocol_types protocol, const struct iovec *vector, int count); diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 78ee511cd38..d188cc8a1b6 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -3342,7 +3342,6 @@ skip_credits: NTSTATUS status; status = smb2_signing_sign_pdu(signing_key, - state->session->conn->protocol, &iov[hdr_iov], num_iov - hdr_iov); if (!NT_STATUS_IS_OK(status)) { return status; @@ -3936,7 +3935,6 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn, NTSTATUS signing_status; signing_status = smb2_signing_check_pdu(signing_key, - state->conn->protocol, &cur[1], 3); if (!NT_STATUS_IS_OK(signing_status)) { /* @@ -6161,7 +6159,6 @@ NTSTATUS smb2cli_session_set_session_key(struct smbXcli_session *session, if (check_signature) { status = smb2_signing_check_pdu(session->smb2_channel.signing_key, - session->conn->protocol, recv_iov, 3); if (!NT_STATUS_IS_OK(status)) { return status; @@ -6339,7 +6336,6 @@ NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session, ZERO_STRUCT(channel_key); status = smb2_signing_check_pdu(session->smb2_channel.signing_key, - session->conn->protocol, recv_iov, 3); if (!NT_STATUS_IS_OK(status)) { return status; |