Skip to content

Commit 689f1c9

Browse files
herbertxklassert
authored andcommitted
ipsec: Remove obsolete MAX_AH_AUTH_LEN
While tracking down the MAX_AH_AUTH_LEN crash in an old kernel I thought that this limit was rather arbitrary and we should just get rid of it. In fact it seems that we've already done all the work needed to remove it apart from actually removing it. This limit was there in order to limit stack usage. Since we've already switched over to allocating scratch space using kmalloc, there is no longer any need to limit the authentication length. This patch kills all references to it, including the BUG_ONs that led me here. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 880a6fa commit 689f1c9

4 files changed

Lines changed: 1 addition & 9 deletions

File tree

‎include/net/ah.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
#include <linux/skbuff.h>
55

6-
/* This is the maximum truncated ICV length that we know of. */
7-
#define MAX_AH_AUTH_LEN 64
8-
96
struct crypto_ahash;
107

118
struct ah_data {

‎net/ipv4/ah4.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,6 @@ static int ah_init_state(struct xfrm_state *x)
505505
ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
506506
ahp->icv_trunc_len = x->aalg->alg_trunc_len/8;
507507

508-
BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
509-
510508
if (x->props.flags & XFRM_STATE_ALIGN4)
511509
x->props.header_len = XFRM_ALIGN4(sizeof(struct ip_auth_hdr) +
512510
ahp->icv_trunc_len);

‎net/ipv6/ah6.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,6 @@ static int ah6_init_state(struct xfrm_state *x)
713713
ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
714714
ahp->icv_trunc_len = x->aalg->alg_trunc_len/8;
715715

716-
BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
717-
718716
x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) +
719717
ahp->icv_trunc_len);
720718
switch (x->props.mode) {

‎net/xfrm/xfrm_user.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ static int attach_auth_trunc(struct xfrm_algo_auth **algpp, u8 *props,
333333
algo = xfrm_aalg_get_byname(ualg->alg_name, 1);
334334
if (!algo)
335335
return -ENOSYS;
336-
if ((ualg->alg_trunc_len / 8) > MAX_AH_AUTH_LEN ||
337-
ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits)
336+
if (ualg->alg_trunc_len > algo->uinfo.auth.icv_fullbits)
338337
return -EINVAL;
339338
*props = algo->desc.sadb_alg_id;
340339

0 commit comments

Comments
 (0)