Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp408388lqg; Fri, 1 Mar 2024 08:42:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1ZB1LVxbk21ZVCfCbJ9hqs+W9R+NRX1gfgc8mxkxWcnu4e12v8BB9mn9wATOxEefGMBu/u0/4N/LzZ4oBq30r1KYFZ8rjpzKAT4QIcw== X-Google-Smtp-Source: AGHT+IGTflGWEezFFl+H3C2LBAp3iO2mqsSsOPAyRi/sIwaJi9d+9F7g6mlsvZ9gKlyoU7fPYkah X-Received: by 2002:a9d:625a:0:b0:6e4:9628:460b with SMTP id i26-20020a9d625a000000b006e49628460bmr1952515otk.1.1709311338532; Fri, 01 Mar 2024 08:42:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709311338; cv=pass; d=google.com; s=arc-20160816; b=hezHZVA/kFaDPJ0RM8rvNJYrjxD3DUwbmIkWsZJRLjUJmdsOI9gTJDoO73p/FpxnIp 8KydtPwgk0L4IkuicF8s+3nWL57KlINiFcuyY/gWEx2hNjTlM7LxW21TSHQ4URfrA4BR d/MjLOzx9zHreDdqc5H9Kh+DhurC4dYTq9b0GOpMvcSLgpbj0BZ/B6FRDetb7DjU+Oht Ujsgdf9q5zW5eHAPE1N8eOhuS8zdhX1S9Oxv11rrIkRZ4+7sqCao6y9JkxSP0TJbDsB5 miW0lcuhoB3OHHVXoVzKUP0Ew5pxKHpi5awkPfjlZ5DQxy8tpiNlUkOXRAbeeL2J1hbm nguA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xts3XtVON9I71sFj7FzOone2ONVNFLRmYJBbj5l1ezs=; fh=icnuzcdbhXgwjK0pgvJXK7xplE+Och0jvyZv2PxZJ18=; b=fNCeV0m7n3h015ygNAaqsVdsJOa07JT/ZsNxITFbA3km1JKK+fcbJWUB8cnXlnSImE AxH2iwWWi0lJJ29VVC+EQIuIH0Q7VZHjvso/P/oUjFmzgKhHa+gBghmkKdk+dD6B4wkJ HdWZQFJwvdqJ+jY/5isp/VZJeQlXWokW32hX+Ow4hQMVhAv6jtvsQOWJZlJ5dADbakj+ 8eMasfL3/KWzkxjxJw2b2L/A9rm/H3GZba7sXoso37duqb/EwNPBGC4H9Fy6sKGfCuY3 t2iBkVsz3AsceV5lPr5p1JetTLYfTyLFGrLU48Rwe2iiLNa/AY8DtVRmajx3PcA+vrKl KJ2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DhjSW31y; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-88726-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88726-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k5-20020a6568c5000000b005dc49fa1174si3879826pgt.762.2024.03.01.08.42.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 08:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88726-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DhjSW31y; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-88726-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88726-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E454F283D2D for ; Fri, 1 Mar 2024 16:42:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 322F83B198; Fri, 1 Mar 2024 16:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DhjSW31y" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5C9039FDD for ; Fri, 1 Mar 2024 16:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709311121; cv=none; b=CJH/gDKVzhd7vbxQv5Z/FfMT1EVyobwyQ4/0LKUGmoLA5FoMLr6ZMDmZPga/Fd5YjFSkc2PnZyh1CGmXVGNT4shFQwlJfUYXSoaIg5s/NYyOtB7LnNTpocJiTHY7Cj2QWJPkCZEQOpbooHy+9isRl7vA2MDg7xstfUIGhaB3h4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709311121; c=relaxed/simple; bh=OQhrdRbsy6dNNd/zZSQhmGvtRjzZYE4Nim/ssYLKPhk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ja65TpSmbCRF8qnuphOp6sHEEktm2DIG0XCfBacAPYy1gX1Mr5X90XcOI201IxYZM3ftu5Gj5G3VNrPx2NrO2unwCKrBtoQlMQMbTytkQSzFc8wmQg7YMMFSJxqosrsmZtYuyCuUcQDw8jM13ZvqjeSpGWpDG395Us+pYpifhLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DhjSW31y; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709311118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xts3XtVON9I71sFj7FzOone2ONVNFLRmYJBbj5l1ezs=; b=DhjSW31yK14q5tOvKvNqMCmvzbAAUrTuqOy3DMGENGWsNq+rNfklwMGN5AH2YYDYVfRV1C xjr48XtKIQGMOGJcwk4PN1BrjExBNjPA9rretWv3nDr3d1YmV7sYiZBHrKfpX85YBFiezH 74tKOZ6te+P93rqKk9y5GTYVEh23J3E= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-532--gxOMAYONgKet0F_c8Pwcg-1; Fri, 01 Mar 2024 11:38:34 -0500 X-MC-Unique: -gxOMAYONgKet0F_c8Pwcg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76E0F185A78B; Fri, 1 Mar 2024 16:38:31 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5725F492BE2; Fri, 1 Mar 2024 16:38:30 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 11/21] rxrpc: Don't pick values out of the wire header when setting up security Date: Fri, 1 Mar 2024 16:37:43 +0000 Message-ID: <20240301163807.385573-12-dhowells@redhat.com> In-Reply-To: <20240301163807.385573-1-dhowells@redhat.com> References: <20240301163807.385573-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- net/rxrpc/rxkad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index e451ac90bfee..ef0849c8329c 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c @@ -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); @@ -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; @@ -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);