示例#1
0
/**
*
* mainKeys_create
*
* \b Description:
*
* Allocate memory for the main security context, and create all the rest of the needed contexts.
*
* \b ARGS:
*
*  I - hOs - OS handle for OS operations.
*
* \b RETURNS:
*
*  pointer to main security context. If failed, returns NULL.
*
* \sa
*/
mainKeys_t* mainKeys_create(TI_HANDLE hOs)
{
	mainKeys_t 	*pHandle;
	TI_STATUS		status;

	/* allocate association context memory */
	pHandle = (mainKeys_t*)os_memoryAlloc(hOs, sizeof(mainKeys_t));
	if (pHandle == NULL)
	{
		return NULL;
	}

	os_memoryZero(hOs, pHandle, sizeof(mainKeys_t));

	/* allocate memory for association state machine */
	status = fsm_Create(hOs, &pHandle->pMainKeysSm, MAIN_KEYS_NUM_STATES, MAIN_KEYS_NUM_EVENTS);
	if (status != TI_OK)
	{
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pKeyParser = keyParser_create(hOs);
	if (pHandle->pKeyParser == NULL)
	{
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pBcastSm = broadcastKey_create(hOs);
	if (pHandle->pBcastSm == NULL)
	{
		keyParser_unload(pHandle->pKeyParser);
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pUcastSm = unicastKey_create(hOs);
	if (pHandle->pBcastSm == NULL)
	{
		broadcastKey_unload(pHandle->pBcastSm);
		keyParser_unload(pHandle->pKeyParser);
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->hOs = hOs;

	/* At first Timeout we will send MediaSpecific Event   */
	/* At any other Timeout we will send the Timeout Event */

	pHandle->mainKeysTimeoutCounter = TI_FALSE;

	return pHandle;
}
示例#2
0
/**
*
* mainKeys_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 mainKeys_unload(mainKeys_t *pMainKeys)
{
	TI_STATUS	status;

	if (pMainKeys == NULL)
	{
		return TI_NOK;
	}

	status = fsm_Unload(pMainKeys->hOs, pMainKeys->pMainKeysSm);

	if (pMainKeys->hSessionTimer)
	{
		tmr_DestroyTimer (pMainKeys->hSessionTimer);
	}
    pMainKeys->hSessionTimer = NULL;

    status = keyParser_unload(pMainKeys->pKeyParser);

	status = broadcastKey_unload(pMainKeys->pBcastSm);

	status = unicastKey_unload(pMainKeys->pUcastSm);

	os_memoryFree(pMainKeys->hOs, pMainKeys, sizeof(mainKeys_t));

    return TI_OK;
}
/**
*
* mainKeys_config
*
* \b Description: 
*
* Init main security state machine state machine
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  OK on success, NOK otherwise.
*
* \sa 
*/
TI_STATUS mainKeys_unload(mainKeys_t *pMainKeys)
{
	TI_STATUS	status;

	if (pMainKeys == NULL)
	{
		return NOK;
	}

	status = fsm_Unload(pMainKeys->hOs, pMainKeys->pMainKeysSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error releasing FSM memory \n"));
	}

	os_timerStop(pMainKeys->hOs, pMainKeys->timer);
    os_timerDestroy(pMainKeys->hOs, pMainKeys->timer);
	
    status = keyParser_unload(pMainKeys->pKeyParser);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading key parser\n"));
	}

	status = broadcastKey_unload(pMainKeys->pBcastSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading broadcast key SM\n"));
	}

	status = unicastKey_unload(pMainKeys->pUcastSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading unicast key SM\n"));
	}
	
	os_memoryFree(pMainKeys->hOs, pMainKeys, sizeof(mainKeys_t));

    return OK;
}
示例#4
0
/**
*
* mainKeys_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 mainKeys_unload(mainKeys_t *pMainKeys)
{
	TI_STATUS	status;

	if (pMainKeys == NULL)
	{
		return TI_NOK;
	}

	status = fsm_Unload(pMainKeys->hOs, pMainKeys->pMainKeysSm);
    if (status != TI_OK)
	{
		/* report failure but don't stop... */
        TRACE0(pMainKeys->hReport, REPORT_SEVERITY_ERROR, "MAIN_KEYS_SM: Error releasing FSM memory \n");
	}

	if (pMainKeys->hSessionTimer)
	{
		tmr_DestroyTimer (pMainKeys->hSessionTimer);
	}
    pMainKeys->hSessionTimer = NULL;

    status = keyParser_unload(pMainKeys->pKeyParser);
    if (status != TI_OK)
	{
		/* report failure but don't stop... */
        TRACE0(pMainKeys->hReport, REPORT_SEVERITY_ERROR, "MAIN_KEYS_SM: Error unloading key parser\n");
	}

	status = broadcastKey_unload(pMainKeys->pBcastSm);
    if (status != TI_OK)
	{
		/* report failure but don't stop... */
        TRACE0(pMainKeys->hReport, REPORT_SEVERITY_ERROR, "MAIN_KEYS_SM: Error unloading broadcast key SM\n");
	}

	status = unicastKey_unload(pMainKeys->pUcastSm);
    if (status != TI_OK)
	{
		/* report failure but don't stop... */
        TRACE0(pMainKeys->hReport, REPORT_SEVERITY_ERROR, "MAIN_KEYS_SM: Error unloading unicast key SM\n");
	}

	os_memoryFree(pMainKeys->hOs, pMainKeys, sizeof(mainKeys_t));

    return TI_OK;
}