aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/esp6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/esp6.c')
-rw-r--r--net/ipv6/esp6.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 25dcf69cd80..363e63ffecc 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.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/esp.c 24 * This file is derived from net/ipv4/esp.c
25 */ 25 */
26 26
@@ -166,7 +166,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
166 } 166 }
167 167
168 /* If integrity check is required, do this. */ 168 /* If integrity check is required, do this. */
169 if (esp->auth.icv_full_len) { 169 if (esp->auth.icv_full_len) {
170 u8 sum[alen]; 170 u8 sum[alen];
171 171
172 ret = esp_mac_digest(esp, skb, 0, skb->len - alen); 172 ret = esp_mac_digest(esp, skb, 0, skb->len - alen);
@@ -197,7 +197,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
197 if (esp->conf.ivlen) 197 if (esp->conf.ivlen)
198 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen); 198 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen);
199 199
200 { 200 {
201 u8 nexthdr[2]; 201 u8 nexthdr[2];
202 struct scatterlist *sg = &esp->sgbuf[0]; 202 struct scatterlist *sg = &esp->sgbuf[0];
203 u8 padlen; 203 u8 padlen;
@@ -225,7 +225,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
225 ret = -EINVAL; 225 ret = -EINVAL;
226 goto out; 226 goto out;
227 } 227 }
228 /* ... check padding bits here. Silly. :-) */ 228 /* ... check padding bits here. Silly. :-) */
229 229
230 pskb_trim(skb, skb->len - alen - padlen - 2); 230 pskb_trim(skb, skb->len - alen - padlen - 2);
231 ret = nexthdr[1]; 231 ret = nexthdr[1];
@@ -256,20 +256,20 @@ static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
256} 256}
257 257
258static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 258static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
259 int type, int code, int offset, __be32 info) 259 int type, int code, int offset, __be32 info)
260{ 260{
261 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; 261 struct ipv6hdr *iph = (struct ipv6hdr*)skb->data;
262 struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset); 262 struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset);
263 struct xfrm_state *x; 263 struct xfrm_state *x;
264 264
265 if (type != ICMPV6_DEST_UNREACH && 265 if (type != ICMPV6_DEST_UNREACH &&
266 type != ICMPV6_PKT_TOOBIG) 266 type != ICMPV6_PKT_TOOBIG)
267 return; 267 return;
268 268
269 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); 269 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6);
270 if (!x) 270 if (!x)
271 return; 271 return;
272 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", 272 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n",
273 ntohl(esph->spi), NIP6(iph->daddr)); 273 ntohl(esph->spi), NIP6(iph->daddr));
274 xfrm_state_put(x); 274 xfrm_state_put(x);
275} 275}
@@ -326,10 +326,10 @@ static int esp6_init_state(struct xfrm_state *x)
326 esp->auth.tfm = hash; 326 esp->auth.tfm = hash;
327 if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len)) 327 if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len))
328 goto error; 328 goto error;
329 329
330 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); 330 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
331 BUG_ON(!aalg_desc); 331 BUG_ON(!aalg_desc);
332 332
333 if (aalg_desc->uinfo.auth.icv_fullbits/8 != 333 if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
334 crypto_hash_digestsize(hash)) { 334 crypto_hash_digestsize(hash)) {
335 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n", 335 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n",
@@ -338,10 +338,10 @@ static int esp6_init_state(struct xfrm_state *x)
338 aalg_desc->uinfo.auth.icv_fullbits/8); 338 aalg_desc->uinfo.auth.icv_fullbits/8);
339 goto error; 339 goto error;
340 } 340 }
341 341
342 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 342 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
343 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 343 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
344 344
345 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL); 345 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL);
346 if (!esp->auth.work_icv) 346 if (!esp->auth.work_icv)
347 goto error; 347 goto error;