diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/esp4.c | 9 | ||||
| -rw-r--r-- | net/ipv6/esp6.c | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 109ee89f123e..8b5386a6cb88 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) | |||
| 154 | } | 154 | } |
| 155 | blksize = ALIGN(crypto_aead_blocksize(aead), 4); | 155 | blksize = ALIGN(crypto_aead_blocksize(aead), 4); |
| 156 | clen = ALIGN(skb->len + 2 + tfclen, blksize); | 156 | clen = ALIGN(skb->len + 2 + tfclen, blksize); |
| 157 | if (esp->padlen) | ||
| 158 | clen = ALIGN(clen, esp->padlen); | ||
| 159 | plen = clen - skb->len - tfclen; | 157 | plen = clen - skb->len - tfclen; |
| 160 | 158 | ||
| 161 | err = skb_cow_data(skb, tfclen + plen + alen, &trailer); | 159 | err = skb_cow_data(skb, tfclen + plen + alen, &trailer); |
| @@ -461,7 +459,6 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | |||
| 461 | { | 459 | { |
| 462 | struct esp_data *esp = x->data; | 460 | struct esp_data *esp = x->data; |
| 463 | u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); | 461 | u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); |
| 464 | u32 align = max_t(u32, blksize, esp->padlen); | ||
| 465 | unsigned int net_adj; | 462 | unsigned int net_adj; |
| 466 | 463 | ||
| 467 | switch (x->props.mode) { | 464 | switch (x->props.mode) { |
| @@ -477,7 +474,7 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | |||
| 477 | } | 474 | } |
| 478 | 475 | ||
| 479 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - | 476 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - |
| 480 | net_adj) & ~(align - 1)) + net_adj - 2; | 477 | net_adj) & ~(blksize - 1)) + net_adj - 2; |
| 481 | } | 478 | } |
| 482 | 479 | ||
| 483 | static void esp4_err(struct sk_buff *skb, u32 info) | 480 | static void esp4_err(struct sk_buff *skb, u32 info) |
| @@ -659,8 +656,6 @@ static int esp_init_state(struct xfrm_state *x) | |||
| 659 | 656 | ||
| 660 | aead = esp->aead; | 657 | aead = esp->aead; |
| 661 | 658 | ||
| 662 | esp->padlen = 0; | ||
| 663 | |||
| 664 | x->props.header_len = sizeof(struct ip_esp_hdr) + | 659 | x->props.header_len = sizeof(struct ip_esp_hdr) + |
| 665 | crypto_aead_ivsize(aead); | 660 | crypto_aead_ivsize(aead); |
| 666 | if (x->props.mode == XFRM_MODE_TUNNEL) | 661 | if (x->props.mode == XFRM_MODE_TUNNEL) |
| @@ -683,8 +678,6 @@ static int esp_init_state(struct xfrm_state *x) | |||
| 683 | } | 678 | } |
| 684 | 679 | ||
| 685 | align = ALIGN(crypto_aead_blocksize(aead), 4); | 680 | align = ALIGN(crypto_aead_blocksize(aead), 4); |
| 686 | if (esp->padlen) | ||
| 687 | align = max_t(u32, align, esp->padlen); | ||
| 688 | x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); | 681 | x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); |
| 689 | 682 | ||
| 690 | error: | 683 | error: |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index d3618a78fcac..0073cd096984 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) | |||
| 181 | } | 181 | } |
| 182 | blksize = ALIGN(crypto_aead_blocksize(aead), 4); | 182 | blksize = ALIGN(crypto_aead_blocksize(aead), 4); |
| 183 | clen = ALIGN(skb->len + 2 + tfclen, blksize); | 183 | clen = ALIGN(skb->len + 2 + tfclen, blksize); |
| 184 | if (esp->padlen) | ||
| 185 | clen = ALIGN(clen, esp->padlen); | ||
| 186 | plen = clen - skb->len - tfclen; | 184 | plen = clen - skb->len - tfclen; |
| 187 | 185 | ||
| 188 | err = skb_cow_data(skb, tfclen + plen + alen, &trailer); | 186 | err = skb_cow_data(skb, tfclen + plen + alen, &trailer); |
| @@ -416,7 +414,6 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) | |||
| 416 | { | 414 | { |
| 417 | struct esp_data *esp = x->data; | 415 | struct esp_data *esp = x->data; |
| 418 | u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); | 416 | u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4); |
| 419 | u32 align = max_t(u32, blksize, esp->padlen); | ||
| 420 | unsigned int net_adj; | 417 | unsigned int net_adj; |
| 421 | 418 | ||
| 422 | if (x->props.mode != XFRM_MODE_TUNNEL) | 419 | if (x->props.mode != XFRM_MODE_TUNNEL) |
| @@ -425,7 +422,7 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) | |||
| 425 | net_adj = 0; | 422 | net_adj = 0; |
| 426 | 423 | ||
| 427 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - | 424 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - |
| 428 | net_adj) & ~(align - 1)) + net_adj - 2; | 425 | net_adj) & ~(blksize - 1)) + net_adj - 2; |
| 429 | } | 426 | } |
| 430 | 427 | ||
| 431 | static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 428 | 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) | |||
| 606 | 603 | ||
| 607 | aead = esp->aead; | 604 | aead = esp->aead; |
| 608 | 605 | ||
| 609 | esp->padlen = 0; | ||
| 610 | |||
| 611 | x->props.header_len = sizeof(struct ip_esp_hdr) + | 606 | x->props.header_len = sizeof(struct ip_esp_hdr) + |
| 612 | crypto_aead_ivsize(aead); | 607 | crypto_aead_ivsize(aead); |
| 613 | switch (x->props.mode) { | 608 | switch (x->props.mode) { |
| @@ -626,8 +621,6 @@ static int esp6_init_state(struct xfrm_state *x) | |||
| 626 | } | 621 | } |
| 627 | 622 | ||
| 628 | align = ALIGN(crypto_aead_blocksize(aead), 4); | 623 | align = ALIGN(crypto_aead_blocksize(aead), 4); |
| 629 | if (esp->padlen) | ||
| 630 | align = max_t(u32, align, esp->padlen); | ||
| 631 | x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); | 624 | x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead); |
| 632 | 625 | ||
| 633 | error: | 626 | error: |
