From patchwork Wed Nov 25 10:29:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Willi X-Patchwork-Id: 39301 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 75EF71007D1 for ; Wed, 25 Nov 2009 21:53:39 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758541AbZKYKx2 (ORCPT ); Wed, 25 Nov 2009 05:53:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758276AbZKYKx2 (ORCPT ); Wed, 25 Nov 2009 05:53:28 -0500 Received: from zaes.ch ([213.133.111.41]:55415 "EHLO zaes.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbZKYKx1 (ORCPT ); Wed, 25 Nov 2009 05:53:27 -0500 X-Greylist: delayed 1414 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Nov 2009 05:53:27 EST Received: from 193-180.60-188.cust.bluewin.ch ([188.60.180.193] helo=localhost.localdomain) by zaes.ch with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NDFQX-0001Hm-5l; Wed, 25 Nov 2009 11:48:49 +0100 From: Martin Willi To: Herbert Xu Cc: linux-crypto@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 3/3] xfrm: Use the user specified truncation length in ESP and AH Date: Wed, 25 Nov 2009 11:29:53 +0100 Message-Id: X-Mailer: git-send-email 1.6.3.3 In-Reply-To: References: In-Reply-To: References: X-RPR-Rewrite: reverse-path rewritten by zaes.ch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Instead of using the hardcoded truncation for authentication algorithms, use the truncation length specified on xfrm_state. Signed-off-by: Martin Willi --- net/ipv4/ah4.c | 2 +- net/ipv4/esp4.c | 2 +- net/ipv6/ah6.c | 2 +- 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 5c66270..b7be5ed 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c @@ -261,7 +261,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); diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 12f7287..1948895 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -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; } diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index c1589e2..0c2ae68 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c @@ -469,7 +469,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); diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index af597c7..668a46b 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -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; }