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