diff options
author | Martin Willi <martin@strongswan.org> | 2009-11-24 19:29:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-25 18:48:41 -0500 |
commit | 8f8a088c2127c729638da8f2d33860e346c01eda (patch) | |
tree | d5b81f8d1cc22d3fffbcb049c55dcc9499eb4e04 /net | |
parent | 4447bb33f09444920a8f1d89e1540137429351b6 (diff) |
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: Martin Willi <martin@strongswan.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ah4.c | 2 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 2 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 2 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index d07b0c1dd350..7ed3e4ae93ae 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -444,7 +444,7 @@ static int ah_init_state(struct xfrm_state *x) | |||
444 | } | 444 | } |
445 | 445 | ||
446 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; | 446 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; |
447 | ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; | 447 | ahp->icv_trunc_len = x->aalg->alg_trunc_len/8; |
448 | 448 | ||
449 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); | 449 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); |
450 | 450 | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 12f7287e902d..1948895beb6d 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -530,7 +530,7 @@ static int esp_init_authenc(struct xfrm_state *x) | |||
530 | } | 530 | } |
531 | 531 | ||
532 | err = crypto_aead_setauthsize( | 532 | err = crypto_aead_setauthsize( |
533 | aead, aalg_desc->uinfo.auth.icv_truncbits / 8); | 533 | aead, x->aalg->alg_trunc_len / 8); |
534 | if (err) | 534 | if (err) |
535 | goto free_key; | 535 | goto free_key; |
536 | } | 536 | } |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 0f526f8ea518..c2f300c314be 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -667,7 +667,7 @@ static int ah6_init_state(struct xfrm_state *x) | |||
667 | } | 667 | } |
668 | 668 | ||
669 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; | 669 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; |
670 | ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; | 670 | ahp->icv_trunc_len = x->aalg->alg_trunc_len/8; |
671 | 671 | ||
672 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); | 672 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); |
673 | 673 | ||
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index af597c73ebe9..668a46b655e6 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -473,7 +473,7 @@ static int esp_init_authenc(struct xfrm_state *x) | |||
473 | } | 473 | } |
474 | 474 | ||
475 | err = crypto_aead_setauthsize( | 475 | err = crypto_aead_setauthsize( |
476 | aead, aalg_desc->uinfo.auth.icv_truncbits / 8); | 476 | aead, x->aalg->alg_trunc_len / 8); |
477 | if (err) | 477 | if (err) |
478 | goto free_key; | 478 | goto free_key; |
479 | } | 479 | } |