Home | History | Annotate | Download | only in Connection_Managment
      1 /*
      2  * mainSecSm.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 MainSecSm.h
     35  *  \brief RSN main security SM
     36  *
     37  *  \see MainSecSm.c
     38  */
     39 
     40 
     41 /***************************************************************************/
     42 /*																		   */
     43 /*		MODULE:	MainSecSm.h												   */
     44 /*    PURPOSE:	RSN main security SM									   */
     45 /*																	 	   */
     46 /***************************************************************************/
     47 
     48 #ifndef _MAIN_SEC_SM_H
     49 #define _MAIN_SEC_SM_H
     50 
     51 #include "paramOut.h"
     52 #include "fsm.h"
     53 #include "rsnApi.h"
     54 #include "rsn.h"
     55 #include "keyTypes.h"
     56 
     57 /* Constants */
     58 
     59 /* Enumerations */
     60 
     61 /* Typedefs */
     62 
     63 typedef struct _mainSec_t    mainSec_t;
     64 
     65 /* Main Sec SM functions */
     66 typedef TI_STATUS (*mainSecSmStart_t)(struct _mainSec_t *pMainSec);
     67 typedef TI_STATUS (*mainSecSmStop_t)(struct _mainSec_t *pMainSec);
     68 typedef TI_STATUS (*mainSecSmReportAuthStatus_t)(struct _mainSec_t *pMainSec, TI_STATUS authStatus);
     69 typedef TI_STATUS (*mainSecSmReportKeysStatus_t)(struct _mainSec_t *pMainSec, TI_STATUS keyStatus);
     70 typedef TI_STATUS (*mainSecSmReportReauthentication_t)(struct _mainSec_t *pMainSec);
     71 typedef TI_STATUS (*mainSecSmSetSessionKey_t)(struct _mainSec_t *pMainSec, TI_UINT8* pKey, TI_UINT8 keyLen);
     72 typedef TI_STATUS (*mainSecSmGetSessionKey_t)(struct _mainSec_t *pMainSec, TI_UINT8* pKey, TI_UINT32* pKeyLen);
     73 typedef TI_STATUS (*mainSecSmSetKey_t)(struct _mainSec_t *pMainSec, TSecurityKeys *pKey);
     74 typedef TI_STATUS (*mainSecSmRemoveKey_t)(struct _mainSec_t *pMainSec, TSecurityKeys *pKey);
     75 typedef TI_STATUS (*mainSecSmSetDefaultKeyId_t)(struct _mainSec_t *pMainSec, TI_UINT8 keyId);
     76 typedef TI_STATUS (*mainSecSmEapolRecv_t)(struct _mainSec_t *pMainSec, TI_UINT8 *pPacket);
     77 typedef TI_STATUS (*mainSecSm_getAuthIdentity_t)(struct _mainSec_t *pMainSec, authIdentity_t *authIdentity);
     78 typedef TI_STATUS (*mainSecSm_getAuthState_t)(struct _mainSec_t *pMainSec, TIWLN_SECURITY_STATE *secState);
     79 typedef TI_STATUS (*mainSecSm_reportAuthFailure_t)(struct _mainSec_t *pMainSec, EAuthStatus authStatus);
     80 
     81 /* Structures */
     82 
     83 typedef struct
     84 {
     85 	TRsnPaeConfig   		*pPaeConfig;
     86 	TI_UINT32				heldPeriod;
     87 	TI_UINT32				startPeriod;
     88 	TI_UINT32				authPeriod;
     89 	TI_UINT32				maxStart;
     90 	TI_UINT8				*pUserId;
     91 	TI_UINT8				idLen;
     92 	TI_UINT8				*pUserPasswd;
     93 	TI_UINT8				pwdLen;
     94 } mainSecInitData_t;
     95 
     96 typedef struct
     97 {
     98 	TI_STATUS		status;
     99 } mainSecData_t;
    100 
    101 struct _mainSec_t
    102 {
    103 	TI_UINT8                            currentState;
    104     TI_UINT32				            startCount;
    105 	fsm_stateMachine_t	                *pMainSecSm;
    106 	TI_BOOL				                PrivacyOptionImplemented;
    107     mainSecData_t						data;
    108 	TI_UINT8							sessionKey[SESSION_KEY_LEN];
    109 	TI_UINT8							sessionKeyLen;
    110 
    111     struct _rsn_t                      	*pParent;
    112 	TI_HANDLE			                hReport;
    113 	TI_HANDLE			                hOs;
    114 
    115     struct _mainKeys_t                  *pMainKeys;
    116     struct _keyParser_t                 *pKeyParser;
    117     struct externalSec_t                *pExternalSec;
    118     mainSecSmStart_t                    start;
    119     mainSecSmStop_t                     stop;
    120     mainSecSmReportAuthStatus_t         reportAuthStatus;
    121     mainSecSmReportKeysStatus_t       	reportKeysStatus;
    122     mainSecSmReportReauthentication_t   reportReAuthenticate;
    123 	mainSecSmSetSessionKey_t			setSessionKey;
    124 	mainSecSmGetSessionKey_t			getSessionKey;
    125 	mainSecSmSetKey_t					setKey;
    126 	mainSecSmRemoveKey_t				removeKey;
    127 	mainSecSmSetDefaultKeyId_t			setDefaultKeyId;
    128     mainSecSm_getAuthIdentity_t  		getAuthIdentity;
    129     mainSecSm_getAuthIdentity_t  		setAuthIdentity;
    130 	mainSecSm_getAuthState_t 			getAuthState;
    131     mainSecSm_reportAuthFailure_t       reportAuthFailure;
    132 
    133 };
    134 
    135 /* External data definitions */
    136 
    137 /* External functions definitions */
    138 
    139 /* Function prototypes */
    140 
    141 mainSec_t* mainSec_create(TI_HANDLE hOs);
    142 
    143 TI_STATUS mainSec_unload(mainSec_t *pMainSec);
    144 
    145 TI_STATUS mainSec_config (mainSec_t *pMainSec,
    146                           mainSecInitData_t *pInitData,
    147                           void *pParent,
    148                           TI_HANDLE hReport,
    149                           TI_HANDLE hOs,
    150                           TI_HANDLE hCtrlData,
    151                           TI_HANDLE hEvHandler,
    152                           TI_HANDLE hConn,
    153                           TI_HANDLE hTimer);
    154 
    155 #endif
    156 
    157