Skip to content

Commit 0a6bfaa

Browse files
ebiggersherbertx
authored andcommitted
net: ipv6: stop checking crypto_ahash_alignmask
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent e77f5dd commit 0a6bfaa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

net/ipv6/ah6.c

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

54-
len = size + crypto_ahash_digestsize(ahash) +
55-
(crypto_ahash_alignmask(ahash) &
56-
~(crypto_tfm_ctx_alignment() - 1));
54+
len = size + crypto_ahash_digestsize(ahash);
5755

5856
len = ALIGN(len, crypto_tfm_ctx_alignment());
5957

@@ -75,10 +73,9 @@ static inline u8 *ah_tmp_auth(u8 *tmp, unsigned int offset)
7573
return tmp + offset;
7674
}
7775

78-
static inline u8 *ah_tmp_icv(struct crypto_ahash *ahash, void *tmp,
79-
unsigned int offset)
76+
static inline u8 *ah_tmp_icv(void *tmp, unsigned int offset)
8077
{
81-
return PTR_ALIGN((u8 *)tmp + offset, crypto_ahash_alignmask(ahash) + 1);
78+
return tmp + offset;
8279
}
8380

8481
static inline struct ahash_request *ah_tmp_req(struct crypto_ahash *ahash,
@@ -299,7 +296,7 @@ static void ah6_output_done(void *data, int err)
299296

300297
iph_base = AH_SKB_CB(skb)->tmp;
301298
iph_ext = ah_tmp_ext(iph_base);
302-
icv = ah_tmp_icv(ahp->ahash, iph_ext, extlen);
299+
icv = ah_tmp_icv(iph_ext, extlen);
303300

304301
memcpy(ah->auth_data, icv, ahp->icv_trunc_len);
305302
memcpy(top_iph, iph_base, IPV6HDR_BASELEN);
@@ -362,7 +359,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
362359

363360
iph_ext = ah_tmp_ext(iph_base);
364361
seqhi = (__be32 *)((char *)iph_ext + extlen);
365-
icv = ah_tmp_icv(ahash, seqhi, seqhi_len);
362+
icv = ah_tmp_icv(seqhi, seqhi_len);
366363
req = ah_tmp_req(ahash, icv);
367364
sg = ah_req_sg(ahash, req);
368365
seqhisg = sg + nfrags;
@@ -468,7 +465,7 @@ static void ah6_input_done(void *data, int err)
468465

469466
work_iph = AH_SKB_CB(skb)->tmp;
470467
auth_data = ah_tmp_auth(work_iph, hdr_len);
471-
icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
468+
icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len);
472469

473470
err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
474471
if (err)
@@ -576,7 +573,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
576573

577574
auth_data = ah_tmp_auth((u8 *)work_iph, hdr_len);
578575
seqhi = (__be32 *)(auth_data + ahp->icv_trunc_len);
579-
icv = ah_tmp_icv(ahash, seqhi, seqhi_len);
576+
icv = ah_tmp_icv(seqhi, seqhi_len);
580577
req = ah_tmp_req(ahash, icv);
581578
sg = ah_req_sg(ahash, req);
582579
seqhisg = sg + nfrags;

0 commit comments

Comments
 (0)