xfrm: Use the user specified truncation length in ESP and AH
authorMartin Willi <martin@strongswan.org>
Wed, 25 Nov 2009 00:29:53 +0000 (00:29 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Nov 2009 23:48:41 +0000 (15:48 -0800)
Instead of using the hardcoded truncation for authentication
algorithms, use the truncation length specified on xfrm_state.

Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ah4.c
net/ipv4/esp4.c
net/ipv6/ah6.c
net/ipv6/esp6.c

index d07b0c1..7ed3e4a 100644 (file)
@@ -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);
 
index 12f7287..1948895 100644 (file)
@@ -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;
        }
index 0f526f8..c2f300c 100644 (file)
@@ -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);
 
index af597c7..668a46b 100644 (file)
@@ -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;
        }