1 /** \file MainSecSm.h 2 * \brief RSN main security SM 3 * 4 * \see MainSecSm.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: MainSecSm.h */ 45 /* PURPOSE: RSN main security SM */ 46 /* */ 47 /***************************************************************************/ 48 49 #ifndef _MAIN_SEC_KEYS_ONLY_H 50 #define _MAIN_SEC_KEYS_ONLY_H 51 52 #include "fsm.h" 53 #include "mainSecSm.h" 54 55 /* Constants */ 56 57 /** number of events in the state machine */ 58 #define MAIN_SEC_KEYS_ONLY_NUM_EVENTS 4 59 60 /** number of states in the state machine */ 61 #define MAIN_SEC_KEYS_ONLY_NUM_STATES 4 62 63 /* Enumerations */ 64 65 /* state machine states */ 66 typedef enum 67 { 68 MAIN_KO_STATE_IDLE = 0, 69 MAIN_KO_STATE_START = 1, 70 MAIN_KO_STATE_AUTHORIZED = 2, 71 MAIN_KO_STATE_NONAUTHORIZED = 3, 72 } main_keysOnlyStates; 73 74 /* State machine inputs */ 75 typedef enum 76 { 77 MAIN_KO_EVENT_START = 0, 78 MAIN_KO_EVENT_STOP = 1, 79 MAIN_KO_EVENT_KEYS_COMPLETE = 2, 80 MAIN_KO_EVENT_SEC_ATTACK = 3 81 } main_keysOnlyEvents; 82 83 84 /* Typedefs */ 85 86 /* External data definitions */ 87 88 /* External functions definitions */ 89 90 /* Function prototypes */ 91 92 TI_STATUS mainSecKeysOnly_config(mainSec_t *pMainSec, 93 rsn_paeConfig_t *pPaeConfig); 94 95 TI_STATUS mainSecKeysOnly_start(mainSec_t *pMainSec); 96 97 TI_STATUS mainSecKeysOnly_stop(mainSec_t *pMainSec); 98 99 TI_STATUS mainSecKeysOnly_setSessionKey(mainSec_t *pMainSec, UINT8* pKey, UINT8 keyLen); 100 101 TI_STATUS mainSecKeysOnly_getSessionKey(mainSec_t *pMainSec, UINT8* pKey, UINT32* pKeyLen); 102 103 TI_STATUS mainSecKeysOnly_reportKeysStatus(mainSec_t *pMainSec, TI_STATUS keyStatus); 104 105 /* state machine functions */ 106 107 TI_STATUS mainSecKeysOnly_startIdle(struct _mainSec_t *pMainSec); 108 109 TI_STATUS mainSecKeysOnly_stopStart(struct _mainSec_t *pMainSec); 110 111 TI_STATUS mainSecKeysOnly_keysCompleteStart(struct _mainSec_t *pMainSec); 112 113 TI_STATUS mainSecKeysOnly_keysTOStart(struct _mainSec_t *pMainSec); 114 115 TI_STATUS mainSecKeysOnly_stopAuthorized(struct _mainSec_t *pMainSec); 116 117 TI_STATUS mainSecKeysOnly_stopNonAuthorized(struct _mainSec_t *pMainSec); 118 119 /* state machine action functions */ 120 121 TI_STATUS mainSecKeysOnly_StartMainKeySm(void* pData); 122 123 TI_STATUS mainSecKeysOnly_StopMainKeySm(void* pData); 124 125 TI_STATUS mainSecKeysOnly_ReportAuthSuccess(void* pData); 126 127 TI_STATUS mainSecKeysOnly_ReportAuthFailure(void* pData); 128 129 TI_STATUS mainSecKeysOnly_Nop(void* pData); 130 131 TI_STATUS mainSecKeysOnly_unexpected(void* pData); 132 133 #endif 134 135