• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * mainKeysSm.h
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /** \file mainKeysSm.h
35  *  \brief RSN main security SM
36  *
37  *  \see mainKeysSm.c
38  */
39 
40 
41 /***************************************************************************/
42 /*																		   */
43 /*		MODULE:	mainKeysSm.h												   */
44 /*    PURPOSE:	RSN main security SM									   */
45 /*																	 	   */
46 /***************************************************************************/
47 
48 #ifndef _MAIN_KEYS_SM_H
49 #define _MAIN_KEYS_SM_H
50 
51 #include "paramOut.h"
52 #include "fsm.h"
53 #include "rsnApi.h"
54 #include "keyTypes.h"
55 #include "keyParser.h"
56 #include "unicastKeySM.h"
57 #include "broadcastKeySM.h"
58 
59 /* Constants */
60 
61 #define MAIN_KEYS_TIMEOUT			20000
62 
63 /* Enumerations */
64 
65 /* Typedefs */
66 
67 typedef struct _mainKeys_t    mainKeys_t;
68 
69 /* Main Sec SM functions */
70 typedef TI_STATUS (*mainKeysSmStart_t)(struct _mainKeys_t *pMainKeys);
71 typedef TI_STATUS (*mainKeysSmStop_t)(struct _mainKeys_t *pMainKeys);
72 typedef TI_STATUS (*mainKeysSmReportUcastStatus_t)(struct _mainKeys_t *pMainKeys, TI_STATUS authStatus);
73 typedef TI_STATUS (*mainKeysSmReportBcastStatus_t)(struct _mainKeys_t *pMainKeys, TI_STATUS authStatus);
74 typedef TI_STATUS (*mainKeysSmReportReKey_t)(struct _mainKeys_t *pMainKeys);
75 typedef TI_STATUS (*mainKeysSmSetKey_t)(struct _mainKeys_t *pMainKeys, TSecurityKeys *pKey);
76 typedef TI_STATUS (*mainKeysSmRemoveKey_t)(struct _mainKeys_t *pMainKeys, TSecurityKeys *pKey);
77 typedef TI_STATUS (*mainKeysSmSetDefaultKeyId_t)(struct _mainKeys_t *pMainKeys, TI_UINT8 keyId);
78 typedef TI_STATUS (*mainKeysSmGetSessionKey_t)(struct _mainKeys_t *pMainKeys, TI_UINT8 *pKey, TI_UINT32 *pKeyLen);
79 
80 /* Structures */
81 
82 typedef struct
83 {
84 	TI_STATUS		status;
85 } mainKeysData_t;
86 
87 struct _mainKeys_t
88 {
89 	TI_UINT8                            currentState;
90 	TI_UINT32                           keysTimeout;
91     mainKeysData_t						data;
92 	fsm_stateMachine_t	                *pMainKeysSm;
93     TI_BOOL			 	                mainKeysTimeoutCounter;
94 
95 	TI_HANDLE							hCtrlData;
96 	TI_HANDLE			                hReport;
97 	TI_HANDLE			                hOs;
98     TI_HANDLE                           hEvHandler;
99     TI_HANDLE                           hConn;
100     TI_HANDLE                           hRsn;
101 	TI_HANDLE							hTimer;
102 
103     TI_HANDLE							hSessionTimer;
104 
105 	keyParser_t							*pKeyParser;
106 	unicastKey_t						*pUcastSm;
107 	broadcastKey_t						*pBcastSm;
108     struct _mainSec_t                  	*pParent;
109 
110     mainKeysSmStart_t                   start;
111     mainKeysSmStop_t                    stop;
112     mainKeysSmReportUcastStatus_t		reportUcastStatus;
113     mainKeysSmReportBcastStatus_t       reportBcastStatus;
114     mainKeysSmReportReKey_t				reportReKey;
115 	mainKeysSmSetKey_t					setKey;
116 	mainKeysSmRemoveKey_t				removeKey;
117 	mainKeysSmSetDefaultKeyId_t			setDefaultKeyId;
118 	mainKeysSmGetSessionKey_t			getSessionKey;
119 };
120 
121 /* External data definitions */
122 
123 /* External functions definitions */
124 
125 /* Function prototypes */
126 
127 mainKeys_t* mainKeys_create(TI_HANDLE hOs);
128 
129 TI_STATUS mainKeys_unload(mainKeys_t *pmainKeys);
130 
131 TI_STATUS mainKeys_config (mainKeys_t    *pMainKeys,
132                            TRsnPaeConfig *pPaeConfig,
133                            void          *pParent,
134                            TI_HANDLE      hReport,
135                            TI_HANDLE      hOs,
136                            TI_HANDLE      hCtrlData,
137                            TI_HANDLE      hEvHandler,
138                            TI_HANDLE      hConn,
139                            TI_HANDLE      hRsn,
140                            TI_HANDLE      hTimer);
141 
142 void mainKeys_reAuth(TI_HANDLE pHandle);
143 
144 #endif
145 
146