📄 zdsecmgr.lst
字号:
##############################################################################
# #
# IAR 8051 C/C++ Compiler V7.20H/W32 06/Nov/2008 11:25:03 #
# Copyright 2004-2006 IAR Systems. All rights reserved. #
# #
# Core = plain #
# Code model = banked #
# Data model = large #
# Calling convention = xdata reentrant #
# Constant location = data #
# Dptr setup = 1,16 #
# Source file = E:\解决\路由\Components\stack\zdo\ZDSecMgr.c #
# Command line = -f E:\解决\路由\Projects\zstack\Samples\SampleApp #
# \CC2430DB\..\..\..\Tools\CC2430DB\f8wCoord.cfg #
# (-DCPU32MHZ -DFORCE_MAC_NEAR -DROOT=__near_func #
# -DMAC_CFG_APP_PENDING_QUEUE=TRUE #
# -DZDO_COORDINATOR -DRTR_NWK -DBLINK_LEDS #
# "-DCONST=const __code" -DGENERIC=__generic) -f #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\Tools\CC2430DB\f8wConfig.cfg #
# (-DSECURE=0 -DDEFAULT_CHANLIST=0x00000800 #
# -DZDAPP_CONFIG_PAN_ID=0xFFFF #
# -DNWK_START_DELAY=100 -DEXTENDED_JOINING_RANDOM_M #
# ASK=0x007F -DBEACON_REQUEST_DELAY=100 #
# -DBEACON_REQ_DELAY_MASK=0x00FF #
# -DROUTE_EXPIRY_TIME=30 -DAPSC_ACK_WAIT_DURATION_P #
# OLLED=3000 -DNWK_INDIRECT_MSG_TIMEOUT=7 #
# -DMAX_RREQ_ENTRIES=10 -DAPSC_MAX_FRAME_RETRIES=3 #
# -DNWK_MAX_DATA_RETRIES=2 #
# -DMAX_POLL_FAILURE_RETRIES=2 -DMAX_BCAST=9 #
# -DAPS_MAX_GROUPS=16 -DMAX_RTG_ENTRIES=20 #
# -DNWK_MAX_BINDING_ENTRIES=10 #
# -DMAX_BINDING_CLUSTER_IDS=5 #
# "-DDEFAULT_KEY={0x01, 0x03, 0x05, 0x07, 0x09, #
# 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, #
# 0x0A, 0x0C, 0x0D}" -DRFD_RCVC_ALWAYS_ON=FALSE #
# -DPOLL_RATE=1000 -DQUEUED_POLL_RATE=100 #
# -DRESPONSE_POLL_RATE=100 -DREJOIN_POLL_RATE=440 #
# -DTOP_BOOT_PAGES=0) -I "D:\Program Files\IAR #
# Systems\Embedded Workbench 4.05 Evaluation #
# version\8051\inc\" -I "D:\Program Files\IAR #
# Systems\Embedded Workbench 4.05 Evaluation #
# version\8051\inc\clib\" -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\ -I E:\解决\路由\Projects\zstack\Samples\S #
# ampleApp\CC2430DB\..\Source\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\ZMain\TI2430DB\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\..\..\Components\mt\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\..\..\Components\hal\include\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\..\..\Components\hal\target\CC243 #
# 0DB\ -I E:\解决\路由\Projects\zstack\Samples\Samp #
# leApp\CC2430DB\..\..\..\..\..\Components\osal\mcu #
# \ccsoc\ -I E:\解决\路由\Projects\zstack\Samples\S #
# ampleApp\CC2430DB\..\..\..\..\..\Components\osal\ #
# include\ -I E:\解决\路由\Projects\zstack\Samples\ #
# SampleApp\CC2430DB\..\..\..\..\..\Components\stac #
# k\af\ -I E:\解决\路由\Projects\zstack\Samples\Sam #
# pleApp\CC2430DB\..\..\..\..\..\Components\stack\n #
# wk\ -I E:\解决\路由\Projects\zstack\Samples\Sampl #
# eApp\CC2430DB\..\..\..\..\..\Components\stack\sec #
# \ -I E:\解决\路由\Projects\zstack\Samples\SampleA #
# pp\CC2430DB\..\..\..\..\..\Components\stack\sys\ #
# -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
# \CC2430DB\..\..\..\..\..\Components\stack\zdo\ #
# -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
# \CC2430DB\..\..\..\..\..\Components\zmac\f8w\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\..\..\Components\zmac\ -I #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\..\..\..\..\..\Components\services\saddr\ #
# -I E:\解决\路由\Projects\zstack\Samples\SampleApp #
# \CC2430DB\..\..\..\..\..\Components\services\sdat #
# a\ -I E:\解决\路由\Projects\zstack\Samples\Sample #
# App\CC2430DB\..\..\..\..\..\Components\mac\includ #
# e\ -I E:\解决\路由\Projects\zstack\Samples\Sample #
# App\CC2430DB\..\..\..\..\..\Components\mac\high_l #
# evel\ -I E:\解决\路由\Projects\zstack\Samples\Sam #
# pleApp\CC2430DB\..\..\..\..\..\Components\mac\low #
# _level\srf03\ -I E:\解决\路由\Projects\zstack\Sam #
# ples\SampleApp\CC2430DB\..\..\..\..\..\Components #
# \mac\low_level\srf03\single_chip\ -D CC2430DB #
# -lC E:\解决\路由\Projects\zstack\Samples\SampleAp #
# p\CC2430DB\CoordinatorDB\List\ -lA #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\CoordinatorDB\List\ --diag_suppress #
# Pe001,Pa010 --diag_remark pe550 -o #
# E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\CoordinatorDB\Obj\ -e #
# --require_prototypes -z9 --no_code_motion #
# --debug --core=plain --dptr=16,1 #
# --data_model=large --code_model=banked #
# --calling_convention=xdata_reentrant #
# --place_constants=data --nr_virtual_regs 8 #
# E:\解决\路由\Components\stack\zdo\ZDSecMgr.c #
# List file = E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\CoordinatorDB\List\ZDSecMgr.lst #
# Object file = E:\解决\路由\Projects\zstack\Samples\SampleApp\CC #
# 2430DB\CoordinatorDB\Obj\ZDSecMgr.r51 #
# #
# #
##############################################################################
E:\解决\路由\Components\stack\zdo\ZDSecMgr.c
1 /******************************************************************************
2 Filename: ZDSecMgr.c
3 Revised: $Date: 2007-03-16 17:30:34 -0700 (Fri, 16 Mar 2007) $
4 Revision: $Revision: 13778 $
5
6 Description:
7
8 The ZigBee Device Security Manager.
9
10 Copyright (c) 2006 by Texas Instruments, Inc.
11 All Rights Reserved. Permission to use, reproduce, copy, prepare
12 derivative works, modify, distribute, perform, display or sell this
13 software and/or its documentation for any purpose is prohibited
14 without the express written consent of Texas Instruments, Inc.
15 ******************************************************************************/
16
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21
22 /******************************************************************************
23 * INCLUDES
24 */
25 #include "ZComdef.h"
26 #include "osal.h"
27 #include "ZGlobals.h"
28 #include "ssp.h"
29 #include "nwk_globals.h"
30 #include "nwk.h"
31 #include "NLMEDE.h"
32 #include "AddrMgr.h"
33 #include "AssocList.h"
34 #include "APSMEDE.h"
35 #include "AF.h"
36 #include "ZDConfig.h"
37 #include "ZDApp.h"
38 #include "ZDSecMgr.h"
39
40 /******************************************************************************
41 * CONSTANTS
42 */
43 // maximum number of devices managed by this Security Manager
44 #define ZDSECMGR_DEVICE_MAX 3
45
46 // total number of preconfigured devices (EXT address, MASTER key)
47 #define ZDSECMGR_PRECONFIG_MAX ZDSECMGR_DEVICE_MAX
48
49 // maximum number of MASTER keys this device may hold
50 #define ZDSECMGR_MASTERKEY_MAX ZDSECMGR_DEVICE_MAX
51
52 // maximum number of LINK keys this device may store
53 #define ZDSECMGR_ENTRY_MAX ZDSECMGR_DEVICE_MAX
54
55 // total number of devices under control - authentication, SKKE, etc.
56 #define ZDSECMGR_CTRL_MAX ZDSECMGR_DEVICE_MAX
57
58 // total number of restricted devices
59 #define ZDSECMGR_RESTRICTED_DEVICES 2
60
61 #define ZDSECMGR_CTRL_NONE 0
62 #define ZDSECMGR_CTRL_INIT 1
63 #define ZDSECMGR_CTRL_TK_MASTER 2
64 #define ZDSECMGR_CTRL_SKKE_INIT 3
65 #define ZDSECMGR_CTRL_SKKE_WAIT 4
66 #define ZDSECMGR_CTRL_SKKE_DONE 5
67 #define ZDSECMGR_CTRL_TK_NWK 6
68
69 #define ZDSECMGR_CTRL_BASE_CNTR 1
70 #define ZDSECMGR_CTRL_SKKE_INIT_CNTR 10
71 #define ZDSECMGR_CTRL_SKKE_WAIT_CNTR 100
72 #define ZDSECMGR_CTRL_TK_NWK_CNTR 10
73
74 // set SKKE slot maximum
75 #define ZDSECMGR_SKKE_SLOT_MAX 1
76
77 // APSME Stub Implementations
78 #define ZDSecMgrMasterKeyGet APSME_MasterKeyGet
79 #define ZDSecMgrLinkKeySet APSME_LinkKeySet
80 #define ZDSecMgrLinkKeyDataGet APSME_LinkKeyDataGet
81 #define ZDSecMgrKeyFwdToChild APSME_KeyFwdToChild
82
83 /******************************************************************************
84 * TYPEDEFS
85 */
86 typedef struct
87 {
88 uint8 extAddr[Z_EXTADDR_LEN];
89 uint8 key[SEC_KEY_LEN];
90 } ZDSecMgrPreConfigData_t;
91
92 typedef struct
93 {
94 uint16 ami;
95 uint8 key[SEC_KEY_LEN];
96 } ZDSecMgrMasterKeyData_t;
97
98 //should match APSME_LinkKeyData_t;
99 typedef struct
100 {
101 uint8 key[SEC_KEY_LEN];
102 APSME_LinkKeyData_t apsmelkd;
103 } ZDSecMgrLinkKeyData_t;
104
105 typedef struct
106 {
107 uint16 ami;
108 ZDSecMgrLinkKeyData_t lkd;
109 } ZDSecMgrEntry_t;
110
111 typedef struct
112 {
113 ZDSecMgrEntry_t* entry;
114 uint16 parentAddr;
115 uint8 secure;
116 uint8 state;
117 uint8 cntr;
118 //uint8 next;
119 } ZDSecMgrCtrl_t;
120
121 typedef struct
122 {
123 uint16 nwkAddr;
124 uint8* extAddr;
125 uint16 parentAddr;
126 uint8 secure;
127 ZDSecMgrCtrl_t* ctrl;
128 } ZDSecMgrDevice_t;
129
130 /******************************************************************************
131 * LOCAL VARIABLES
132 */
133 #if defined ( ZDSECMGR_SECURE ) && defined ( ZDO_COORDINATOR )
134 uint8 ZDSecMgrRestrictedDevices[ZDSECMGR_RESTRICTED_DEVICES][Z_EXTADDR_LEN] =
135 {
136 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
137 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
138 };
139 #endif // defined ( ZDSECMGR_SECURE ) && defined ( ZDO_COORDINATOR )
140
141 #if defined ( ZDSECMGR_COMMERCIAL )
142 #if ( ZDSECMGR_PRECONFIG_MAX != 0 )
143 const ZDSecMgrPreConfigData_t ZDSecMgrPreConfigData[ZDSECMGR_PRECONFIG_MAX] =
144 {
145 //---------------------------------------------------------------------------
146 // DEVICE A
147 //---------------------------------------------------------------------------
148 {
149 // extAddr
150 {0x7C,0x01,0x12,0x13,0x14,0x15,0x16,0x17},
151
152 // key
153 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
154 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
155 },
156 //---------------------------------------------------------------------------
157 // DEVICE B
158 //---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -