/**************************************************************************************************
Filename: ZDSecMgr.c
Revised: $Date: 2010-01-08 13:29:59 -0800 (Fri, 08 Jan 2010) $
Revision: $Revision: 21465 $
Description: The ZigBee Device Security Manager.
Copyright 2005-2009 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/******************************************************************************
* INCLUDES
*/
#include "ZComdef.h"
#include "OSAL.h"
#include "OSAL_NV.h"
#include "ZGlobals.h"
#include "ssp.h"
#include "nwk_globals.h"
#include "nwk.h"
#include "NLMEDE.h"
#include "AddrMgr.h"
#include "AssocList.h"
#include "APSMEDE.h"
#include "AF.h"
#include "ZDConfig.h"
#include "ZDApp.h"
#include "ZDSecMgr.h"
/******************************************************************************
* CONSTANTS
*/
// maximum number of devices managed by this Security Manager
#if !defined ( ZDSECMGR_DEVICE_MAX )
#define ZDSECMGR_DEVICE_MAX 3
#endif
// total number of preconfigured devices (EXT address, MASTER key)
//devtag.pro.security
//#define ZDSECMGR_PRECONFIG_MAX ZDSECMGR_DEVICE_MAX
#define ZDSECMGR_PRECONFIG_MAX 0
// maximum number of MASTER keys this device may hold
#define ZDSECMGR_MASTERKEY_MAX ZDSECMGR_DEVICE_MAX
// maximum number of LINK keys this device may store
#define ZDSECMGR_ENTRY_MAX ZDSECMGR_DEVICE_MAX
// total number of devices under control - authentication, SKKE, etc.
#define ZDSECMGR_CTRL_MAX ZDSECMGR_DEVICE_MAX
// total number of stored devices
#if !defined ( ZDSECMGR_STORED_DEVICES )
#define ZDSECMGR_STORED_DEVICES 3
#endif
// Total number of preconfigured trust center link key
#if !defined ( ZDSECMGR_TC_DEVICE_MAX )
#define ZDSECMGR_TC_DEVICE_MAX 1
#endif
#if ( ZDSECMGR_TC_DEVICE_MAX < 1 ) || ( ZDSECMGR_TC_DEVICE_MAX > 255 )
#error "ZDSECMGR_TC_DEVICE_MAX shall be between 1 and 255 !"
#endif
#define ZDSECMGR_CTRL_NONE 0
#define ZDSECMGR_CTRL_INIT 1
#define ZDSECMGR_CTRL_TK_MASTER 2
#define ZDSECMGR_CTRL_SKKE_INIT 3
#define ZDSECMGR_CTRL_SKKE_WAIT 4
#define ZDSECMGR_CTRL_SKKE_DONE 5
#define ZDSECMGR_CTRL_SKKE_FAIL 6
#define ZDSECMGR_CTRL_TK_NWK 7
#define ZDSECMGR_CTRL_BASE_CNTR 1
#define ZDSECMGR_CTRL_SKKE_INIT_CNTR 1
#define ZDSECMGR_CTRL_TK_NWK_CNTR 1
// set SKA slot maximum
#define ZDSECMGR_SKA_SLOT_MAX 1
// APSME Stub Implementations
#define ZDSecMgrMasterKeyGet APSME_MasterKeyGet
#define ZDSecMgrLinkKeySet APSME_LinkKeySet
#define ZDSecMgrLinkKeyDataGet APSME_LinkKeyDataGet
#define ZDSecMgrKeyFwdToChild APSME_KeyFwdToChild
#if !defined( MAX_APS_FRAMECOUNTER_CHANGES )
// The number of times the frame counter can change before
// saving to NV
#define MAX_APS_FRAMECOUNTER_CHANGES 10
#endif
/******************************************************************************
* TYPEDEFS
*/
typedef struct
{
uint8 extAddr[Z_EXTADDR_LEN];
uint8 key[SEC_KEY_LEN];
} ZDSecMgrPreConfigData_t;
typedef struct
{
uint16 ami;
uint8 key[SEC_KEY_LEN];
} ZDSecMgrMasterKeyData_t;
//should match APSME_LinkKeyData_t;
typedef struct
{
uint8 key[SEC_KEY_LEN];
APSME_LinkKeyData_t apsmelkd;
} ZDSecMgrLinkKeyData_t;
typedef struct
{
uint16 ami;
ZDSecMgrLinkKeyData_t lkd;
ZDSecMgr_Authentication_Option authenticateOption;
} ZDSecMgrEntry_t;
typedef struct
{
ZDSecMgrEntry_t* entry;
uint16 parentAddr;
uint8 secure;
uint8 state;
uint8 cntr;
//uint8 next;
} ZDSecMgrCtrl_t;
typedef struct
{
uint16 nwkAddr;
uint8* extAddr;
uint16 parentAddr;
uint8 secure;
uint8 devStatus;
ZDSecMgrCtrl_t* ctrl;
} ZDSecMgrDevice_t;
/******************************************************************************
* LOCAL VARIABLES
*/
#if 0 // Taken out because the following functionality is only used for test
// purpose. A more efficient (above) way is used. It can be put
// back in if customers request for a white/black list feature.
uint8 ZDSecMgrStoredDeviceList[ZDSECMGR_STORED_DEVICES][Z_EXTADDR_LEN] =
{
{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
};
#endif
uint8 ZDSecMgrTCExtAddr[Z_EXTADDR_LEN]=
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8 ZDSecMgrTCMasterKey[SEC_KEY_LEN] =
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x89,0x67,0x45,0x23,0x01,0xEF,0xCD,0xAB};
uint8 ZDSecMgrTCAuthenticated = FALSE;
uint8 ZDSecMgrTCDataLoaded = FALSE;
//devtag.pro.security - remove this
#if ( ZDSECMGR_PRECONFIG_MAX != 0 )
const ZDSecMgrPreConfigData_t ZDSecMgrPreConfigData[ZDSECMGR_PRECONFIG_MAX] =
{
//---------------------------------------------------------------------------
// DEVICE A
//---------------------------------------------------------------------------
{
// extAddr
{0x7C,0x01,0x12,0x13,0x14,0x15,0x16,0x17},
// key
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
},
//---------------------------------------------------------------------------
// DEVICE B
//---------------------------------------------------------------------------
{
// extAddr
{0x84,0x03,0x00,0x00,0x00,0x4B,0x12,0x00},
// key
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
},
//---------------------------------------------------------------------------
// DEVICE C
//---------------------------------------------------------------------------
{
// extAddr
{0x3E,0x01,0x12,0x13,0x14,0x15,0x16,0x17},
// key
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
},
};
#endif // ( ZDSECMGR_PRECONFIG_MAX != 0 )
ZDSecMgrMasterKeyData_t* ZDSecMgrMasterKeyData = NULL;
ZDSecMgrEntry_t* ZDSecMgrEntries = NULL;
ZDSecMgrCtrl_t*
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计:这是一个关于智能家居的毕业设计,主要用到的技术有ZigBee、WiFi、Android。.zip (2000个子文件)
ZDSecMgr.c 101KB
ZDSecMgr.c 101KB
ZDSecMgr.c 101KB
ZDSecMgr.c 101KB
ZDSecMgr.c 101KB
zcl.c 101KB
zcl.c 101KB
zcl.c 101KB
zcl.c 101KB
zcl.c 101KB
zcl_general.c 94KB
zcl_general.c 94KB
zcl_general.c 94KB
zcl_general.c 94KB
zcl_general.c 94KB
ZDObject.c 86KB
ZDObject.c 86KB
ZDObject.c 86KB
ZDObject.c 86KB
ZDObject.c 86KB
zcl_key_establish.c 71KB
zcl_key_establish.c 71KB
zcl_key_establish.c 71KB
zcl_key_establish.c 71KB
zcl_key_establish.c 71KB
ZDApp.c 71KB
ZDApp.c 71KB
ZDApp.c 71KB
ZDApp.c 71KB
ZDApp.c 71KB
zcl_se.c 64KB
zcl_se.c 64KB
zcl_se.c 64KB
zcl_se.c 64KB
zcl_se.c 64KB
ZDProfile.c 61KB
ZDProfile.c 61KB
ZDProfile.c 61KB
ZDProfile.c 61KB
ZDProfile.c 61KB
esp.c 59KB
esp.c 59KB
esp.c 59KB
esp.c 59KB
esp.c 59KB
oad_app.c 59KB
oad_app.c 59KB
oad_app.c 59KB
oad_app.c 59KB
oad_app.c 59KB
MT_MAC.c 54KB
MT_MAC.c 54KB
MT_MAC.c 54KB
MT_MAC.c 54KB
MT_MAC.c 54KB
MT_ZDO.c 49KB
MT_ZDO.c 49KB
MT_ZDO.c 49KB
MT_ZDO.c 49KB
MT_ZDO.c 49KB
zcl_ss.c 46KB
zcl_ss.c 46KB
zcl_ss.c 46KB
zcl_ss.c 46KB
zcl_ss.c 46KB
simplemeter.c 41KB
simplemeter.c 41KB
simplemeter.c 41KB
simplemeter.c 41KB
simplemeter.c 41KB
mac_rx.c 40KB
mac_rx.c 40KB
mac_rx.c 40KB
mac_rx.c 40KB
mac_rx.c 40KB
zcl_lighting.c 36KB
zcl_lighting.c 36KB
zcl_lighting.c 36KB
zcl_lighting.c 36KB
zcl_lighting.c 36KB
ZDNwkMgr.c 35KB
ZDNwkMgr.c 35KB
ZDNwkMgr.c 35KB
ZDNwkMgr.c 35KB
ZDNwkMgr.c 35KB
OSAL_Nv.c 34KB
OSAL_Nv.c 34KB
OSAL_Nv.c 34KB
OSAL_Nv.c 34KB
OSAL_Nv.c 34KB
sapi.c 33KB
sapi.c 33KB
sapi.c 33KB
sapi.c 33KB
sapi.c 33KB
mac_csp_tx.c 33KB
mac_csp_tx.c 33KB
mac_csp_tx.c 33KB
mac_csp_tx.c 33KB
mac_csp_tx.c 33KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
九转成圣
- 粉丝: 5612
- 资源: 2962
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- RC振荡电路——文氏桥振荡电路(OP07仿真)_文氏桥振荡器-CSDN博客.mhtml
- vs2022安装包,推荐安装社区版
- 固件开发项目实例1000例实例(26)--智能家居安全系统的固件设计.docx
- 固件开发项目实例1000例实例(24)--智能健康手环的固件设计.docx
- 基于Simulink的小波变换滤波器.docx
- 吉林大学2024就业质量年度报告
- 常用工具:谷歌浏览器安装包
- FPC0.5立贴, footprint expert封装
- DigiShow 教程5 艺术灯光应用
- DigiShow 教程6 数码音乐应用
- pikachu-master.zip
- DigiShow 教程7 互动装置应用
- DigiShow 教程8 表达式和脚本
- Word自动填表组件-发票打印,报名表自动生成
- FPC0.5l立贴, footprint expert封装
- 复旦大学计算机网络课后习题及答案.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功