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

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

?? radius_authorize.c

?? vxworks下radius協議棧 的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* radius_authorize.c *//* Implementations of encryption and decryption of RADIUS attributes if needed. *//* Currently we only encrypt User-Password and decrypt Tunnel-Password			*//* Copyright 1984 - 2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history____________________01f,26aug03,snd Changes done to remove compilation warnings01e,22mar02,md  Bug fix - zeroing out the wrong MA when EAP packet is larged01d,15mar02,md  Merge Mark's changes for EAP support01c,04mar02,md  Add support for EAP01b,27feb02,md  Add a fourth parameter to radius_accounting_fill_in_request_authenticator				to authenticate the accounting response from radius server01a,19dec00,md  merged from visual source safe*//************************************************************************//*	Copyright (C) 1993 - 1999 RouterWare, Inc.   						*//*	Unpublished - rights reserved under the Copyright Laws of the		*//*	United States.  Use, duplication, or disclosure by the 				*//*	Government is subject to restrictions as set forth in 				*//*	subparagraph (c)(1)(ii) of the Rights in Technical Data and 		*//*	Computer Software clause at 252.227-7013.							*//*	RouterWare, Inc., 3961 MacArthur Suite 212 Newport Beach, CA 92660	*//************************************************************************/#include <string.h>#include "radius.h"#include <rwutils.h>#ifdef __EAP__#include "radius_message_digest.h"#endif /* __EAP__ *//*****************************************************************************************/static bool do_radius_md5_encryption (BYTE *cptr_identifier, USHORT identifier_length, BYTE *p_secret, USHORT secret_length,	BYTE *p_data, USHORT data_length);static bool do_radius_md5_decryption (BYTE *cptr_identifier, USHORT identifier_length, BYTE *p_secret, USHORT secret_length,	BYTE *p_data, USHORT data_length);#ifdef __EAP__static bool radius_get_message_authenticator_attribute (RADIUS_PACKET *sptr_packet, BYTE* p_buffer,													  RADIUS_LIST_CONTROLLER* p_radius_attribute_list_controller);#endif /* __EAP__ *//*****************************************************************************************//* encrypts all attributes that need encryption - this is user_password only, right now */	enum TEST radius_encrypt_attributes_with_authenticator (RW_CONTAINER* p_attribute_list, BYTE *bptr_authenticator, 	RADIUS_SERVER* p_server){	RW_CONTAINER_ITERATOR attribute_iterator;	RADIUS_ATTRIBUTE_ENTRY *p_attribute;	RADIUS_ATTRIBUTE_ENTRY *sptr_new_attribute;	UINT new_attribute_value_length;	UINT new_attribute_entry_size;	bool encrypted ;	bool attribute_removed ;		encrypted = false;	attribute_iterator = rw_container_create_iterator (p_attribute_list);	rw_container_goto_front (attribute_iterator);		while (rw_container_is_at_end (attribute_iterator) == false)		{		p_attribute = rw_container_at (attribute_iterator);				attribute_removed = false; 		if (p_attribute->type == RADIUS_USER_PASSWORD)			{			if ((p_attribute->length_of_attribute_value % RADIUS_PASSWORD_MODULUS) != 0x00)				{				new_attribute_value_length = p_attribute->length_of_attribute_value + 					(RADIUS_PASSWORD_MODULUS - (p_attribute->length_of_attribute_value % RADIUS_PASSWORD_MODULUS));								new_attribute_entry_size = new_attribute_value_length + sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);								sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *) table_malloc (1, new_attribute_entry_size);				if (sptr_new_attribute == NULL)					{					rw_container_free_iterator (attribute_iterator);										return (FAIL);					}									memset ((BYTE *) sptr_new_attribute, 0, new_attribute_entry_size);								memcpy (sptr_new_attribute, p_attribute, (p_attribute->length_of_attribute_value + 						sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER)));								sptr_new_attribute->length_of_attribute_value = (BYTE) new_attribute_value_length;								rw_container_remove (attribute_iterator);				table_free (p_attribute);				attribute_removed = true;								rw_container_add_front (p_attribute_list, (RW_CONTAINER_ITEM*) sptr_new_attribute);				p_attribute = sptr_new_attribute;				}			encrypted = do_radius_md5_encryption (bptr_authenticator, RADIUS_SIZE_OF_AUTHENTICATOR, p_server->bp_secret, 				(USHORT) p_server->secret_length, (BYTE *)&p_attribute->value[0], (USHORT) p_attribute->length_of_attribute_value);					if (encrypted == false)				{				rw_container_free_iterator (attribute_iterator);								return (FAIL);				}			}		if (attribute_removed == false)			{			rw_container_next (attribute_iterator);			}		}	rw_container_free_iterator (attribute_iterator);	return (PASS);} /*****************************************************************************************//* Decrypts all attributes that need encryption - this is tunnel_password only, right now */	enum TEST radius_decrypt_attributes_with_authenticator (RW_CONTAINER* p_attribute_list, BYTE *bptr_authenticator, 	RADIUS_SERVER* p_server){	RW_CONTAINER_ITERATOR attribute_iterator;	RADIUS_ATTRIBUTE_ENTRY *p_attribute;	RADIUS_ATTRIBUTE_ENTRY *sptr_new_attribute;	UINT new_attribute_value_length;	UINT new_attribute_entry_size;	BYTE *bptr_new_authenticator;	UINT new_authenticator_length;	bool decrypted ;#ifdef __EAP__    int headerLen;    int saltPos;    UINT32 vendorId;#endif /* __EAP__ */	decrypted = false;	attribute_iterator = rw_container_create_iterator (p_attribute_list);	rw_container_goto_front (attribute_iterator);		while (rw_container_is_at_end (attribute_iterator) == false)		{		p_attribute = (RADIUS_ATTRIBUTE_ENTRY *)rw_container_at (attribute_iterator);		if (p_attribute->type == RADIUS_TUNNEL_PASSWORD)			{			rw_container_remove (attribute_iterator);			new_authenticator_length = RADIUS_SIZE_OF_AUTHENTICATOR + TUNNEL_PASSWORD_SALT_LENGTH;							bptr_new_authenticator = (BYTE *) table_malloc (1, new_authenticator_length);			if (bptr_new_authenticator == NULL)				{				rw_container_free_iterator (attribute_iterator);							return (FAIL);				}								memset ((BYTE *) bptr_new_authenticator, 0, new_authenticator_length);							memcpy (bptr_new_authenticator, bptr_authenticator, RADIUS_SIZE_OF_AUTHENTICATOR);			memcpy (bptr_new_authenticator + RADIUS_SIZE_OF_AUTHENTICATOR, (BYTE *)&p_attribute->value[TUNNEL_ATTRIBUTE_TAG_LENGTH], TUNNEL_PASSWORD_SALT_LENGTH);			if (((p_attribute->length_of_attribute_value - TUNNEL_PASSWORD_SALT_LENGTH - 				TUNNEL_ATTRIBUTE_TAG_LENGTH) % RADIUS_PASSWORD_MODULUS) == 0x00)				{				decrypted = do_radius_md5_decryption (bptr_new_authenticator, new_authenticator_length, 					p_server->bp_secret, (USHORT) p_server->secret_length, 					(BYTE *)&p_attribute->value[TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH], 					(USHORT) p_attribute->length_of_attribute_value - TUNNEL_PASSWORD_SALT_LENGTH - TUNNEL_ATTRIBUTE_TAG_LENGTH);				table_free (bptr_new_authenticator);				if (decrypted == false)					{					rw_container_free_iterator (attribute_iterator);					return (FAIL);					}						new_attribute_value_length = TUNNEL_ATTRIBUTE_TAG_LENGTH + 					(UINT)p_attribute->value[TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH];								new_attribute_entry_size = new_attribute_value_length + sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);								sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *) table_malloc (1, new_attribute_entry_size);				if (sptr_new_attribute == NULL)					{					rw_container_free_iterator (attribute_iterator);										return (FAIL);					}				memset ((BYTE *) sptr_new_attribute, 0, new_attribute_entry_size);				sptr_new_attribute->type = p_attribute->type;				sptr_new_attribute->length_of_attribute_value = (BYTE) new_attribute_value_length;								memcpy (&(sptr_new_attribute->value [0]),&(p_attribute->value [0]), TUNNEL_ATTRIBUTE_TAG_LENGTH);				memcpy (&(sptr_new_attribute->value [TUNNEL_ATTRIBUTE_TAG_LENGTH]), 					&(p_attribute->value [TUNNEL_PASSWORD_SALT_LENGTH + TUNNEL_ATTRIBUTE_TAG_LENGTH + 1]), 						new_attribute_value_length - TUNNEL_ATTRIBUTE_TAG_LENGTH);				rw_container_insert (attribute_iterator, (RW_CONTAINER_ITEM*) sptr_new_attribute);				table_free (p_attribute);				sptr_new_attribute = NULL;				}			}#ifdef __EAP__        if (p_attribute->type == RADIUS_VENDOR_SPECIFIC)            {            /* vendor id - 4 bytes */            /* vendor type - 1 byte */            /* vendor length - 1 byte */            /* salt - 2 bytes */            /* key length - 1 byte */            /* key - depend on key length */            headerLen = VENDOR_SPECIFIC_ID_LENGTH +                        VENDOR_TYPE_LENGTH +                        VENDOR_LENGTH;            /* retrieve the vendor ID */            bcopy((BYTE *)&p_attribute->value[0],                  (char *)&vendorId,                  4);            vendorId = ntohl(vendorId);            if (vendorId == VENDOR_ID_CISCO)                {                char sKeyId[] = "leap:session-key=";                /* the Cisco key message has this format:                  *------------------------------------------------------------                 *vendorType | vendorLen |"leap:session-key="|Salt|Key string |                 *------------------------------------------------------------                 */                /* make sure this is a session key message */                if (memcmp((BYTE *)&p_attribute->value[headerLen],                    sKeyId,strlen(sKeyId)))                    {                    /* not a key message */                    rw_container_next (attribute_iterator);                     continue;                    }                /* calculate the Salt position */                saltPos = headerLen + strlen(sKeyId);                }            else if (vendorId == VENDOR_ID_MICROSOFT)                {                /* the Microsoft key message has this format:                  *------------------------------------------------------------                 *vendorType | vendorLen |Salt|           Key string                   *------------------------------------------------------------                 */                /* make sure it is the key types */                if ((p_attribute->value[VENDOR_SPECIFIC_ID_LENGTH] !=                    VENDOR_TYPE_MS_MPPE_SEND_KEY) &&                    (p_attribute->value[VENDOR_SPECIFIC_ID_LENGTH] !=                    VENDOR_TYPE_MS_MPPE_RECV_KEY))                    {                    /* not a key message */		    rw_container_next (attribute_iterator);                    continue;                    }                saltPos = headerLen;                }            else                {                /* not supported for now */                printf("RADIUS: Not supported VendorID\n");		rw_container_next (attribute_iterator);                continue;                }            new_authenticator_length =                RADIUS_SIZE_OF_AUTHENTICATOR +                VENDOR_SALT_LENGTH;            bptr_new_authenticator = (BYTE *) table_malloc (1,                          new_authenticator_length);            if (bptr_new_authenticator == NULL)                {                rw_container_free_iterator (attribute_iterator);                return (FAIL);                }            memset ((BYTE *) bptr_new_authenticator, 0,                  new_authenticator_length);                        /* copy request authenticator */            memcpy (bptr_new_authenticator, bptr_authenticator,                RADIUS_SIZE_OF_AUTHENTICATOR);            /* retrieve the salt value */            bcopy(&p_attribute->value[saltPos],                  bptr_new_authenticator + RADIUS_SIZE_OF_AUTHENTICATOR,                  VENDOR_SALT_LENGTH);            /* check the integrity of the encrypted key string */            if (((p_attribute->length_of_attribute_value - saltPos-                 VENDOR_SALT_LENGTH) %                  RADIUS_PASSWORD_MODULUS) == 0x00)                 {                 decrypted = do_radius_md5_decryption (                      bptr_new_authenticator,                       new_authenticator_length,                       p_server->bp_secret,                       (USHORT) p_server->secret_length,                       (BYTE *)&p_attribute->value[saltPos +                      VENDOR_SALT_LENGTH],                       (USHORT) p_attribute->length_of_attribute_value -                        saltPos - VENDOR_SALT_LENGTH);                 /* after decryption the key string should have                   * key length field + key field + padding                  */                 if (decrypted == false)                     {                     rw_container_free_iterator (attribute_iterator);                     return (FAIL);                     }                         /* new attr len =  header len + real key len */                 new_attribute_value_length = headerLen +                            (UINT)p_attribute->value[saltPos +                             VENDOR_SALT_LENGTH];                 new_attribute_entry_size = new_attribute_value_length +                                   sizeof (RADIUS_MESSAGE_ATTRIBUTE_HEADER);                 sptr_new_attribute = (RADIUS_ATTRIBUTE_ENTRY *)                                 table_malloc (1, new_attribute_entry_size);                 if (sptr_new_attribute == NULL)                     {                     rw_container_free_iterator(attribute_iterator);                     return (FAIL);                     }                 memset ((BYTE *) sptr_new_attribute, 0,                          new_attribute_entry_size);                 sptr_new_attribute->type = p_attribute->type;                 sptr_new_attribute->length_of_attribute_value =                               (BYTE) new_attribute_value_length;                 /* copy original attribute's header */                 memcpy (&(sptr_new_attribute->value [0]),                                   &(p_attribute->value [0]),                                   headerLen);                 /* copy the decrypted key */                 memcpy (&(sptr_new_attribute->value[headerLen]),                         &(p_attribute->value[saltPos +                            VENDOR_SALT_LENGTH +                           VENDOR_KEY_LENGTH]),                         new_attribute_value_length - headerLen);                 /* now set the vendor length field */                 sptr_new_attribute->value[VENDOR_SPECIFIC_ID_LENGTH +							VENDOR_TYPE_LENGTH] =                            new_attribute_value_length -                            VENDOR_SPECIFIC_ID_LENGTH;                 /* remove the original attribute */                 rw_container_remove (attribute_iterator);                  /* insert this newly created attribute */                 rw_container_insert (attribute_iterator,                                (RW_CONTAINER_ITEM*) sptr_new_attribute);                 /* free the memory of the original attribute */                 table_free (p_attribute);                 sptr_new_attribute = NULL;                 }             table_free (bptr_new_authenticator);            }#endif /* __EAP__ */		rw_container_next (attribute_iterator);		}	rw_container_free_iterator (attribute_iterator);	return (PASS);}/*****************************************************************************************//* uses the request authenticator, and the response packet, to authenticate the   response authenticator.  refer to draft rfc for details */enum TEST verify_radius_response_authenticator (RADIUS_PACKET *sptr_rx_packet, BYTE *bptr_authenticator, RADIUS_SERVER* p_server){	BYTE *bptr_authentication_string;	RADIUS_PACKET *sptr_packet;	USHORT packet_length;	USHORT buffer_length;	BYTE md5_result[MD5_RESULT_LENGTH];	packet_length = swap (sptr_rx_packet->header.length);	buffer_length = (USHORT) (packet_length + p_server->secret_length);	bptr_authentication_string = (BYTE *) table_malloc (1, buffer_length);	if (bptr_authentication_string == NULL)		{		return (FAIL);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品色噜噜| 综合自拍亚洲综合图不卡区| 日韩精品资源二区在线| 欧美成人r级一区二区三区| 久久久亚洲高清| 国产精品电影院| 亚洲午夜视频在线| 韩国三级在线一区| www.日韩av| 日韩欧美国产午夜精品| 日韩免费观看高清完整版在线观看| 精品国产欧美一区二区| 欧美性猛交xxxxxx富婆| 91在线免费视频观看| 精品国产伦一区二区三区免费 | 中文字幕成人在线观看| 亚洲成人777| 色综合av在线| 国产精品综合一区二区| 美女国产一区二区三区| 国产成人综合亚洲网站| 日本高清视频一区二区| 亚洲国产精品精华液2区45| 日本91福利区| 在线成人av影院| 亚洲高清视频的网址| 日本高清视频一区二区| 1区2区3区国产精品| 国产成人综合网站| 久久香蕉国产线看观看99| 琪琪久久久久日韩精品| 欧美精品久久天天躁| 亚洲成人动漫av| 欧美日韩精品免费观看视频 | 国产精品99久久久久| 7777精品久久久大香线蕉| 性欧美大战久久久久久久久| 在线免费精品视频| 亚洲一二三四区| 欧美日精品一区视频| 亚洲色图丝袜美腿| 日本韩国视频一区二区| 一区二区三区在线视频播放 | 成人国产电影网| 中文一区在线播放| 成人激情图片网| 中文字幕在线不卡一区| 本田岬高潮一区二区三区| 亚洲欧美在线观看| 色视频一区二区| 天堂va蜜桃一区二区三区| 在线成人高清不卡| 国产综合色视频| 国产精品网站在线观看| av激情亚洲男人天堂| 亚洲综合图片区| 欧美一级二级三级乱码| 国产精品一区2区| 亚洲精品日韩一| 欧美巨大另类极品videosbest| 日韩av一区二区在线影视| 精品国产乱码久久久久久浪潮| 成人网在线免费视频| 亚洲美女偷拍久久| 日韩一级精品视频在线观看| 国产福利精品一区| 又紧又大又爽精品一区二区| 欧美日韩一区二区三区四区 | 亚洲与欧洲av电影| 91精品国产综合久久香蕉的特点| 国产一区二区影院| 一区二区三区蜜桃网| 欧美一区二区三区在线观看视频 | 欧美高清在线一区| 在线观看亚洲精品视频| 久久成人av少妇免费| 国产精品久久久久久久久久久免费看| 欧美主播一区二区三区美女| 极品少妇一区二区| 一区二区激情视频| 国产欧美日韩亚州综合| 欧美在线视频日韩| 成人av网在线| 精品亚洲国内自在自线福利| 亚洲另类在线制服丝袜| 久久综合一区二区| 欧美日韩免费高清一区色橹橹| 国产精品99久久久久久宅男| 亚洲高清久久久| 日本系列欧美系列| 国产精品丝袜黑色高跟| 日韩午夜小视频| 一本一道久久a久久精品| 韩国视频一区二区| 日本伊人色综合网| 亚洲大片精品永久免费| 欧美国产激情一区二区三区蜜月| 在线综合+亚洲+欧美中文字幕| 91美女在线观看| 国产成人精品一区二区三区四区| 美国一区二区三区在线播放| 夜夜嗨av一区二区三区中文字幕 | 日韩av中文在线观看| 亚洲国产成人一区二区三区| 日韩免费成人网| 91麻豆精品国产91久久久使用方法 | 欧洲精品视频在线观看| 成人黄色av电影| 国产精品一区二区久久精品爱涩| 久久99日本精品| 免费av网站大全久久| 亚洲va欧美va人人爽午夜| 亚洲一区二区三区精品在线| 综合久久一区二区三区| 国产精品三级视频| 国产精品色婷婷| 一色桃子久久精品亚洲| 国产精品另类一区| 国产精品乱码人人做人人爱| 欧美国产禁国产网站cc| 国产精品欧美极品| 国产精品久久久久久久久免费桃花| 国产欧美va欧美不卡在线| 久久丝袜美腿综合| 日本一区二区综合亚洲| 欧美高清在线一区二区| 国产精品久久久久精k8| 成人欧美一区二区三区1314| 18成人在线观看| 一区二区三区四区高清精品免费观看| 亚洲小说欧美激情另类| 午夜精品免费在线| 蜜桃视频在线一区| 国产成人免费xxxxxxxx| 粉嫩高潮美女一区二区三区| 97久久人人超碰| 欧美日本韩国一区二区三区视频| 欧美一卡2卡3卡4卡| 久久女同性恋中文字幕| 日本一区二区综合亚洲| 亚洲免费观看高清完整版在线| 婷婷综合在线观看| 国产一区二区精品久久| 成人高清在线视频| 欧美日韩国产小视频| 久久久噜噜噜久久人人看| 亚洲色图制服丝袜| 日本最新不卡在线| 成人激情开心网| 欧美日韩国产中文| 日本一区二区久久| 亚洲高清视频的网址| 国产精品一区二区久激情瑜伽 | 亚洲男女毛片无遮挡| 亚洲与欧洲av电影| 国产一区二区美女诱惑| 日本韩国欧美在线| 久久尤物电影视频在线观看| 亚洲精品菠萝久久久久久久| 日本欧美在线观看| 成人午夜激情在线| 欧美一区二区三区男人的天堂 | 国产欧美综合色| 一卡二卡三卡日韩欧美| 精品在线播放免费| 欧洲精品中文字幕| 欧美激情综合五月色丁香小说| 午夜天堂影视香蕉久久| 成人深夜在线观看| 91精品国产乱码| 亚洲美女免费在线| 国产精品亚洲午夜一区二区三区 | 国产日韩欧美亚洲| 日本美女一区二区三区视频| 99久久精品国产毛片| 精品久久国产字幕高潮| 亚洲国产精品影院| 成人午夜大片免费观看| 日韩美一区二区三区| 亚洲成人福利片| 一本一道久久a久久精品| 国产欧美日韩另类一区| 精彩视频一区二区三区 | 91久久免费观看| 中文字幕一区二区5566日韩| 黄色精品一二区| 日韩一区二区免费视频| 亚洲一区二区在线观看视频| 99在线精品免费| 欧美韩国日本综合| 福利电影一区二区三区| 久久久久国产精品厨房| 久久国产尿小便嘘嘘尿| 欧美一区二区在线播放| 亚洲va国产va欧美va观看| 在线中文字幕一区二区| 一二三区精品视频| 在线观看视频一区二区| 一区二区三区在线观看网站| 91日韩在线专区|