Skip to content

Commit e77f5dd

Browse files
ebiggersherbertx
authored andcommitted
net: ipv4: 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 ah4.c. Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 93f367a commit e77f5dd

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

net/ipv4/ah4.c

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

30-
len = size + crypto_ahash_digestsize(ahash) +
31-
(crypto_ahash_alignmask(ahash) &
32-
~(crypto_tfm_ctx_alignment() - 1));
30+
len = size + crypto_ahash_digestsize(ahash);
3331

3432
len = ALIGN(len, crypto_tfm_ctx_alignment());
3533

@@ -46,10 +44,9 @@ static inline u8 *ah_tmp_auth(void *tmp, unsigned int offset)
4644
return tmp + offset;
4745
}
4846

49-
static inline u8 *ah_tmp_icv(struct crypto_ahash *ahash, void *tmp,
50-
unsigned int offset)
47+
static inline u8 *ah_tmp_icv(void *tmp, unsigned int offset)
5148
{
52-
return PTR_ALIGN((u8 *)tmp + offset, crypto_ahash_alignmask(ahash) + 1);
49+
return tmp + offset;
5350
}
5451

5552
static inline struct ahash_request *ah_tmp_req(struct crypto_ahash *ahash,
@@ -129,7 +126,7 @@ static void ah_output_done(void *data, int err)
129126
int ihl = ip_hdrlen(skb);
130127

131128
iph = AH_SKB_CB(skb)->tmp;
132-
icv = ah_tmp_icv(ahp->ahash, iph, ihl);
129+
icv = ah_tmp_icv(iph, ihl);
133130
memcpy(ah->auth_data, icv, ahp->icv_trunc_len);
134131

135132
top_iph->tos = iph->tos;
@@ -182,7 +179,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
182179
if (!iph)
183180
goto out;
184181
seqhi = (__be32 *)((char *)iph + ihl);
185-
icv = ah_tmp_icv(ahash, seqhi, seqhi_len);
182+
icv = ah_tmp_icv(seqhi, seqhi_len);
186183
req = ah_tmp_req(ahash, icv);
187184
sg = ah_req_sg(ahash, req);
188185
seqhisg = sg + nfrags;
@@ -279,7 +276,7 @@ static void ah_input_done(void *data, int err)
279276

280277
work_iph = AH_SKB_CB(skb)->tmp;
281278
auth_data = ah_tmp_auth(work_iph, ihl);
282-
icv = ah_tmp_icv(ahp->ahash, auth_data, ahp->icv_trunc_len);
279+
icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len);
283280

284281
err = crypto_memneq(icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG : 0;
285282
if (err)
@@ -374,7 +371,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
374371

375372
seqhi = (__be32 *)((char *)work_iph + ihl);
376373
auth_data = ah_tmp_auth(seqhi, seqhi_len);
377-
icv = ah_tmp_icv(ahash, auth_data, ahp->icv_trunc_len);
374+
icv = ah_tmp_icv(auth_data, ahp->icv_trunc_len);
378375
req = ah_tmp_req(ahash, icv);
379376
sg = ah_req_sg(ahash, req);
380377
seqhisg = sg + nfrags;

0 commit comments

Comments
 (0)