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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ipsec_ah.c

?? This a good VPN source
?? 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.10 2004/09/14 00:22:57 mcr 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 */#ifdef NET_21# include <asm/uaccess.h># include <linux/in6.h># define proto_priv cb#endif /* NET21 */#include <asm/checksum.h>#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->data + irs->iphlen);	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->data + irs->iphlen + ahhlen,		      skb->len - irs->iphlen - 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->data + ahhlen),		(void *)(skb->data), 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);	irs->ipp = (struct iphdr *)skb->data;	ipsec_rcv_dmp("ah postpull", skb->data, 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.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. * * * */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2024国产精品| 欧美一区二区黄色| 一区二区在线观看视频| 色噜噜狠狠成人中文综合| 亚洲精品国产一区二区精华液 | 成人午夜电影小说| 中文字幕一区二区日韩精品绯色| 成人黄色av电影| 亚洲欧美日韩中文播放| 欧美中文一区二区三区| 免费一区二区视频| 久久日韩粉嫩一区二区三区| 成人av高清在线| 亚洲一区免费视频| 日韩精品在线网站| 成人美女视频在线观看18| 亚洲欧美日韩成人高清在线一区| 欧美日韩一区成人| 久色婷婷小香蕉久久| 国产精品三级电影| 欧洲一区在线电影| 精品一区二区三区免费观看| 国产精品拍天天在线| 欧日韩精品视频| 精品无人码麻豆乱码1区2区| 中文字幕综合网| 欧美一区二区三区喷汁尤物| 风间由美一区二区三区在线观看 | 成人免费看黄yyy456| 亚洲地区一二三色| 欧美精品一区二区不卡| 91在线观看地址| 久久99精品视频| 一区二区三区日韩欧美精品| 欧美变态口味重另类| 色综合天天综合网天天狠天天| 喷水一区二区三区| 亚洲视频一区二区在线观看| 91精品国产色综合久久不卡蜜臀 | 欧美在线看片a免费观看| 国产一区在线视频| 亚洲另类在线一区| 久久欧美中文字幕| 欧美精品日日鲁夜夜添| 99久久99久久精品免费观看 | 国内成人精品2018免费看| 亚洲欧美视频在线观看视频| 久久在线观看免费| 欧美日韩国产中文| 波多野结衣精品在线| 久久99九九99精品| 日韩精品欧美精品| 亚洲专区一二三| 国产精品久久久久天堂| 久久久久国色av免费看影院| 欧美一区二区大片| 8x8x8国产精品| 91福利资源站| 色综合久久久久| 丁香五精品蜜臀久久久久99网站| 男男gaygay亚洲| 石原莉奈在线亚洲二区| 樱花影视一区二区| 综合在线观看色| 欧美国产精品一区| 国产亚洲美州欧州综合国| 日韩女优电影在线观看| 欧美日韩不卡视频| 欧美视频一区二区| 欧美性猛交一区二区三区精品| 91麻豆精东视频| 99国内精品久久| 97久久超碰国产精品| 成人听书哪个软件好| 成人午夜激情视频| 91在线视频免费91| 色综合久久久久网| 欧美视频你懂的| 欧美挠脚心视频网站| 911精品产国品一二三产区| 欧美性色黄大片手机版| 欧美精选一区二区| 欧美一区二区视频在线观看 | 99免费精品在线| 99久久精品国产一区| 91伊人久久大香线蕉| 欧美无人高清视频在线观看| 欧美在线999| 日韩欧美在线123| 精品久久久久一区| 国产视频一区二区三区在线观看| 中文字幕精品在线不卡| 亚洲国产精品av| 中文字幕日韩精品一区| 亚洲免费三区一区二区| 香蕉成人啪国产精品视频综合网 | 国产高清久久久| 成人午夜精品在线| 在线亚洲精品福利网址导航| 欧美日韩二区三区| 欧美不卡一区二区三区| 中文字幕在线一区| 亚洲综合久久久| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品一区二区三区蜜桃| 国产999精品久久| 91精品1区2区| 日韩一级片网站| 国产三级精品视频| 一区二区免费看| 久久91精品久久久久久秒播| 国产91色综合久久免费分享| 日本精品视频一区二区三区| 91精品国产综合久久香蕉麻豆| 2023国产精品| 亚洲一区在线观看视频| 久草中文综合在线| 91蜜桃视频在线| 精品福利av导航| 亚洲欧洲综合另类| 狠狠色2019综合网| 色激情天天射综合网| 日韩精品一区二区三区在线播放| 亚洲区小说区图片区qvod| 六月婷婷色综合| jlzzjlzz亚洲女人18| 欧美一区二区私人影院日本| 国产精品护士白丝一区av| 天天操天天色综合| 波多野结衣中文字幕一区二区三区| 欧美日韩一本到| 国产精品精品国产色婷婷| 免费xxxx性欧美18vr| 91黄视频在线| 久久九九久精品国产免费直播| 亚洲国产综合91精品麻豆| 国产一区二区在线视频| 欧美熟乱第一页| 亚洲视频在线一区二区| 国产精品一区一区三区| 欧美日韩亚洲丝袜制服| 国产精品卡一卡二卡三| 激情都市一区二区| 在线播放日韩导航| 亚洲精品老司机| 不卡在线视频中文字幕| 国产日韩欧美综合在线| 毛片av中文字幕一区二区| 欧美色网一区二区| 亚洲美女少妇撒尿| 99视频国产精品| 国产精品人妖ts系列视频 | 精品久久久网站| 亚洲超碰精品一区二区| 91免费在线播放| 国产精品美女久久久久久| 激情五月婷婷综合| 日韩欧美一区二区不卡| 亚洲国产一区在线观看| 色婷婷亚洲精品| 一区二区三区产品免费精品久久75| 成年人网站91| 综合婷婷亚洲小说| 99re热视频这里只精品| 综合欧美亚洲日本| 91麻豆国产精品久久| 一区二区三区四区乱视频| 91在线丨porny丨国产| 国产精品第一页第二页第三页| 成人自拍视频在线| 国产精品全国免费观看高清| 韩国中文字幕2020精品| 2021中文字幕一区亚洲| 国产成人自拍网| 国产精品毛片久久久久久久| gogogo免费视频观看亚洲一| 国产精品麻豆欧美日韩ww| 成人av电影在线| 亚洲精品免费在线观看| 欧美系列亚洲系列| 秋霞国产午夜精品免费视频| 日韩欧美一区二区久久婷婷| 国产在线精品免费av| 国产视频一区二区在线| www.欧美色图| 亚洲综合成人网| 日韩久久免费av| 波多野洁衣一区| 亚洲国产精品久久一线不卡| 在线成人午夜影院| 激情欧美一区二区| 国产欧美一区二区精品性| jiyouzz国产精品久久| 亚洲一区二区三区视频在线| 欧美一区二区三区人| 成人动漫在线一区| 午夜亚洲国产au精品一区二区| 精品久久五月天| 色综合一区二区三区| 免费三级欧美电影|