Skip to content

Commit 9d3968c

Browse files
ebiggersgregkh
authored andcommitted
net: ipv6: stop checking crypto_ahash_alignmask
[ Upstream commit 0a6bfaa ] 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 ah6.c. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Stable-dep-of: ec54093 ("xfrm: ah: account for ESN high bits in async callbacks") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0841fc6 commit 9d3968c

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

net/ipv6/ah6.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ static void *ah_alloc_tmp(struct crypto_ahash *ahash, int nfrags,
7979
{
8080
unsigned int len;
8181

82-
len = size + crypto_ahash_digestsize(ahash) +
83-
(crypto_ahash_alignmask(ahash) &
84-
~(crypto_tfm_ctx_alignment() - 1));
82+
len = size + crypto_ahash_digestsize(ahash);
8583

8684
len = ALIGN(len, crypto_tfm_ctx_alignment());
8785

@@ -103,10 +101,9 @@ static inline u8 *ah_tmp_auth(u8 *tmp, unsigned int offset)
103101
return tmp + offset;
104102
}
105103

106-
static inline u8 *ah_tmp_icv(struct crypto_ahash *ahash, void *tmp,
107-
unsigned int offset)
104+
static inline u8 *ah_tmp_icv(void *tmp, unsigned int offset)
108105
{
109-
return PTR_ALIGN((u8 *)tmp + offset, crypto_ahash_alignmask(ahash) + 1);
106+
return tmp + offset;
110107
}
111108

112109
static inline struct ahash_request *ah_tmp_req(struct crypto_ahash *ahash,
@@ -327,7 +324,7 @@ static void ah6_output_done(void *data, int err)
327324

328325
iph_base = AH_SKB_CB(skb)->tmp;
329326
iph_ext = ah_tmp_ext(iph_base);
330-
icv = ah_tmp_icv(ahp->ahash, iph_ext, extlen);
327+
icv = ah_tmp_icv(iph_ext, extlen);
331328

332329
memcpy(ah->auth_data, icv, ahp->icv_trunc_len);
333330
memcpy(top_iph, iph_base, IPV6HDR_BASELEN);
@@ -384,7 +381,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
384381

385382
iph_ext = ah_tmp_ext(iph_base);
386383
seqhi = (__be32 *)((char *)iph_ext + extlen);
387-
icv = ah_tmp_icv(ahash, seqhi, seqhi_len);
384+
icv = ah_tmp_icv(seqhi, seqhi_len);
388385
req = ah_tmp_req(ahash, icv);
389386
sg = ah_req_sg(ahash, req);
390387
seqhisg = sg + nfrags;
@@ -480,7 +477,7 @@ static void ah6_input_done(void *data, int err)
480477

481478
work_iph = AH_SKB_CB(skb)->tmp;
482479
auth_data = ah_tmp_auth(work_iph, hdr_len);
483-
icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
480+
icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len);
484481

485482
err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
486483
if (err)
@@ -588,7 +585,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
588585

589586
auth_data = ah_tmp_auth((u8 *)work_iph, hdr_len);
590587
seqhi = (__be32 *)(auth_data + ahp->icv_trunc_len);
591-
icv = ah_tmp_icv(ahash, seqhi, seqhi_len);
588+
icv = ah_tmp_icv(seqhi, seqhi_len);
592589
req = ah_tmp_req(ahash, icv);
593590
sg = ah_req_sg(ahash, req);
594591
seqhisg = sg + nfrags;

0 commit comments

Comments
 (0)