Skip to content

Commit

Permalink
xfrm: Use the user specified truncation length in ESP and AH
Browse files Browse the repository at this point in the history
Instead of using the hardcoded truncation for authentication
algorithms, use the truncation length specified on xfrm_state.

Signed-off-by: Martin Willi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
martinwilli authored and davem330 committed Nov 25, 2009
1 parent 4447bb3 commit 8f8a088
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion net/ipv4/ah4.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ static int ah_init_state(struct xfrm_state *x)
}

ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
ahp->icv_trunc_len = x->aalg->alg_trunc_len/8;

BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/esp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ static int esp_init_authenc(struct xfrm_state *x)
}

err = crypto_aead_setauthsize(
aead, aalg_desc->uinfo.auth.icv_truncbits / 8);
aead, x->aalg->alg_trunc_len / 8);
if (err)
goto free_key;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ah6.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static int ah6_init_state(struct xfrm_state *x)
}

ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
ahp->icv_trunc_len = x->aalg->alg_trunc_len/8;

BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/esp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static int esp_init_authenc(struct xfrm_state *x)
}

err = crypto_aead_setauthsize(
aead, aalg_desc->uinfo.auth.icv_truncbits / 8);
aead, x->aalg->alg_trunc_len / 8);
if (err)
goto free_key;
}
Expand Down

0 comments on commit 8f8a088

Please sign in to comment.