亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ipsec_ah.c

?? ipsec vpn
?? C
字號:
/* * processing code for AH * Copyright (C) 2003-2004   Michael Richardson <mcr@xelerance.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License * for more details. */char ipsec_ah_c_version[] = "RCSID $Id: ipsec_ah.c,v 1.12.2.1 2006/02/15 05:35:14 paul Exp $";#include <linux/config.h>#include <linux/version.h>#define __NO_VERSION__#include <linux/module.h>#include <linux/kernel.h> /* printk() */#include "openswan/ipsec_param.h"#ifdef MALLOC_SLAB# include <linux/slab.h> /* kmalloc() */#else /* MALLOC_SLAB */# include <linux/malloc.h> /* kmalloc() */#endif /* MALLOC_SLAB */#include <linux/errno.h>  /* error codes */#include <linux/types.h>  /* size_t */#include <linux/interrupt.h> /* mark_bh */#include <linux/netdevice.h>	/* struct device, and other headers */#include <linux/etherdevice.h>	/* eth_type_trans */#include <linux/ip.h>		/* struct iphdr */#include <linux/skbuff.h>#include <openswan.h>#ifdef SPINLOCK# ifdef SPINLOCK_23#  include <linux/spinlock.h> /* *lock* */# else /* SPINLOCK_23 */#  include <asm/spinlock.h> /* *lock* */# endif /* SPINLOCK_23 */#endif /* SPINLOCK */#include <net/ip.h>#include <net/protocol.h>#include "openswan/radij.h"#include "openswan/ipsec_encap.h"#include "openswan/ipsec_sa.h"#include "openswan/ipsec_radij.h"#include "openswan/ipsec_xform.h"#include "openswan/ipsec_tunnel.h" #include "openswan/ipsec_rcv.h"#include "openswan/ipsec_xmit.h"#include "openswan/ipsec_auth.h"#include "openswan/ipsec_ah.h"#include "openswan/ipsec_proto.h"__u32 zeroes[AH_AMAX];enum ipsec_rcv_valueipsec_rcv_ah_checks(struct ipsec_rcv_state *irs,		    struct sk_buff *skb){	int ahminlen;	ahminlen = irs->hard_header_len + sizeof(struct iphdr);	/* take care not to deref this pointer until we check the minlen though */	irs->protostuff.ahstuff.ahp = (struct ahhdr *)skb->h.raw;	if((skb->len < ahminlen+sizeof(struct ahhdr)) ||	   (skb->len < ahminlen+(irs->protostuff.ahstuff.ahp->ah_hl << 2))) {		KLIPS_PRINT(debug_rcv & DB_RX_INAU,			    "klips_debug:ipsec_rcv: "			    "runt ah packet of skb->len=%d received from %s, dropped.\n",			    skb->len,			    irs->ipsaddr_txt);		if(irs->stats) {			irs->stats->rx_errors++;		}		return IPSEC_RCV_BADLEN;	}	irs->said.spi = irs->protostuff.ahstuff.ahp->ah_spi;	/* XXX we only support the one 12-byte authenticator for now */	if(irs->protostuff.ahstuff.ahp->ah_hl != ((AHHMAC_HASHLEN+AHHMAC_RPLLEN) >> 2)) {		KLIPS_PRINT(debug_rcv & DB_RX_INAU,			    "klips_debug:ipsec_rcv: "			    "bad authenticator length %ld, expected %lu from %s.\n",			    (long)(irs->protostuff.ahstuff.ahp->ah_hl << 2),			    (unsigned long) sizeof(struct ahhdr),			    irs->ipsaddr_txt);		if(irs->stats) {			irs->stats->rx_errors++;		}		return IPSEC_RCV_BADLEN;	}	return IPSEC_RCV_OK;}enum ipsec_rcv_valueipsec_rcv_ah_setup_auth(struct ipsec_rcv_state *irs,			struct sk_buff *skb,			__u32          *replay,			unsigned char **authenticator){	struct ahhdr *ahp = irs->protostuff.ahstuff.ahp;	*replay = ntohl(ahp->ah_rpl);	*authenticator = ahp->ah_data;	return IPSEC_RCV_OK;}enum ipsec_rcv_valueipsec_rcv_ah_authcalc(struct ipsec_rcv_state *irs,		      struct sk_buff *skb){	struct auth_alg *aa;	struct ahhdr *ahp = irs->protostuff.ahstuff.ahp;	union {		MD5_CTX		md5;		SHA1_CTX	sha1;	} tctx;	struct iphdr ipo;	int ahhlen;	aa = irs->authfuncs;	/* copy the initialized keying material */	memcpy(&tctx, irs->ictx, irs->ictx_len);	ipo = *irs->ipp;	ipo.tos = 0;	/* mutable RFC 2402 3.3.3.1.1.1 */	ipo.frag_off = 0;	ipo.ttl = 0;	ipo.check = 0;	/* do the sanitized header */	(*aa->update)((void*)&tctx, (caddr_t)&ipo, sizeof(struct iphdr));	/* XXX we didn't do the options here! */	/* now do the AH header itself */	ahhlen = AH_BASIC_LEN + (ahp->ah_hl << 2);	(*aa->update)((void*)&tctx, (caddr_t)ahp,  ahhlen - AHHMAC_HASHLEN);	/* now, do some zeroes */	(*aa->update)((void*)&tctx, (caddr_t)zeroes,  AHHMAC_HASHLEN);	/* finally, do the packet contents themselves */	(*aa->update)((void*)&tctx,		      (caddr_t)skb->h.raw + ahhlen,		      skb->len - ahhlen);	(*aa->final)(irs->hash, (void *)&tctx);	memcpy(&tctx, irs->octx, irs->octx_len);	(*aa->update)((void *)&tctx, irs->hash, aa->hashlen);	(*aa->final)(irs->hash, (void *)&tctx);	return IPSEC_RCV_OK;}enum ipsec_rcv_valueipsec_rcv_ah_decap(struct ipsec_rcv_state *irs){	struct ahhdr *ahp = irs->protostuff.ahstuff.ahp;	struct sk_buff *skb;	int ahhlen;	skb=irs->skb;	ahhlen = AH_BASIC_LEN + (ahp->ah_hl << 2);	irs->ipp->tot_len = htons(ntohs(irs->ipp->tot_len) - ahhlen);	irs->next_header  = ahp->ah_nh;	/*	 * move the IP header forward by the size of the AH header, which	 * will remove the the AH header from the packet.	 */	memmove((void *)(skb->nh.raw + ahhlen),		(void *)(skb->nh.raw), irs->iphlen);	ipsec_rcv_dmp("ah postmove", skb->data, skb->len);	/* skb_pull below, will move up by ahhlen */	/* XXX not clear how this can happen, as the message indicates */	if(skb->len < ahhlen) {		printk(KERN_WARNING		       "klips_error:ipsec_rcv: "		       "tried to skb_pull ahhlen=%d, %d available.  This should never happen, please report.\n",		       ahhlen,		       (int)(skb->len));		return IPSEC_RCV_DECAPFAIL;	}	skb_pull(skb, ahhlen);	skb->nh.raw = skb->nh.raw + ahhlen;	irs->ipp = skb->nh.iph;	ipsec_rcv_dmp("ah postpull", (void *)skb->nh.iph, skb->len);	return IPSEC_RCV_OK;}enum ipsec_xmit_valueipsec_xmit_ah_setup(struct ipsec_xmit_state *ixs){  struct iphdr ipo;  struct ahhdr *ahp;  __u8 hash[AH_AMAX];  union {#ifdef CONFIG_KLIPS_AUTH_HMAC_MD5    MD5_CTX md5;#endif /* CONFIG_KLIPS_AUTH_HMAC_MD5 */#ifdef CONFIG_KLIPS_AUTH_HMAC_SHA1    SHA1_CTX sha1;#endif /* CONFIG_KLIPS_AUTH_HMAC_SHA1 */  } tctx;  unsigned char *dat = (unsigned char *)ixs->iph;  ahp = (struct ahhdr *)(dat + ixs->iphlen);  ahp->ah_spi = ixs->ipsp->ips_said.spi;  ahp->ah_rpl = htonl(++(ixs->ipsp->ips_replaywin_lastseq));  ahp->ah_rv = 0;  ahp->ah_nh = ixs->iph->protocol;  ahp->ah_hl = (sizeof(struct ahhdr) >> 2) - sizeof(__u64)/sizeof(__u32);  ixs->iph->protocol = IPPROTO_AH;  ipsec_xmit_dmp("ahp", (char*)ahp, sizeof(*ahp));    ipo = *ixs->iph;  ipo.tos = 0;  ipo.frag_off = 0;  ipo.ttl = 0;  ipo.check = 0;  ipsec_xmit_dmp("ipo", (char*)&ipo, sizeof(ipo));    switch(ixs->ipsp->ips_authalg) {#ifdef CONFIG_KLIPS_AUTH_HMAC_MD5  case AH_MD5:    tctx.md5 = ((struct md5_ctx*)(ixs->ipsp->ips_key_a))->ictx;    ipsec_xmit_dmp("ictx", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Update(&tctx.md5, (unsigned char *)&ipo, sizeof (struct iphdr));    ipsec_xmit_dmp("ictx+ipo", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Update(&tctx.md5, (unsigned char *)ahp,	      sizeof(struct ahhdr) - sizeof(ahp->ah_data));    ipsec_xmit_dmp("ictx+ahp", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Update(&tctx.md5, (unsigned char *)zeroes, AHHMAC_HASHLEN);    ipsec_xmit_dmp("ictx+zeroes", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Update(&tctx.md5,  dat + ixs->iphlen + sizeof(struct ahhdr),	      ixs->skb->len - ixs->iphlen - sizeof(struct ahhdr));    ipsec_xmit_dmp("ictx+dat", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Final(hash, &tctx.md5);    ipsec_xmit_dmp("ictx hash", (char*)&hash, sizeof(hash));    tctx.md5 = ((struct md5_ctx*)(ixs->ipsp->ips_key_a))->octx;    ipsec_xmit_dmp("octx", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Update(&tctx.md5, hash, AHMD596_ALEN);    ipsec_xmit_dmp("octx+hash", (char*)&tctx.md5, sizeof(tctx.md5));    osMD5Final(hash, &tctx.md5);    ipsec_xmit_dmp("octx hash", (char*)&hash, sizeof(hash));        memcpy(ahp->ah_data, hash, AHHMAC_HASHLEN);        /* paranoid */    memset((caddr_t)&tctx.md5, 0, sizeof(tctx.md5));    memset((caddr_t)hash, 0, sizeof(*hash));    break;#endif /* CONFIG_KLIPS_AUTH_HMAC_MD5 */#ifdef CONFIG_KLIPS_AUTH_HMAC_SHA1  case AH_SHA:    tctx.sha1 = ((struct sha1_ctx*)(ixs->ipsp->ips_key_a))->ictx;    SHA1Update(&tctx.sha1, (unsigned char *)&ipo, sizeof (struct iphdr));    SHA1Update(&tctx.sha1, (unsigned char *)ahp, sizeof(struct ahhdr) - sizeof(ahp->ah_data));    SHA1Update(&tctx.sha1, (unsigned char *)zeroes, AHHMAC_HASHLEN);    SHA1Update(&tctx.sha1, dat + ixs->iphlen + sizeof(struct ahhdr),	       ixs->skb->len - ixs->iphlen - sizeof(struct ahhdr));    SHA1Final(hash, &tctx.sha1);    tctx.sha1 = ((struct sha1_ctx*)(ixs->ipsp->ips_key_a))->octx;    SHA1Update(&tctx.sha1, hash, AHSHA196_ALEN);    SHA1Final(hash, &tctx.sha1);        memcpy(ahp->ah_data, hash, AHHMAC_HASHLEN);        /* paranoid */    memset((caddr_t)&tctx.sha1, 0, sizeof(tctx.sha1));    memset((caddr_t)hash, 0, sizeof(*hash));    break;#endif /* CONFIG_KLIPS_AUTH_HMAC_SHA1 */  default:    ixs->stats->tx_errors++;    return IPSEC_XMIT_AH_BADALG;  }#ifdef NET_21  ixs->skb->h.raw = (unsigned char*)ahp;#endif /* NET_21 */  return IPSEC_XMIT_OK;}struct xform_functions ah_xform_funcs[]={	{	rcv_checks:         ipsec_rcv_ah_checks,		rcv_setup_auth:     ipsec_rcv_ah_setup_auth,		rcv_calc_auth:      ipsec_rcv_ah_authcalc,		rcv_decrypt:        ipsec_rcv_ah_decap,		xmit_setup:         ipsec_xmit_ah_setup,		xmit_headroom:      sizeof(struct ahhdr),		xmit_needtailroom:  0,	},};#ifdef NET_26struct inet_protocol ah_protocol = {  .handler = ipsec_rcv,  .no_policy = 1,};#elsestruct inet_protocol ah_protocol ={	ipsec_rcv,				/* AH handler */	NULL,				/* TUNNEL error control */#ifdef NETDEV_25	1,				/* no policy */#else	0,				/* next */	IPPROTO_AH,			/* protocol ID */	0,				/* copy */	NULL,				/* data */	"AH"				/* name */#endif};#endif /* NET_26 *//* * $Log: ipsec_ah.c,v $ * Revision 1.12.2.1  2006/02/15 05:35:14  paul * Patch by  David McCullough <davidm@snapgear.com> * If you setup a tunnel without ESP it doesn't work.  It used to work in * an older openswan version but stopped when klips was modified to deal * with the pulled IP header on the received SKB's. * * The code in ipsec_ah.c still thinks the IP header is there and runs the * hash on the incorrect data. * * Revision 1.12  2005/04/29 05:10:22  mcr * 	removed from extraenous includes to make unit testing easier. * * Revision 1.11  2005/04/15 19:50:55  mcr * 	adjustments to use proper skb fields for data. * * Revision 1.10  2004/09/14 00:22:57  mcr * 	adjustment of MD5* functions. * * Revision 1.9  2004/09/13 02:22:47  mcr * 	#define inet_protocol if necessary. * * Revision 1.8  2004/09/06 18:35:48  mcr * 	2.6.8.1 gets rid of inet_protocol->net_protocol compatibility, * 	so adjust for that. * * Revision 1.7  2004/08/22 05:00:48  mcr * 	if we choose to compile the file, we want the contents, * 	so don't pull any punches. * * Revision 1.6  2004/08/17 03:27:23  mcr * 	klips 2.6 edits. * * Revision 1.5  2004/08/14 03:28:24  mcr * 	fixed log comment to remove warning about embedded comment. * * Revision 1.4  2004/08/04 15:57:07  mcr * 	moved des .h files to include/des/ * * 	included 2.6 protocol specific things * 	started at NAT-T support, but it will require a kernel patch. * * Revision 1.3  2004/07/10 19:11:18  mcr * 	CONFIG_IPSEC -> CONFIG_KLIPS. * * Revision 1.2  2004/04/06 02:49:25  mcr * 	pullup of algo code from alg-branch. * * * */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人永久看片免费视频天堂| 另类中文字幕网| 国产欧美精品日韩区二区麻豆天美| 欧美色图激情小说| kk眼镜猥琐国模调教系列一区二区| 精品少妇一区二区三区视频免付费 | 亚洲成人免费在线观看| 亚洲欧美国产高清| 亚洲高清在线视频| 天天综合色天天综合色h| 亚洲18女电影在线观看| 五月天国产精品| 丝袜亚洲精品中文字幕一区| 亚洲亚洲人成综合网络| 天天av天天翘天天综合网色鬼国产 | 日欧美一区二区| 日韩av中文字幕一区二区三区| 亚洲精品在线三区| 久久精品在线观看| 亚洲欧美日韩成人高清在线一区| 欧美一区二区久久久| 日韩精品一区二区三区中文精品| 国产.精品.日韩.另类.中文.在线.播放| 亚洲欧洲日韩在线| 亚洲国产一二三| 久久99国产乱子伦精品免费| 一本大道av伊人久久综合| 成人av综合一区| 欧美日韩国产另类一区| 欧美一级久久久| 欧美精品一区二区三区高清aⅴ| 91精品国产欧美一区二区18| 884aa四虎影成人精品一区| 欧美成人一区二区三区在线观看| 99久久免费视频.com| 欧美日韩黄色影视| 国产女主播视频一区二区| 日韩美一区二区三区| 丝袜a∨在线一区二区三区不卡| 蜜桃视频在线一区| 欧美一区二区三区日韩| 蜜桃视频在线观看一区二区| 欧美日韩视频不卡| 日韩在线卡一卡二| 欧美一区二区免费观在线| 日韩va欧美va亚洲va久久| 欧美成人a视频| 国产精品亚洲一区二区三区妖精 | 国产精品久久精品日日| 成人精品gif动图一区| 中文字幕色av一区二区三区| 91免费视频网| 午夜精品一区二区三区三上悠亚| 国产成人午夜电影网| 国产日韩欧美激情| 91久久线看在观草草青青| 亚洲一区自拍偷拍| 精品久久一区二区三区| 99精品在线免费| 午夜亚洲福利老司机| 精品国产亚洲一区二区三区在线观看| 一区二区在线观看免费| 欧美精品 日韩| 国产综合色产在线精品| 国产精品久99| 欧美丰满少妇xxxbbb| 国产成人精品一区二区三区四区| 欧美一区二区日韩| 成人精品一区二区三区中文字幕| 欧美成人伊人久久综合网| 成人午夜视频免费看| 亚洲国产成人porn| 国产日韩欧美在线一区| 欧美猛男男办公室激情| 丁香婷婷综合激情五月色| 亚洲国产美女搞黄色| 久久久久国产精品麻豆ai换脸| 激情文学综合网| 国产精品久久久久久户外露出| 成人精品一区二区三区中文字幕| 久久无码av三级| 欧美性受极品xxxx喷水| 国产高清在线精品| 日韩avvvv在线播放| 亚洲色欲色欲www| 精品国产一区二区精华| 91视频免费观看| 国产麻豆精品在线观看| 午夜av区久久| 亚洲欧美一区二区三区孕妇| 久久综合网色—综合色88| 5858s免费视频成人| 色欧美片视频在线观看| 成人免费黄色在线| 国产精品1024| 免费人成黄页网站在线一区二区| 日韩免费观看高清完整版| 91久久奴性调教| 99久久精品国产网站| 国产精品乡下勾搭老头1| 免费日韩伦理电影| 日日噜噜夜夜狠狠视频欧美人| 91精品国产乱码久久蜜臀| 色又黄又爽网站www久久| 国产在线麻豆精品观看| 老司机免费视频一区二区三区| 久久综合久久综合久久综合| 欧美一区二区三区啪啪| 欧美日韩你懂得| 日本国产一区二区| 91在线观看免费视频| 成人一道本在线| 丰满放荡岳乱妇91ww| 国产成人av电影在线观看| 国产最新精品精品你懂的| 另类综合日韩欧美亚洲| 久久精品国产一区二区三区免费看| 久久久久久久久一| 欧美sm极限捆绑bd| 精品久久久久久亚洲综合网| 精品久久人人做人人爱| 欧美v亚洲v综合ⅴ国产v| 精品久久久久久无| 国产亚洲欧美色| 国产精品乱人伦| 亚洲色欲色欲www| 一区二区三区四区不卡在线 | 欧美一级二级三级蜜桃| 欧美一区二区三区四区视频| 欧美军同video69gay| 欧美一级午夜免费电影| 精品国产一区二区在线观看| 国产亚洲综合色| 亚洲欧洲av色图| 亚洲h动漫在线| 极品美女销魂一区二区三区 | 99精品国产91久久久久久| av在线综合网| 欧美视频日韩视频在线观看| 欧美日韩国产美| 精品成人一区二区三区| 中文字幕在线一区免费| 一区二区三区国产精华| 日本sm残虐另类| 国产精品亚洲视频| 欧美伊人久久久久久午夜久久久久| 国产成人综合网| 色先锋aa成人| 日韩一级二级三级精品视频| 26uuu久久综合| 自拍偷拍亚洲激情| 人人狠狠综合久久亚洲| 成人性生交大合| 欧美色爱综合网| 久久久久久综合| 五月综合激情日本mⅴ| 国产成人综合自拍| 欧美剧情片在线观看| 国产精品网曝门| 蜜桃视频免费观看一区| 99re热这里只有精品免费视频| 国产精品亚洲а∨天堂免在线| 丝瓜av网站精品一区二区| 国产一区二区美女诱惑| 欧洲精品中文字幕| 精品国精品国产| 亚洲综合男人的天堂| 国产激情视频一区二区在线观看| 久久激情综合网| 在线看国产一区| 国产女主播视频一区二区| 男人的j进女人的j一区| bt7086福利一区国产| 精品av久久707| 亚洲国产欧美在线| av影院午夜一区| 久久久久久久久久美女| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美妇女性影城| 亚洲日本在线天堂| 国产乱码精品一区二区三| 欧美日韩和欧美的一区二区| 亚洲免费观看高清完整版在线观看熊| 国产精品美女一区二区| 另类小说一区二区三区| 欧美午夜精品一区二区三区 | 亚洲精品高清在线观看| 国产老肥熟一区二区三区| 91精品国产色综合久久不卡蜜臀| 欧美成人精品1314www| 午夜精品成人在线视频| 欧美曰成人黄网| 亚洲欧洲日产国产综合网| 国产精品原创巨作av| 日韩欧美激情一区| 日本91福利区| 欧美一级片在线看| 美女一区二区在线观看| 777欧美精品| 日本最新不卡在线|