From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BBB253321B1 for ; Wed, 13 May 2026 17:15:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778692557; cv=none; b=nca3YG8P7ukDmdCeHvP3lEIo6uL0J0VoDsWgukqs2pB9aAJT4xfBbU/1+n0mdXsZXaYZILuUhCT8g6NavakbGz5aZM8wzdF9eHGr6do2xeJvW1ktooXC3vs8b3tD/UO3Bjp5nzb/2h66skXLAbIpNEy8FAOx25tnIySc9iZByaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778692557; c=relaxed/simple; bh=0QRA03M0v7+sZX1ZIQokZ7F+44koDpXQ889oz9uA26Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uK1KgfnGeYX7AVbCxSSjodY1V3kWpGMQDV1ICQTxVTqW29lPoF9jViqMG7fR+3LU+PPdbBKoWkDvPtapMQ+fRbzgDGkDerWFA0Ps1UKBw+AJLqmNqKEK73WedI+rKA8KtbmvW28Ng7/FSBKZvk9Mn6gm1O17xfd+2HWk1WIgscM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nP9c2XT/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nP9c2XT/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF106C19425; Wed, 13 May 2026 17:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778692557; bh=0QRA03M0v7+sZX1ZIQokZ7F+44koDpXQ889oz9uA26Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nP9c2XT/ovO5bl6/j2az9vdZiSDT4okdWJH1iTZOfBQ3zokL/OLh8vGuUfUVoZSck TR/v7kw21RCDr6YQoYTJQ/072NcpKBL0q7xT/RMh/9vYpWP7adoA08leY8fUcG+kLD nr093L3sduz73GRLKi7pTgloZSkEe/wInGfVAcIDSvM0u/G62fn66gs1pr38wPAY8G 8Gigb+L0raIDjP+PlY2g35wIGtP9zZvPw9r/11dgDevYb7kqfJ23+rexw/2mh5hjaJ 9U2ys5m3upABB9K1LsLTzh8epXSk+BbjHRVYeSCzej2mGmWDarzeLYK9ismQqkZsNK Ay9FHSA1fcttw== From: Sasha Levin To: stable@vger.kernel.org Cc: Eric Biggers , Herbert Xu , Sasha Levin Subject: [PATCH 5.10.y 1/3] net: ipv4: stop checking crypto_ahash_alignmask Date: Wed, 13 May 2026 13:15:52 -0400 Message-ID: <20260513171555.3876989-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026051236-writing-prior-b532@gregkh> References: <2026051236-writing-prior-b532@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Eric Biggers [ Upstream commit e77f5dd701381cef35b9ea8b6dea6e62c8a7f9f3 ] Now that the alignmask for ahash and shash algorithms is always 0, crypto_ahash_alignmask() always returns 0 and will be removed. In preparation for this, stop checking crypto_ahash_alignmask() in ah4.c. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Stable-dep-of: ec54093e6a8f ("xfrm: ah: account for ESN high bits in async callbacks") Signed-off-by: Sasha Levin --- net/ipv4/ah4.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 36ed85bf2ad51..9641fa578bf86 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c @@ -27,9 +27,7 @@ static void *ah_alloc_tmp(struct crypto_ahash *ahash, int nfrags, { unsigned int len; - len = size + crypto_ahash_digestsize(ahash) + - (crypto_ahash_alignmask(ahash) & - ~(crypto_tfm_ctx_alignment() - 1)); + len = size + crypto_ahash_digestsize(ahash); len = ALIGN(len, crypto_tfm_ctx_alignment()); @@ -46,10 +44,9 @@ static inline u8 *ah_tmp_auth(void *tmp, unsigned int offset) return tmp + offset; } -static inline u8 *ah_tmp_icv(struct crypto_ahash *ahash, void *tmp, - unsigned int offset) +static inline u8 *ah_tmp_icv(void *tmp, unsigned int offset) { - return PTR_ALIGN((u8 *)tmp + offset, crypto_ahash_alignmask(ahash) + 1); + return tmp + offset; } static inline struct ahash_request *ah_tmp_req(struct crypto_ahash *ahash, @@ -129,7 +126,7 @@ static void ah_output_done(struct crypto_async_request *base, int err) int ihl = ip_hdrlen(skb); iph = AH_SKB_CB(skb)->tmp; - icv = ah_tmp_icv(ahp->ahash, iph, ihl); + icv = ah_tmp_icv(iph, ihl); memcpy(ah->auth_data, icv, ahp->icv_trunc_len); top_iph->tos = iph->tos; @@ -182,7 +179,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) if (!iph) goto out; seqhi = (__be32 *)((char *)iph + ihl); - icv = ah_tmp_icv(ahash, seqhi, seqhi_len); + icv = ah_tmp_icv(seqhi, seqhi_len); req = ah_tmp_req(ahash, icv); sg = ah_req_sg(ahash, req); seqhisg = sg + nfrags; @@ -279,7 +276,7 @@ static void ah_input_done(struct crypto_async_request *base, int err) work_iph = AH_SKB_CB(skb)->tmp; auth_data = ah_tmp_auth(work_iph, ihl); - icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len); + icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len); err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0; if (err) @@ -374,7 +371,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) seqhi = (__be32 *)((char *)work_iph + ihl); auth_data = ah_tmp_auth(seqhi, seqhi_len); - icv = ah_tmp_icv(ahash, auth_data, ahp->icv_trunc_len); + icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len); req = ah_tmp_req(ahash, icv); sg = ah_req_sg(ahash, req); seqhisg = sg + nfrags; -- 2.53.0