Example #1
0
/**
*
* mainSec_config
*
* \b Description: 
*
* Init main security state machine state machine
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  TI_OK on success, TI_NOK otherwise.
*
* \sa 
*/
TI_STATUS mainSec_config (mainSec_t *pMainSec, 
                          mainSecInitData_t *pInitData, 
                          void *pParent,
                          TI_HANDLE hReport,
                          TI_HANDLE hOs,
                          TI_HANDLE hCtrlData,
                          TI_HANDLE hEvHandler,
                          TI_HANDLE hConn,
                          TI_HANDLE hTimer)
{
    TI_STATUS               status;

    pMainSec->setKey = mainSec_setKey;
    pMainSec->removeKey = mainSec_removeKey;
    pMainSec->setDefaultKeyId = mainSec_setDefaultKeyId;

    pMainSec->pParent = pParent;
    pMainSec->hReport = hReport;
    pMainSec->hOs = hOs; 

    if (TI_TRUE == pMainSec->pParent->bRsnExternalMode)
    {
            status = externalSec_config(pMainSec);
    }
    else
    {
         switch (pInitData->pPaeConfig->keyExchangeProtocol)
         {
            case RSN_KEY_MNG_NONE:
                status = mainSecSmNull_config(pMainSec, pInitData->pPaeConfig);
                break;
            case RSN_KEY_MNG_802_1X:
                status = mainSecKeysOnly_config(pMainSec, pInitData->pPaeConfig);
                break;
            default:
                status = mainSecSmNull_config(pMainSec, pInitData->pPaeConfig);
                break;
         }
    }
  
    status  = mainKeys_config (pMainSec->pMainKeys, 
                               pInitData->pPaeConfig, 
                               pMainSec, 
                               pMainSec->hReport, 
                               pMainSec->hOs, 
                               hCtrlData, 
                               hEvHandler, 
                               hConn, 
                               pMainSec->pParent,
                               hTimer);
    if (status != TI_OK)
    {
        return status;
    }

    return status;
}
/**
*
* mainSec_config
*
* \b Description: 
*
* Init main security state machine state machine
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  TI_OK on success, TI_NOK otherwise.
*
* \sa 
*/
TI_STATUS mainSec_config (mainSec_t *pMainSec, 
                          mainSecInitData_t *pInitData, 
                          void *pParent,
                          TI_HANDLE hReport,
                          TI_HANDLE hOs,
                          TI_HANDLE hCtrlData,
                          TI_HANDLE hEvHandler,
                          TI_HANDLE hConn,
                          TI_HANDLE hTimer)
{
    TI_STATUS               status;

    pMainSec->setKey = mainSec_setKey;
    pMainSec->removeKey = mainSec_removeKey;
    pMainSec->setDefaultKeyId = mainSec_setDefaultKeyId;

    pMainSec->pParent = pParent;
    pMainSec->hReport = hReport;
    pMainSec->hOs = hOs;

    TRACE4(pMainSec->hReport, REPORT_SEVERITY_SM, "MainSec SM: config, authProtocol = %d, keyExchangeProtocol=%d, unicastSuite=%d, broadcastSuite=%d\n", pInitData->pPaeConfig->authProtocol, pInitData->pPaeConfig->keyExchangeProtocol, pInitData->pPaeConfig->unicastSuite, pInitData->pPaeConfig->broadcastSuite);

    if (TI_TRUE == pMainSec->pParent->bRsnExternalMode)
    {
            status = externalSec_config(pMainSec);
    }
    else
    {
         switch (pInitData->pPaeConfig->keyExchangeProtocol)
         {
            case RSN_KEY_MNG_NONE:
                status = mainSecSmNull_config(pMainSec, pInitData->pPaeConfig);
                break;
            case RSN_KEY_MNG_802_1X:
                status = mainSecKeysOnly_config(pMainSec, pInitData->pPaeConfig);
                break;
            default:
                status = mainSecSmNull_config(pMainSec, pInitData->pPaeConfig);
                break;
         }
    }

    status  = mainKeys_config (pMainSec->pMainKeys, 
                               pInitData->pPaeConfig, 
                               pMainSec, 
                               pMainSec->hReport, 
                               pMainSec->hOs, 
                               hCtrlData, 
                               hEvHandler, 
                               hConn, 
                               pMainSec->pParent,
                               hTimer);
    if (status != TI_OK)
    {
        TRACE0(pMainSec->hReport, REPORT_SEVERITY_ERROR, "MAIN_SEC_SM: error in configuring mainKeys SM\n");
        return status;
    }

    TRACE0(pMainSec->hReport, REPORT_SEVERITY_SM, "MAIN_SEC_SM: successful configuration SM\n");

    return status;
}