]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
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 d07b0c1dd3507a41ce95f3b7232bb5d5654c5fd4..7ed3e4ae93ae7a9e0d72d818da04122d61497ff8 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 12f7287e902dcac7614cfb8375c1788e15e006cc..1948895beb6d137c3fb45058c66a96315dc618a0 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 0f526f8ea51820477c54816678a74b0aba30238c..c2f300c314be8f37699d220fbb6ab5e62039990a 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 af597c73ebe9b6bc53f5ae0eb4c91a268a66e47d..668a46b655e6511da56fa233a8c381b5082e3632 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;
        }