From patchwork Fri Oct 18 10:09:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Krause X-Patchwork-Id: 284521 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.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E8D22C00BC for ; Fri, 18 Oct 2013 21:09:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752872Ab3JRKJV (ORCPT ); Fri, 18 Oct 2013 06:09:21 -0400 Received: from a.mx.secunet.com ([195.81.216.161]:54006 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752550Ab3JRKJS (ORCPT ); Fri, 18 Oct 2013 06:09:18 -0400 Received: from localhost (alg1 [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 5686C1A006F; Fri, 18 Oct 2013 12:09:17 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bsjNqIIvGQuR; Fri, 18 Oct 2013 12:09:16 +0200 (CEST) Received: from mail-srv1.secumail.de (unknown [10.53.40.200]) by a.mx.secunet.com (Postfix) with ESMTP id 10CF91A0071; Fri, 18 Oct 2013 12:09:16 +0200 (CEST) Received: from jig.dd.secunet.de ([10.182.9.193]) by mail-srv1.secumail.de over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 18 Oct 2013 12:09:16 +0200 Received: from mk by jig.dd.secunet.de with local (Exim 4.69) (envelope-from ) id 1VX6zb-0005Qz-AM; Fri, 18 Oct 2013 12:09:15 +0200 From: Mathias Krause To: netdev@vger.kernel.org Cc: Mathias Krause , Steffen Klassert , Herbert Xu , "David S. Miller" Subject: [PATCH net-next 1/2] net: esp{4, 6}: remove padlen from struct esp_data Date: Fri, 18 Oct 2013 12:09:04 +0200 Message-Id: <1382090945-20860-2-git-send-email-mathias.krause@secunet.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1382090945-20860-1-git-send-email-mathias.krause@secunet.com> References: <1382090945-20860-1-git-send-email-mathias.krause@secunet.com> X-OriginalArrivalTime: 18 Oct 2013 10:09:16.0638 (UTC) FILETIME=[1A6BC7E0:01CECBEA] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The padlen member of struct esp_data is always zero. Get rid of it. Signed-off-by: Mathias Krause Cc: Steffen Klassert Cc: Herbert Xu Cc: "David S. Miller" --- include/net/esp.h | 3 --- net/ipv4/esp4.c | 9 +-------- net/ipv6/esp6.c | 9 +-------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/include/net/esp.h b/include/net/esp.h index 1356dda..706b740 100644 --- a/include/net/esp.h +++ b/include/net/esp.h @@ -6,9 +6,6 @@ struct crypto_aead; struct esp_data { - /* 0..255 */ - int padlen; - /* Confidentiality & Integrity */ struct crypto_aead *aead; }; diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 109ee89..8b5386a 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -154,8 +154,6 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) } blksize = ALIGN(crypto_aead_blocksize(aead), 4); clen = ALIGN(skb->len + 2 + tfclen, blksize); - if (esp->padlen) - clen = ALIGN(clen, esp->padlen); plen = clen - skb->len - tfclen; err = skb_cow_data(skb, tfclen + plen + alen, &trailer); @@ -461,7 +459,6 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) { struct esp_data *esp = x->data; u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); - u32 align = max_t(u32, blksize, esp->padlen); unsigned int net_adj; switch (x->props.mode) { @@ -477,7 +474,7 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) } return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - - net_adj) & ~(align - 1)) + net_adj - 2; + net_adj) & ~(blksize - 1)) + net_adj - 2; } static void esp4_err(struct sk_buff *skb, u32 info) @@ -659,8 +656,6 @@ static int esp_init_state(struct xfrm_state *x) aead = esp->aead; - esp->padlen = 0; - x->props.header_len = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); if (x->props.mode == XFRM_MODE_TUNNEL) @@ -683,8 +678,6 @@ static int esp_init_state(struct xfrm_state *x) } align = ALIGN(crypto_aead_blocksize(aead), 4); - if (esp->padlen) - align = max_t(u32, align, esp->padlen); x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); error: diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index d3618a7..0073cd0 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -181,8 +181,6 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) } blksize = ALIGN(crypto_aead_blocksize(aead), 4); clen = ALIGN(skb->len + 2 + tfclen, blksize); - if (esp->padlen) - clen = ALIGN(clen, esp->padlen); plen = clen - skb->len - tfclen; err = skb_cow_data(skb, tfclen + plen + alen, &trailer); @@ -416,7 +414,6 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) { struct esp_data *esp = x->data; u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); - u32 align = max_t(u32, blksize, esp->padlen); unsigned int net_adj; if (x->props.mode != XFRM_MODE_TUNNEL) @@ -425,7 +422,7 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) net_adj = 0; return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - - net_adj) & ~(align - 1)) + net_adj - 2; + net_adj) & ~(blksize - 1)) + net_adj - 2; } static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, @@ -606,8 +603,6 @@ static int esp6_init_state(struct xfrm_state *x) aead = esp->aead; - esp->padlen = 0; - x->props.header_len = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); switch (x->props.mode) { @@ -626,8 +621,6 @@ static int esp6_init_state(struct xfrm_state *x) } align = ALIGN(crypto_aead_blocksize(aead), 4); - if (esp->padlen) - align = max_t(u32, align, esp->padlen); x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); error: