Commit 8f8a088c authored by Martin Willi's avatar Martin Willi Committed by David S. Miller

xfrm: Use the user specified truncation length in ESP and AH

Instead of using the hardcoded truncation for authentication
algorithms, use the truncation length specified on xfrm_state.
Signed-off-by: default avatarMartin Willi <martin@strongswan.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4447bb33
...@@ -444,7 +444,7 @@ static int ah_init_state(struct xfrm_state *x) ...@@ -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_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); BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
......
...@@ -530,7 +530,7 @@ static int esp_init_authenc(struct xfrm_state *x) ...@@ -530,7 +530,7 @@ static int esp_init_authenc(struct xfrm_state *x)
} }
err = crypto_aead_setauthsize( err = crypto_aead_setauthsize(
aead, aalg_desc->uinfo.auth.icv_truncbits / 8); aead, x->aalg->alg_trunc_len / 8);
if (err) if (err)
goto free_key; goto free_key;
} }
......
...@@ -667,7 +667,7 @@ static int ah6_init_state(struct xfrm_state *x) ...@@ -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_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); BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
......
...@@ -473,7 +473,7 @@ static int esp_init_authenc(struct xfrm_state *x) ...@@ -473,7 +473,7 @@ static int esp_init_authenc(struct xfrm_state *x)
} }
err = crypto_aead_setauthsize( err = crypto_aead_setauthsize(
aead, aalg_desc->uinfo.auth.icv_truncbits / 8); aead, x->aalg->alg_trunc_len / 8);
if (err) if (err)
goto free_key; goto free_key;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment