diff options
Diffstat (limited to 'net/ipv6/ah6.c')
-rw-r--r-- | net/ipv6/ah6.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 12c5a4dec09e..dc68b7269c3c 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C)2002 USAGI/WIDE Project | 2 | * Copyright (C)2002 USAGI/WIDE Project |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | * | 17 | * |
18 | * Authors | 18 | * Authors |
19 | * | 19 | * |
20 | * Mitsuru KANDA @USAGI : IPv6 Support | 20 | * Mitsuru KANDA @USAGI : IPv6 Support |
21 | * Kazunori MIYAZAWA @USAGI : | 21 | * Kazunori MIYAZAWA @USAGI : |
22 | * Kunihiro Ishiguro <kunihiro@ipinfusion.com> | 22 | * Kunihiro Ishiguro <kunihiro@ipinfusion.com> |
23 | * | 23 | * |
24 | * This file is derived from net/ipv4/ah.c. | 24 | * This file is derived from net/ipv4/ah.c. |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -54,7 +54,7 @@ static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr) | |||
54 | optlen = 1; | 54 | optlen = 1; |
55 | break; | 55 | break; |
56 | default: | 56 | default: |
57 | if (len < 2) | 57 | if (len < 2) |
58 | goto bad; | 58 | goto bad; |
59 | optlen = opt[off+1]+2; | 59 | optlen = opt[off+1]+2; |
60 | if (len < optlen) | 60 | if (len < optlen) |
@@ -152,7 +152,7 @@ static void ipv6_rearrange_rthdr(struct ipv6hdr *iph, struct ipv6_rt_hdr *rthdr) | |||
152 | segments_left = rthdr->segments_left; | 152 | segments_left = rthdr->segments_left; |
153 | if (segments_left == 0) | 153 | if (segments_left == 0) |
154 | return; | 154 | return; |
155 | rthdr->segments_left = 0; | 155 | rthdr->segments_left = 0; |
156 | 156 | ||
157 | /* The value of rthdr->hdrlen has been verified either by the system | 157 | /* The value of rthdr->hdrlen has been verified either by the system |
158 | * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming | 158 | * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming |
@@ -278,7 +278,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
278 | top_iph->hop_limit = 0; | 278 | top_iph->hop_limit = 0; |
279 | 279 | ||
280 | ahp = x->data; | 280 | ahp = x->data; |
281 | ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + | 281 | ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + |
282 | ahp->icv_trunc_len) >> 2) - 2; | 282 | ahp->icv_trunc_len) >> 2) - 2; |
283 | 283 | ||
284 | ah->reserved = 0; | 284 | ah->reserved = 0; |
@@ -319,7 +319,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
319 | * Moving the pointer of skb->nh.raw by using skb_pull as long as AH | 319 | * Moving the pointer of skb->nh.raw by using skb_pull as long as AH |
320 | * header length. Then copy back the copy as long as hdr_len | 320 | * header length. Then copy back the copy as long as hdr_len |
321 | * If destination header following AH exists, copy it into after [Ext2]. | 321 | * If destination header following AH exists, copy it into after [Ext2]. |
322 | * | 322 | * |
323 | * |<>|[IPv6][Ext1][Ext2][Dest][Payload] | 323 | * |<>|[IPv6][Ext1][Ext2][Dest][Payload] |
324 | * There is offset of AH before IPv6 header after the process. | 324 | * There is offset of AH before IPv6 header after the process. |
325 | */ | 325 | */ |
@@ -347,9 +347,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
347 | nexthdr = ah->nexthdr; | 347 | nexthdr = ah->nexthdr; |
348 | ah_hlen = (ah->hdrlen + 2) << 2; | 348 | ah_hlen = (ah->hdrlen + 2) << 2; |
349 | 349 | ||
350 | if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && | 350 | if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) && |
351 | ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) | 351 | ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len)) |
352 | goto out; | 352 | goto out; |
353 | 353 | ||
354 | if (!pskb_may_pull(skb, ah_hlen)) | 354 | if (!pskb_may_pull(skb, ah_hlen)) |
355 | goto out; | 355 | goto out; |
@@ -365,7 +365,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
365 | skb->nh.ipv6h->flow_lbl[2] = 0; | 365 | skb->nh.ipv6h->flow_lbl[2] = 0; |
366 | skb->nh.ipv6h->hop_limit = 0; | 366 | skb->nh.ipv6h->hop_limit = 0; |
367 | 367 | ||
368 | { | 368 | { |
369 | u8 auth_data[MAX_AH_AUTH_LEN]; | 369 | u8 auth_data[MAX_AH_AUTH_LEN]; |
370 | 370 | ||
371 | memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); | 371 | memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); |
@@ -395,8 +395,8 @@ out: | |||
395 | return err; | 395 | return err; |
396 | } | 396 | } |
397 | 397 | ||
398 | static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 398 | static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
399 | int type, int code, int offset, __be32 info) | 399 | int type, int code, int offset, __be32 info) |
400 | { | 400 | { |
401 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | 401 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
402 | struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); | 402 | struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset); |
@@ -445,7 +445,7 @@ static int ah6_init_state(struct xfrm_state *x) | |||
445 | ahp->tfm = tfm; | 445 | ahp->tfm = tfm; |
446 | if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) | 446 | if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) |
447 | goto error; | 447 | goto error; |
448 | 448 | ||
449 | /* | 449 | /* |
450 | * Lookup the algorithm description maintained by xfrm_algo, | 450 | * Lookup the algorithm description maintained by xfrm_algo, |
451 | * verify crypto transform properties, and store information | 451 | * verify crypto transform properties, and store information |
@@ -462,16 +462,16 @@ static int ah6_init_state(struct xfrm_state *x) | |||
462 | aalg_desc->uinfo.auth.icv_fullbits/8); | 462 | aalg_desc->uinfo.auth.icv_fullbits/8); |
463 | goto error; | 463 | goto error; |
464 | } | 464 | } |
465 | 465 | ||
466 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; | 466 | ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; |
467 | ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; | 467 | ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; |
468 | 468 | ||
469 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); | 469 | BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); |
470 | 470 | ||
471 | ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); | 471 | ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); |
472 | if (!ahp->work_icv) | 472 | if (!ahp->work_icv) |
473 | goto error; | 473 | goto error; |
474 | 474 | ||
475 | x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); | 475 | x->props.header_len = XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len); |
476 | if (x->props.mode == XFRM_MODE_TUNNEL) | 476 | if (x->props.mode == XFRM_MODE_TUNNEL) |
477 | x->props.header_len += sizeof(struct ipv6hdr); | 477 | x->props.header_len += sizeof(struct ipv6hdr); |