Skip to content

Commit

Permalink
rxrpc: Don't pick values out of the wire header when setting up security
Browse files Browse the repository at this point in the history
Don't pick values out of the wire header in rxkad when setting up DATA
packet security, but rather use other sources.  This makes it easier to get
rid of txb->wire.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
  • Loading branch information
dhowells committed Feb 29, 2024
1 parent 44125d5 commit a1c9af4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/rxrpc/rxkad.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int rxkad_secure_packet_auth(const struct rxrpc_call *call,

_enter("");

check = txb->seq ^ ntohl(txb->wire.callNumber);
check = txb->seq ^ call->call_id;
hdr->data_size = htonl((u32)check << 16 | txb->len);

txb->len += sizeof(struct rxkad_level1_hdr);
Expand Down Expand Up @@ -302,7 +302,7 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call,

_enter("");

check = txb->seq ^ ntohl(txb->wire.callNumber);
check = txb->seq ^ call->call_id;

rxkhdr->data_size = htonl(txb->len | (u32)check << 16);
rxkhdr->checksum = 0;
Expand Down Expand Up @@ -362,9 +362,9 @@ static int rxkad_secure_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
memcpy(&iv, call->conn->rxkad.csum_iv.x, sizeof(iv));

/* calculate the security checksum */
x = (ntohl(txb->wire.cid) & RXRPC_CHANNELMASK) << (32 - RXRPC_CIDSHIFT);
x = (call->cid & RXRPC_CHANNELMASK) << (32 - RXRPC_CIDSHIFT);
x |= txb->seq & 0x3fffffff;
crypto.buf[0] = txb->wire.callNumber;
crypto.buf[0] = htonl(call->call_id);
crypto.buf[1] = htonl(x);

sg_init_one(&sg, crypto.buf, 8);
Expand Down

0 comments on commit a1c9af4

Please sign in to comment.