net: esp{4,6}: remove padlen from struct esp_data
authorMathias Krause <mathias.krause@secunet.com>
Fri, 18 Oct 2013 10:09:04 +0000 (12:09 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 29 Oct 2013 05:39:42 +0000 (06:39 +0100)
The padlen member of struct esp_data is always zero. Get rid of it.

Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/esp.h
net/ipv4/esp4.c
net/ipv6/esp6.c

index 1356dda00d22f9cd3fad3ea0eb625b667f76c017..706b740d70573f4b283a56c8f71c5333352a714f 100644 (file)
@@ -6,9 +6,6 @@
 struct crypto_aead;
 
 struct esp_data {
-       /* 0..255 */
-       int padlen;
-
        /* Confidentiality & Integrity */
        struct crypto_aead *aead;
 };
index 109ee89f123e5e51714cae1fa9097e6ec65f0627..8b5386a6cb88d1c8455c3d23564975f9c066d89c 100644 (file)
@@ -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:
index d3618a78fcac4b1f6e606a904196de79235833b1..0073cd09698417287dd89b7086196373186566cf 100644 (file)
@@ -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:
This page took 0.030344 seconds and 5 git commands to generate.