Exemplo n.º 1
0
TI_STATUS keyDeriveWep_derive(struct _keyDerive_t *pKeyDerive, encodedKeyMaterial_t *pEncodedKey)
{
	TI_STATUS status;
	securityKeys_t	key;
	
    if (pEncodedKey==NULL)
    {
        return NOK;
    }
	
	if ((pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_40) && 
		(pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_104) && 
		(pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_232))
	{	
        WLAN_REPORT_ERROR(pKeyDerive->hReport, RSN_MODULE_LOG,
                          ("DeriveWep_derive: ERROR: it is not WEP key lenghth (len=%d) !!!\n", pEncodedKey->keyLen));
        return NOK;
   	}

	key.keyType = WEP_KEY;
	key.keyIndex = (UINT8)pEncodedKey->keyId;
	key.encLen = (UINT16)pEncodedKey->keyLen;
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey, pEncodedKey->pData, pEncodedKey->keyLen);

	status = pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	if (status == OK)
	{
		os_memoryCopy(pKeyDerive->hOs, &pKeyDerive->key, pEncodedKey, sizeof(encodedKeyMaterial_t));
	}
	
	return status;
}
Exemplo n.º 2
0
TI_STATUS keyDeriveWep_derive(struct _keyDerive_t *pKeyDerive, encodedKeyMaterial_t *pEncodedKey)
{
	TI_STATUS status;
	TSecurityKeys	key;

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

	if ((pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_40) &&
	    (pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_104) &&
	    (pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_232)) {
		return TI_NOK;
	}

	key.keyType = KEY_WEP;
	key.keyIndex = (TI_UINT8)pEncodedKey->keyId;
	key.encLen = (TI_UINT16)pEncodedKey->keyLen;
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey, pEncodedKey->pData, pEncodedKey->keyLen);

	status = pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	if (status == TI_OK) {
		os_memoryCopy(pKeyDerive->hOs, &pKeyDerive->key, pEncodedKey, sizeof(encodedKeyMaterial_t));
	}

	return status;
}
/***************************************************************************
*                           txCtrlParams_getParam
****************************************************************************
* DESCRIPTION:  Get a specific parameter by an external user application.
*
* OUTPUT:       pParamInfo - structure which include the value of
*               the requested parameter
***************************************************************************/
TI_STATUS txCtrlParams_getParam(TI_HANDLE hTxCtrl, paramInfo_t *pParamInfo)
{
	txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl;
	TI_UINT32 ac;

	if(pTxCtrl == NULL) { /* check handle validity */
		return TI_NOK;
	}

	switch (pParamInfo->paramType) {
	case TX_CTRL_COUNTERS_PARAM:
		/* Convert total-delays units from usec to mSec. */
		for(ac = 0 ; ac < MAX_NUM_OF_AC ; ac++) {
			pTxCtrl->txDataCounters[ac].SumTotalDelayMs = pTxCtrl->SumTotalDelayUs[ac] / 1000;
		}
		os_memoryCopy( pTxCtrl->hOs, pParamInfo->content.pTxDataCounters, &(pTxCtrl->txDataCounters[0]),
		               sizeof(TTxDataCounters) * MAX_NUM_OF_AC);
		pParamInfo->paramLength = sizeof(TTxDataCounters) * MAX_NUM_OF_AC;
		break;

	case TX_CTRL_GET_DATA_FRAME_COUNTER:
		pParamInfo->content.txPacketsCount = 0;
		for (ac = 0; ac < MAX_NUM_OF_AC; ac++)
			pParamInfo->content.txPacketsCount += pTxCtrl->txDataCounters[ac].XmitOk;
		break;

	case TX_CTRL_REPORT_TS_STATISTICS:
		ac = pParamInfo->content.tsMetricsCounters.acID;
		os_memoryCopy(pTxCtrl->hOs,
		              pParamInfo->content.tsMetricsCounters.pTxDataCounters,
		              &(pTxCtrl->txDataCounters[ac]),
		              sizeof(TTxDataCounters));
		os_memoryZero(pTxCtrl->hOs, &(pTxCtrl->txDataCounters[ac]), sizeof(TTxDataCounters));
		break;

	case TX_CTRL_GENERIC_ETHERTYPE:
		pParamInfo->content.txGenericEthertype = pTxCtrl->genericEthertype;
		break;

	case TX_CTRL_GET_DATA_LINK_COUNTER:
		{
			TI_UINT32 uHlid;
			for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++)
			{
				pParamInfo->content.linkDataCounters[uHlid].sentPkts = pTxCtrl->dbgLinkCounters.dbgNumPktsSent[uHlid];
				pParamInfo->content.linkDataCounters[uHlid].sentBytes = pTxCtrl->dbgLinkCounters.dbgNumBytesSent[uHlid];
				pParamInfo->content.linkDataCounters[uHlid].sentPktsError = pTxCtrl->dbgLinkCounters.dbgNumPktsError[uHlid];
			}
		}
        break;

	default:
		TRACE0(pTxCtrl->hReport, REPORT_SEVERITY_ERROR, ": PARAMETER NOT SUPPORTED\n");
		return PARAM_NOT_SUPPORTED;
		break;
	}

	return TI_OK;
}
Exemplo n.º 4
0
/** 
 * \fn     sme_SetDefaults
 * \brief  Set default values to the SME (and the SM and scan result table)
 * 
 * Set default values to the SME (and the SM and scan result table)
 * 
 * \param  hSme - handle to the SME object
 * \param  pInitParams - values read from registry / ini file
 * \return None
 * \sa     sme_Create, sme_Init
 */ 
void sme_SetDefaults (TI_HANDLE hSme, TSmeModifiedInitParams *pModifiedInitParams, TSmeInitParams *pInitParams)
{
    TSme        *pSme = (TSme*)hSme;

    /* copy init params */
    os_memoryCopy (pSme->hOS, &(pSme->tInitParams), pInitParams, sizeof (TSmeInitParams));

    /* initialize SME varaibles */   
    pSme->bRadioOn = pModifiedInitParams->bRadioOn;
    pSme->eConnectMode = pModifiedInitParams->eConnectMode;
    if (CONNECT_MODE_AUTO == pSme->eConnectMode)
    {
        pSme->hScanResultTable = pSme->hSmeScanResultTable;
    }
    else if (CONNECT_MODE_MANUAL == pSme->eConnectMode) 
    {
        pSme->hScanResultTable = pSme->hScanCncnScanResulTable;
    }

    pSme->eBssType = pModifiedInitParams->eDesiredBssType;
    MAC_COPY (pSme->tBssid, pModifiedInitParams->tDesiredBssid);

    pSme->tSsid.len = pModifiedInitParams->tDesiredSsid.len;
    if ( pSme->tSsid.len > MAX_SSID_LEN )
    {
        TRACE2( pSme->hReport, REPORT_SEVERITY_ERROR, "sme_SetDefaults. pSme->tSsid.len=%d exceeds the limit %d\n", pSme->tSsid.len, MAX_SSID_LEN);
        pSme->tSsid.len = MAX_SSID_LEN;
    }
    os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pModifiedInitParams->tDesiredSsid.str[ 0 ]), pSme->tSsid.len);
    if (OS_802_11_SSID_JUNK (pSme->tSsid.str, pSme->tSsid.len))
    {
        pSme->eSsidType = SSID_TYPE_INVALID;
        pSme->bConnectRequired = TI_FALSE;
    }
    else if (0 == pSme->tSsid.len)
    {
        pSme->eSsidType = SSID_TYPE_ANY;
        pSme->bConnectRequired = TI_TRUE;
    }
    else
    {
        pSme->eSsidType = SSID_TYPE_SPECIFIC;
        pSme->bConnectRequired = TI_TRUE;
    }

    pSme->eLastConnectMode = CONNECT_MODE_AUTO;
    pSme->bAuthSent = TI_FALSE;
    pSme->bReselect = TI_FALSE;
    pSme->uScanCount = 0;
    pSme->bRunning = TI_FALSE;

    /* Initialize the SME state-machine */
    genSM_SetDefaults (pSme->hSmeSm, SME_SM_NUMBER_OF_STATES, SME_SM_NUMBER_OF_EVENTS, (TGenSM_matrix)tSmMatrix,
                       SME_SM_STATE_IDLE, "SME SM", uStateDescription, uEventDescription, __FILE_ID__);

    /* register scan conecntrator CB */
    scanCncn_RegisterScanResultCB (pSme->hScanCncn, SCAN_SCC_DRIVER, sme_ScanResultCB, hSme);
}
Exemplo n.º 5
0
/****************************************************************************
 *                      cmdBld_CmdIeSetKey()
 ****************************************************************************
 * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox
 * 
 * INPUTS: 
 *      Action      - add/remove key
 *      MacAddr     - relevant only for mapping keys
 *      KeySize     - key size
 *      KeyType     - default/mapping/TKIP
 *      KeyId       - relevant only for default keys
 *      Key         - key data
 * 
 * OUTPUT:  None
 * 
 * RETURNS: TI_OK or TI_NOK
 ****************************************************************************/
TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld, 
                              TI_UINT32 action, 
                              TI_UINT8  *pMacAddr, 
                              TI_UINT32 uKeySize, 
                              TI_UINT32 uKeyType, 
                              TI_UINT32 uKeyId, 
                              TI_UINT8  *pKey, 
                              TI_UINT32 uSecuritySeqNumLow, 
                              TI_UINT32 uSecuritySeqNumHigh,
                              void      *fCb, 
                              TI_HANDLE hCb)
{
    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
    SetKey_t AcxCmd_SetKey;
    SetKey_t *pCmd = &AcxCmd_SetKey;

    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));

    MAC_COPY (pCmd->addr, pMacAddr);

    if (uKeySize > MAX_KEY_SIZE)
    {
        os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE);
    }
    else 
    {
        os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize);
    }

    pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action);
    pCmd->keySize = (TI_UINT8)uKeySize;
    pCmd->type = (TI_UINT8)uKeyType;
    pCmd->id = (TI_UINT8)uKeyId;
    pCmd->ssidProfile = 0;

    /* 
     * Preserve TKIP/AES security sequence number after recovery.
     * Note that our STA Tx is currently using only one sequence-counter 
     * for all ACs (unlike the Rx which is separated per AC).  
     */
    pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow);
    pCmd->AcSeqNum16[1] = 0;
    pCmd->AcSeqNum16[2] = 0;
    pCmd->AcSeqNum16[3] = 0;
    
    pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh);
    pCmd->AcSeqNum32[1] = 0;
    pCmd->AcSeqNum32[2] = 0;
    pCmd->AcSeqNum32[3] = 0;


TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pCmd->addr[0],pCmd->addr[1],pCmd->addr[2],pCmd->addr[3],pCmd->addr[4],pCmd->addr[5]);
			
TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Action=%x,keySize=0x%x,type=%x, id=%x, ssidProfile=%x, AcSeqNum16[0]=%x, AcSeqNum32[0]=%x\n", pCmd->action,pCmd->keySize, pCmd->type,pCmd->id,pCmd->ssidProfile,pCmd->AcSeqNum16[0],pCmd->AcSeqNum32[0] );

	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
}
Exemplo n.º 6
0
/**
 * \fn     powerMgrKL_setParam
 * \brief  Handles a parametr change from user-mode
 *
 * Handles addition / removal of a template and global enable / disable flag
 *
 * \param  hPowerMgrKL - handle to the power-manager keep-alive object
 * \param  pParam - A pointer to the paramter being set
 * \return TI_OK if succesful, TI_NOK otherwise
 * \sa     powerMgrKL_start, powerMgrKL_stop
 */
TI_STATUS powerMgrKL_setParam (TI_HANDLE hPowerMgrKL, paramInfo_t *pParam)
{
	TPowerMgrKL         *pPowerMgrKL = (TPowerMgrKL*)hPowerMgrKL;
	TI_UINT32           uIndex;
	TKeepAliveTemplate  *pNewTmpl;
	TI_STATUS           status = TI_OK;

	switch (pParam->paramType) {
		/* global keep-alive enable / disable flag */
	case POWER_MGR_KEEP_ALIVE_ENA_DIS:

		pPowerMgrKL->tCurrentConfig.enaDisFlag = pParam->content.powerMgrKeepAliveEnaDis;
		return TWD_CfgKeepAliveEnaDis(pPowerMgrKL->hTWD,
		                              (TI_UINT8)pParam->content.powerMgrKeepAliveEnaDis);
		break;

		/* keep-alive template and parameters configuration */
	case POWER_MGR_KEEP_ALIVE_ADD_REM:

		pNewTmpl = pParam->content.pPowerMgrKeepAliveTemplate;
		uIndex = pNewTmpl->keepAliveParams.index;

		/* if STA is connected */
		if (TI_TRUE == pPowerMgrKL->bConnected) {
			/* if keep-alive is already configured for this index */
			if (TI_TRUE == pPowerMgrKL->tCurrentConfig.templates[ uIndex ].keepAliveParams.enaDisFlag) {
				/* disable previous keep-alive */
				pPowerMgrKL->tCurrentConfig.templates[ uIndex ].keepAliveParams.enaDisFlag = TI_FALSE;
				status = TWD_CfgKeepAlive (pPowerMgrKL->hTWD, &(pPowerMgrKL->tCurrentConfig.templates[ uIndex ].keepAliveParams));
				if (TI_OK != status) {
					return status;
				}
			}

			/* copy configuration */
			os_memoryCopy (pPowerMgrKL->hOs, &(pPowerMgrKL->tCurrentConfig.templates[ uIndex ]),
			               pNewTmpl, sizeof (TKeepAliveTemplate));

			/* configure keep-alive to the FW (through command builder */
			return powerMgrKLConfigureMessage (hPowerMgrKL, uIndex);
		}
		/* STA disconnected */
		else {
			/* copy configuration */
			os_memoryCopy (pPowerMgrKL->hOs, &(pPowerMgrKL->tCurrentConfig.templates[ uIndex ]),
			               pNewTmpl, sizeof (TKeepAliveTemplate));
		}
		return TI_OK;
		break;

	default:
		return PARAM_NOT_SUPPORTED;
		break;
	}
}
Exemplo n.º 7
0
/****************************************************************************
 *                      cmdBld_CmdIeSetKey()
 ****************************************************************************
 * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox
 *
 * INPUTS:
 *      Action      - add/remove key
 *      MacAddr     - relevant only for mapping keys
 *      KeySize     - key size
 *      KeyType     - default/mapping/TKIP
 *      KeyId       - relevant only for default keys
 *      Key         - key data
 *
 * OUTPUT:  None
 *
 * RETURNS: TI_OK or TI_NOK
 ****************************************************************************/
TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld,
                              TI_UINT32 action,
                              TI_UINT8  *pMacAddr,
                              TI_UINT32 uKeySize,
                              TI_UINT32 uKeyType,
                              TI_UINT32 uKeyId,
                              TI_UINT8  *pKey,
                              TI_UINT32 uSecuritySeqNumLow,
                              TI_UINT32 uSecuritySeqNumHigh,
                              void      *fCb,
                              TI_HANDLE hCb)
{
	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
	SetKey_t AcxCmd_SetKey;
	SetKey_t *pCmd = &AcxCmd_SetKey;

	os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));

	MAC_COPY (pCmd->addr, pMacAddr);

	if (uKeySize > MAX_KEY_SIZE) {
		os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE);
	} else {
		os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize);
	}

	pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action);
	pCmd->keySize = (TI_UINT8)uKeySize;
	pCmd->type = (TI_UINT8)uKeyType;
	pCmd->id = (TI_UINT8)uKeyId;
	pCmd->ssidProfile = 0;

	/*
	 * Preserve TKIP/AES security sequence number after recovery.
	 * If not in reconfig set to 0 so the FW will ignore it and keep its own number.
	 * Note that our STA Tx is currently using only one sequence-counter
	 * for all ACs (unlike the Rx which is separated per AC).
	 */
	if (pCmdBld->bReconfigInProgress == TI_FALSE) {
		uSecuritySeqNumLow = uSecuritySeqNumHigh = 0;
	}
	pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow);
	pCmd->AcSeqNum16[1] = 0;
	pCmd->AcSeqNum16[2] = 0;
	pCmd->AcSeqNum16[3] = 0;

	pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh);
	pCmd->AcSeqNum32[1] = 0;
	pCmd->AcSeqNum32[2] = 0;
	pCmd->AcSeqNum32[3] = 0;


	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
}
Exemplo n.º 8
0
/*************************************************************************
 *                        wdrv_txReplaceWlanHeader                       *
 *************************************************************************
DESCRIPTION: This function replaces the 802.11 header with length + SA as
             prefix to the concatenated MSDU.                
                                                                                                   
INPUT:       msduPtr     - Pointer to the first MSDU.
             
             

RETURN:      OK : Initiation succesfull.
             NOK: Initiation unsuccesfull.                                                                                                                                             
************************************************************************/
static TI_STATUS concat_replaceWlanHeader(concatenator_t* pConcatenator,
										  mem_MSDU_T *msduPtr)
{
    UINT8   *firstDataBuf;
    UINT8    numOfPadBytes;
    UINT8   *tmpPtr;
	UINT8	tmpMacAddr[WLAN_DA_FIELD_LEN];
    int i;
	
	
	/* Replace the 802.11 header with 2 length bytes and 6 DA . */
	firstDataBuf = (UINT8 *)(msduPtr->firstBDPtr->data + 
							msduPtr->firstBDPtr->dataOffset);

	/*
	 * Use temporary buffer to prevent overwrite on the same data
	 */
	os_memoryCopy(pConcatenator->hOs,
				  tmpMacAddr,
				  firstDataBuf+WLAN_DA_FIELD_OFFSET, WLAN_DA_FIELD_LEN);
	os_memoryCopy(pConcatenator->hOs,
				  firstDataBuf+ WLAN_HDR_LEN - WLAN_DA_FIELD_LEN,
				  tmpMacAddr, WLAN_DA_FIELD_LEN);
	
	msduPtr->firstBDPtr->dataOffset += WLAN_CONCAT_HDR_OFFSET;
	msduPtr->firstBDPtr->length -= WLAN_CONCAT_HDR_OFFSET;
	msduPtr->dataLen -= WLAN_CONCAT_HDR_OFFSET;
	
	/* Fill the length bytes.   */
	(*(UINT16*)(firstDataBuf+ WLAN_CONCAT_HDR_OFFSET)) = 
			wlan_htons((UINT16)(msduPtr->dataLen - WLAN_4X_LEN_FIELD_LEN));
	
	/* Padding the last buffer with zeros.*/
	numOfPadBytes = msduPtr->dataLen % 4;
	
	if( numOfPadBytes > 0 )
	{ 
#if 1
	/*
	* fixing the alignment bug. 
	       */
		numOfPadBytes = 4 - numOfPadBytes;
#endif	      
		tmpPtr = (UINT8 *) ((UINT32)msduPtr->lastBDPtr->data + msduPtr->lastBDPtr->length +
			msduPtr->lastBDPtr->dataOffset);
		for( i=0; i<numOfPadBytes; i++)
			tmpPtr[i] = 0x00;
		
		msduPtr->lastBDPtr->length += numOfPadBytes;
		msduPtr->dataLen += numOfPadBytes;
	}

	return OK; 
}
Exemplo n.º 9
0
/****************************************************************************
 *                      cmdBld_CmdIeSetKey()
 ****************************************************************************
 * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox
 *
 * INPUTS:
 *      Action      - add/remove key
 *      MacAddr     - relevant only for mapping keys
 *      KeySize     - key size
 *      KeyType     - default/mapping/TKIP
 *      KeyId       - relevant only for default keys
 *      Key         - key data
 *
 * OUTPUT:  None
 *
 * RETURNS: TI_OK or TI_NOK
 ****************************************************************************/
TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld,
                              TI_UINT32 action,
                              TI_UINT8  hlid,
                              TI_UINT8  lidkeytype,
                              TI_UINT32 uKeySize,
                              TI_UINT32 uKeyType,
                              TI_UINT32 uKeyId,
                              TI_UINT8  *pKey,
                              TI_UINT32 uSecuritySeqNumLow,
                              TI_UINT32 uSecuritySeqNumHigh,
                              void      *fCb,
                              TI_HANDLE hCb)
{
	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
	SetKey_t AcxCmd_SetKey;
	SetKey_t *pCmd = &AcxCmd_SetKey;

	os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));

	if (uKeySize > MAX_KEY_SIZE) {
		os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE);
	} else {
		os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize);
	}


	pCmd->hlid  = hlid;
	pCmd->lidKeyType = lidkeytype;
	pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action);
	pCmd->keySize = (TI_UINT8)uKeySize;
	pCmd->type = (TI_UINT8)uKeyType;
	pCmd->keyId = (TI_UINT8)uKeyId;

	/*
	 * Preserve TKIP/AES security sequence number after recovery.
	 * Note that our STA Tx is currently using only one sequence-counter
	 * for all ACs (unlike the Rx which is separated per AC).
	 */
	pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow);
	pCmd->AcSeqNum16[1] = 0;
	pCmd->AcSeqNum16[2] = 0;
	pCmd->AcSeqNum16[3] = 0;

	pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh);
	pCmd->AcSeqNum32[1] = 0;
	pCmd->AcSeqNum32[2] = 0;
	pCmd->AcSeqNum32[3] = 0;


	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
}
TI_STATUS roamingMngr_connect(TI_HANDLE hRoamingMngr, TargetAp_t* pTargetAp)
{
	roamingMngr_t *pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
	bssList_t *bssList;
	int i=0;

	TRACE2(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_connect(),"
	       "transitionMethod = %d,"
	       "requestType = %d,"
	       " \n", pTargetAp->transitionMethod,pTargetAp->connRequest.requestType) ;


	TRACE6(pRoamingMngr->hReport, REPORT_SEVERITY_ERROR, "roamingMngr_connect(),"
	       " AP to roam BSSID: "
	       "%02x-%02x-%02x-%02x-%02x-%02x "
	       "\n", pTargetAp->newAP.BSSID[0],pTargetAp->newAP.BSSID[1],pTargetAp->newAP.BSSID[2],pTargetAp->newAP.BSSID[3],pTargetAp->newAP.BSSID[4],pTargetAp->newAP.BSSID[5]);


	/* Search for target AP in the scan manager results table, to get its beacon/ProbResponse buffer  */
	bssList = scanMngr_getBSSList(((roamingMngr_t*)hRoamingMngr)->hScanMngr);
	for (i=0; i< bssList->numOfEntries ; i++) {
		if (MAC_EQUAL(bssList->BSSList[i].BSSID, pTargetAp->newAP.BSSID)) {
			pTargetAp->newAP.pBuffer = bssList->BSSList[i].pBuffer;
			pTargetAp->newAP.bufferLength = bssList->BSSList[i].bufferLength;
			os_memoryCopy(pRoamingMngr->hOs, &(pRoamingMngr->targetAP), (void*)pTargetAp, sizeof(TargetAp_t));
			return roamingMngr_smEvent(ROAMING_MANUAL_EVENT_CONNECT, hRoamingMngr);
		}
	}

	TRACE6(pRoamingMngr->hReport, REPORT_SEVERITY_ERROR, "roamingMngr_connect(),"
	       "AP was not found in scan table!! BSSID: "
	       "%02x-%02x-%02x-%02x-%02x-%02x "
	       "\n", pTargetAp->newAP.BSSID[0],pTargetAp->newAP.BSSID[1],pTargetAp->newAP.BSSID[2],pTargetAp->newAP.BSSID[3],pTargetAp->newAP.BSSID[4],pTargetAp->newAP.BSSID[5]);
	return TI_NOK;
}
/**
*
* mainSecSmNull_setKey
*
* \b Description: 
*
* Start the NULL main security SM. Reports success to the rsn module immediately.
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  OK on success, NOK otherwise.
*
* \sa 
*/
TI_STATUS mainSecKeysOnly_getSessionKey(mainSec_t *pMainSec, UINT8* pKey, UINT32* pKeyLen)
{
	os_memoryCopy(pMainSec->hOs, pKey, pMainSec->sessionKey, pMainSec->sessionKeyLen);
	*pKeyLen = pMainSec->sessionKeyLen;

	return OK;
}
Exemplo n.º 12
0
/****************************************************************************
 *                     cmdBld_CfgBeaconFilterTable
 ****************************************************************************
 * DESCRIPTION: Sets Beacon filtering state
 *
 * INPUTS:  None
 *
 * OUTPUT:  None
 *
 * RETURNS: TI_OK or TI_NOK
 ****************************************************************************/
TI_STATUS cmdBld_CfgBeaconFilterTable (TI_HANDLE    hCmdBld,
                                       TI_UINT8     uNumberOfIEs,
                                       TI_UINT8     *pIETable,
                                       TI_UINT8     uIETableSize,
                                       void         *fCb,
                                       TI_HANDLE    hCb)
{
	TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;

	if (uIETableSize > BEACON_FILTER_TABLE_MAX_SIZE) {
		TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgBeaconFilterTable: Table size is too big %d (>%d)\n", uIETableSize, BEACON_FILTER_TABLE_MAX_SIZE);

		return PARAM_VALUE_NOT_VALID;
	}

	os_memoryZero (pCmdBld->hOs,
	               (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
	               BEACON_FILTER_TABLE_MAX_SIZE);
	os_memoryCopy (pCmdBld->hOs,
	               (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
	               (void *)pIETable,
	               uIETableSize);
	DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs = uNumberOfIEs;
	DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize = uIETableSize;

	return cmdBld_CfgIeBeaconFilterTable (hCmdBld, uNumberOfIEs, pIETable, uIETableSize, fCb, hCb);
}
Exemplo n.º 13
0
/****************************************************************************
*                      cmdBld_CfgRxDataFilter()
*****************************************************************************
* DESCRIPTION: Add/remove Rx Data filter information element.
*
* INPUTS:  index               - Index of the Rx Data filter
*          command             - Add or remove the filter
*          action              - Action to take on packets matching the pattern
*          numFieldPatterns    - Number of field patterns in the filter
*          lenFieldPatterns    - Length of the field pattern series
*          fieldPatterns       - Series of field patterns
*
* OUTPUT:  None
*
* RETURNS: TI_OK or TI_NOK
****************************************************************************/
TI_STATUS cmdBld_CfgRxDataFilter (TI_HANDLE hCmdBld,
                                  TI_UINT8     index,
                                  TI_UINT8     command,
                                  filter_e  eAction,
                                  TI_UINT8     uNumFieldPatterns,
                                  TI_UINT8     uLenFieldPatterns,
                                  TI_UINT8  *pFieldPatterns,
                                  void      *fCb,
                                  TI_HANDLE hCb)
{
	TCmdBld         *pCmdBld  = (TCmdBld *)hCmdBld;
	TRxDataFilter   *pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);

	/* Save parameters for reconfig phase */
	pFilters->uIndex            = index;
	pFilters->uCommand          = command;
	pFilters->eAction           = eAction;
	pFilters->uNumFieldPatterns = uNumFieldPatterns;
	pFilters->uLenFieldPatterns = uLenFieldPatterns;
	os_memoryCopy(pCmdBld->hOs, pFilters->aFieldPattern, pFieldPatterns, uLenFieldPatterns);

	return cmdBld_CfgIeRxDataFilter (hCmdBld,
	                                 index,
	                                 command,
	                                 eAction,
	                                 uNumFieldPatterns,
	                                 uLenFieldPatterns,
	                                 pFieldPatterns,
	                                 fCb,
	                                 hCb);
}
Exemplo n.º 14
0
/**
*
* mainKeySmLogMessage
*
* \b Description: 
*
* Prints Log messge.\n
* Start session timer.
*
* \b ARGS:
*
*  I   - pData - station control block  \n
*
* \b RETURNS:
*
*  OK on success, NOK otherwise.
*/
TI_STATUS mainKeys_smTimeOut(void* data)
{
	OS_802_11_AUTHENTICATION_REQUEST   *request;
	UINT8                   AuthBuf[sizeof(UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)];
	paramInfo_t				param;
	TI_STATUS				status;
	struct _mainKeys_t 		*pMainKeys = (struct _mainKeys_t *)data;


	WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG,
				  ("MAIN_KEY_SM: TRAP: Session Timeout for station , mainKeysTimeoutCounter=%d\n",
                   pMainKeys->mainKeysTimeoutCounter));

	request = (OS_802_11_AUTHENTICATION_REQUEST *)(AuthBuf + sizeof(UINT32));
	request->Length = sizeof(OS_802_11_AUTHENTICATION_REQUEST);

	param.paramType = CTRL_DATA_CURRENT_BSSID_PARAM;
	status = ctrlData_getParam(pMainKeys->hCtrlData, &param);
	if (status != OK)
	{		
		return NOK;
	}

    WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG,
			  ("current station is banned from the roaming candidates list for %d Ms\n",
               RSN_MAIN_KEYS_SESSION_TIMEOUT));

    rsn_banSite(pMainKeys->hRsn, param.content.ctrlDataCurrentBSSID, RSN_SITE_BAN_LEVEL_FULL, RSN_MAIN_KEYS_SESSION_TIMEOUT);
	

	/* mainKeysTimeoutCounter is a boolean variable, With states:	*/
	/* TRUE - It is a Timeout Association Event						*/ 
	/* FALSE - It is a Media specific Event							*/

	if (!pMainKeys->mainKeysTimeoutCounter)
	{
		/* Fill Media specific indication fields and send to OS/User    */ 
		os_memoryCopy(pMainKeys->hOs, request->BSSID, (void *)param.content.ctrlDataCurrentBSSID.addr, MAC_ADDR_LEN);
	
		request->Flags = OS_802_11_REQUEST_REAUTH;
	
		*(UINT32*)AuthBuf = os802_11StatusType_Authentication;
	
		WLAN_REPORT_INFORMATION(pMainKeys->hReport, RSN_MODULE_LOG,
			  (" %d Ms\n",RSN_MAIN_KEYS_SESSION_TIMEOUT));
	
		EvHandlerSendEvent(pMainKeys->hEvHandler, IPC_EVENT_MEDIA_SPECIFIC, (UINT8*)AuthBuf,
							sizeof(UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST));
	
		os_timerStart(pMainKeys->hOs, pMainKeys->timer, pMainKeys->keysTimeout, FALSE);
		pMainKeys->mainKeysTimeoutCounter = TRUE;
	}
	else
	{
        pMainKeys->mainKeysTimeoutCounter = FALSE;
        rsn_reportAuthFailure(pMainKeys->hRsn, RSN_AUTH_STATUS_TIMEOUT);
        conn_reportRsnStatus(pMainKeys->hConn, (mgmtStatus_e)STATUS_SECURITY_FAILURE);
	}
	return OK;
}
Exemplo n.º 15
0
/**
 * \\n
 * \date 09-November-2005\n
 * \brief Starts a measurement operation.\n
 *
 * Function Scope \e Public.\n
 * \param hMacServices - handle to the MacServices object.\n
 * \param pMsrRequest - a structure containing measurement parameters.\n
 * \param timeToRequestexpiryMs - the time (in milliseconds) the measurement SRV has to start the request.\n
 * \param cmdResponseCBFunc - callback function to used for command response.\n
 * \param cmdResponseCBObj - handle to pass to command response CB.\n
 * \param cmdCompleteCBFunc - callback function to be used for command complete.\n
 * \param cmdCompleteCBObj - handle to pass to command complete CB.\n
 * \return TI_OK if successful (various, TBD codes if not).\n
 */
TI_STATUS MacServices_measurementSRV_startMeasurement( TI_HANDLE hMacServices,
        TMeasurementRequest* pMsrRequest,
        TI_UINT32 timeToRequestExpiryMs,
        TCmdResponseCb cmdResponseCBFunc,
        TI_HANDLE cmdResponseCBObj,
        TMeasurementSrvCompleteCb cmdCompleteCBFunc,
        TI_HANDLE cmdCompleteCBObj )
{
	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)((MacServices_t*)hMacServices)->hMeasurementSRV;
	TI_INT32 i;

#ifdef TI_DBG
	measurementSRVPrintRequest( (TI_HANDLE)pMeasurementSRV, pMsrRequest );
#endif

	/* mark that request is in progress */
	pMeasurementSRV->bInRequest = TI_TRUE;

	/* mark to send NULL data when exiting driver mode (can be changed to TI_FALSE
	   only when explictly stopping the measurement */
	pMeasurementSRV->bSendNullDataWhenExitPs = TI_TRUE;

	/* Nullify return status */
	pMeasurementSRV->returnStatus = TI_OK;

	/* copy request parameters */
	os_memoryCopy (pMeasurementSRV->hOS,
	               (void *)&pMeasurementSRV->msrRequest,
	               (void *)pMsrRequest,
	               sizeof(TMeasurementRequest));

	/* Mark the current time stamp and the duration to start to cehck expiry later */
	pMeasurementSRV->requestRecptionTimeStampMs = os_timeStampMs( pMeasurementSRV->hOS );
	pMeasurementSRV->timeToRequestExpiryMs = timeToRequestExpiryMs;

	/* copy callbacks */
	pMeasurementSRV->commandResponseCBFunc = cmdResponseCBFunc;
	pMeasurementSRV->commandResponseCBObj = cmdResponseCBObj;
	pMeasurementSRV->measurmentCompleteCBFunc = cmdCompleteCBFunc;
	pMeasurementSRV->measurementCompleteCBObj = cmdCompleteCBObj;

	/* initialize reply */
	pMeasurementSRV->msrReply.numberOfTypes = pMsrRequest->numberOfTypes;
	for ( i = 0; i < pMsrRequest->numberOfTypes; i++ ) {
		pMeasurementSRV->msrReply.msrTypes[ i ].msrType = pMeasurementSRV->msrRequest.msrTypes[ i ].msrType;
		pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_OK;
	}

	/* nullify the pending CBs bitmap */
	pMeasurementSRV->pendingParamCBs = 0;

	/* send a start measurement event to the SM */
	measurementSRVSM_SMEvent( (TI_HANDLE)pMeasurementSRV, &(pMeasurementSRV->SMState),
	                          MSR_SRV_EVENT_MEASURE_START_REQUEST );

	/* mark that request has been sent */
	pMeasurementSRV->bInRequest = TI_FALSE;

	return pMeasurementSRV->returnStatus;
}
Exemplo n.º 16
0
/**
*
* assoc_recv - Recive a message from the AP
*
* \b Description: 
*
* Parse a message form the AP and perform the appropriate event.
*
* \b ARGS:
*
*  I   - hAssoc - Association SM context  \n
*  I   - pFrame - Frame recieved  \n
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa assoc_Start, assoc_Stop
*/
TI_STATUS assoc_recv(TI_HANDLE hAssoc, mlmeFrameInfo_t *pFrame)
{
    TI_STATUS       status;
    assoc_t         *pHandle = (assoc_t*)hAssoc;
    TTwdParamInfo   tTwdParam;
    TI_UINT16           rspStatus;

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

    /* ensure that the SM is waiting for assoc response */
    if(pHandle->currentState != ASSOC_SM_STATE_WAIT)
        return TI_OK;

    
    if ((pFrame->subType != ASSOC_RESPONSE) && (pFrame->subType != RE_ASSOC_RESPONSE))
    {
        return TI_NOK;
    }

    /* check response status */
    rspStatus  = pFrame->content.assocRsp.status;
    
    if (rspStatus == 0)
    {
        TRsnData        rsnData;
        dot11_RSN_t *pRsnIe;
        TI_UINT8       curRsnData[255];
        TI_UINT8       rsnAssocIeLen;
        TI_UINT8        length = 0;


        TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "ASSOC_SM: DEBUG Success associating to AP \n");
        
        /* set AID to HAL */
        tTwdParam.paramType = TWD_AID_PARAM_ID;
        tTwdParam.content.halCtrlAid  = pFrame->content.assocRsp.aid;
        TWD_SetParam (pHandle->hTWD, &tTwdParam);
        

        /* Get the RSN IE data */
        pRsnIe = pFrame->content.assocRsp.pRsnIe;
        while (length < pFrame->content.assocRsp.rsnIeLen && (pFrame->content.assocRsp.rsnIeLen < 255))
        {
            curRsnData[0+length] = pRsnIe->hdr[0];
            curRsnData[1+length] = pRsnIe->hdr[1];
            os_memoryCopy(pHandle->hOs, &curRsnData[2+length], (void *)pRsnIe->rsnIeData, pRsnIe->hdr[1]); 
            length += pRsnIe->hdr[1] + 2;
            pRsnIe += 1;
        }
        
        if (pFrame->content.assocRsp.rsnIeLen != 0)
        {
            rsnData.pIe = curRsnData;
            rsnData.ieLen = pFrame->content.assocRsp.rsnIeLen;
            rsnData.privacy =  ((pFrame->content.assocRsp.capabilities >> CAP_PRIVACY_SHIFT) & CAP_PRIVACY_MASK) ? TI_TRUE : TI_FALSE;
            rsn_setSite(pHandle->hRsn, &rsnData, NULL, &rsnAssocIeLen);
        }
/*
 * \brief	Read Address to FW
 * 
 * \param  hFwDebug  - Handle to FW Debug
 * \param  Address - Absolute HW address
 * \param  Length - Length in byte to write
 * \param  Buffer - Buffer to copy to FW
 * \param  fCb - CB function
 * \param  hCb - CB Handle
 * \return none
 * 
 * \par Description
 * Read from HW, must receive length in byte max size 256 bytes
 * address must be absolute HW address.
 * 
 * \sa 
 */
TI_STATUS fwDbg_ReadAddr (TI_HANDLE hFwDebug,
                          TI_UINT32 Address,
                          TI_UINT32 Length,
                          TI_UINT8* Buffer,
                          TFwDubCallback fCb,
                          TI_HANDLE hCb)
{
	TI_STATUS rc;
	TTxnStruct *pTxn;
	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug;
	pTxn = &pFwDebug->tTxn;
	/* check if length is large than default threshold */
	if (Length > DMA_SIZE_BUF)
	{
TRACE1(pFwDebug->hReport, REPORT_SEVERITY_ERROR, "fwDbg_ReadAddr : Buffer Length too large -- %d",Length);
		return TXN_STATUS_ERROR;
	}

	pFwDebug->fCb = fCb;
	pFwDebug->hCb = hCb;
	pFwDebug->pReadBuf = Buffer;

	/* Build the command TxnStruct */
    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
	/* Applying a CB in case of an async read */
    BUILD_TTxnStruct(pTxn, Address, pFwDebug->pDMABuf, Length,(TTxnDoneCb)fwDbg_ReadAddrCb, pFwDebug)
	rc = twIf_Transact(pFwDebug->hTwif,pTxn);
	if (rc == TXN_STATUS_COMPLETE)
    {
		/* copy from DMA buufer to given buffer */
		os_memoryCopy(pFwDebug->hOs,pFwDebug->pReadBuf,pFwDebug->pDMABuf,Length);
	}
	return rc;
}
Exemplo n.º 18
0
/**
*
* fsm_Init  - Initialize the FSM structure
*
* \b Description:
*
* Init The FSM structure. If matrix argument is NULL, allocate memory for
* new matrix.
*
* \b ARGS:
*
*  O   - pFsm - the generated FSM module  \n
*  I   - noOfStates - Number of states in the module \n
*  I   - noOfStates - Number of events in the module \n
*  I/O - matrix - the state event matrix
*  I   - transFunc - Transition finction for the state machine \n
*
* \b RETURNS:
*
*  TI_OK on success, TI_NOK on failure
*
* \sa fsm_Event
*/
TI_STATUS fsm_Config(fsm_stateMachine_t	*pFsm,
                     fsm_Matrix_t			pMatrix,
                     TI_UINT8					ActiveNoOfStates,
                     TI_UINT8					ActiveNoOfEvents,
                     fsm_eventActivation_t	transFunc,
                     TI_HANDLE				hOs)
{
	/* check for perliminary conditions */
	if ((pFsm == NULL) ||
	        (pMatrix == NULL)) {
		return TI_NOK;
	}

	if ((ActiveNoOfStates > pFsm->MaxNoOfStates) ||
	        (ActiveNoOfEvents > pFsm->MaxNoOfEvents)) {
		return TI_NOK;
	}

	/* copy matrix to FSM context */
	os_memoryCopy(hOs, (void *)pFsm->stateEventMatrix, (void *)pMatrix,
	              ActiveNoOfStates * ActiveNoOfEvents * sizeof(fsm_actionCell_t));

	/* update pFsm structure with parameters */
	pFsm->ActiveNoOfStates = ActiveNoOfStates;
	pFsm->ActiveNoOfEvents = ActiveNoOfEvents;
	pFsm->transitionFunc = transFunc;
	return(TI_OK);
}
/****************************************************************************************
 *                        TWDriverTest                                    
 ****************************************************************************************/
TI_STATUS TWDriverTest(TI_HANDLE hTWD, 
					   TestCmdID_enum eTestCmd, 
					   void* pTestCmdParams, 
					   TTestCmdCB fCb, 
					   TI_HANDLE hCb)
{
	TTwd *pTWD = (TTwd *)hTWD;

	/* check parameters */
	if (( hTWD == NULL ) ||
		( eTestCmd >= MAX_TEST_CMD_ID ) ||
		( fCb == NULL ) ||
		( hCb == NULL ))
	{
		return (TI_NOK);
	}

	pTWD->testCmd.testCmdId = eTestCmd;

	if (pTestCmdParams != NULL)
	{
	os_memoryCopy(NULL, &pTWD->testCmd.testCmd_u, pTestCmdParams, sizeof(pTWD->testCmd.testCmd_u));
	}

	pTWD->fRadioCb = fCb;
	pTWD->pRadioCb = pTestCmdParams;
	pTWD->hRadioCb = hCb;

	return(cmdBld_CmdTest (pTWD->hCmdBld, 
						   (TI_HANDLE)TWDriverTestCB, 
						   hTWD, 
						   &pTWD->testCmd));
}
Exemplo n.º 20
0
TI_STATUS keyDeriveNone_derive(struct _keyDerive_t *pKeyDerive, encodedKeyMaterial_t *pEncodedKey)
{
	securityKeys_t	key;
	
    if (pEncodedKey==NULL)
    {
        return NOK;
    }

	if ((pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_40) && 
		(pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_104) && 
		(pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_232))
	{	
        return NOK;
   	}

	key.keyType = WEP_KEY;
	key.keyIndex = (UINT8)pEncodedKey->keyId;
	key.encLen = (UINT16)pEncodedKey->keyLen;
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey, pEncodedKey->pData, pEncodedKey->keyLen);

	pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	
	return OK;
}
Exemplo n.º 21
0
/** 
 * \fn     mlme_authMsgBuild 
 * \brief  builds authentication request
 * 
 * The function builds the authentication request according to the given params
 * 
 * \param  pMlme - pointer to mlme_t
 * \param  authType - auth type (OPEN or SHARED)
 * \param  seq - message sequence number
 * \param  statusCode - 0 in case of success
 * \param  extraIes - pointer extra IEs buffer
 * \param  extraIesLen - extra IEs buffer length
 * \param  authMsg - <output> pointer of the built auth message
 * \param  authMsgLen - <output> length of the built auth message
 * 
 * \return TI_OK if auth built successfully
 *         TI_NOK otherwise
 * 
 * \sa     mlme_sendAuthRequest, mlme_sendSharedRequest
 */ 
TI_STATUS mlme_authMsgBuild(mlme_t *pMlme, legacyAuthType_e authType, TI_UINT16 seq, TI_UINT16 statusCode,
							TI_UINT8* pExtraIes, TI_UINT8 uExtraIesLen,
							TI_UINT8 *authMsg, TI_UINT16 *authMsgLen)
{
	TI_UINT8				len;
	authMsg_t				*pAuthMsg;

	pAuthMsg = (authMsg_t*)authMsg;

	/* insert algorithm */
	pAuthMsg->authAlgo = ENDIAN_HANDLE_WORD((TI_UINT16)authType);

	/* insert sequense */
	pAuthMsg->seqNum = ENDIAN_HANDLE_WORD(seq);

	/* insert status code */
	pAuthMsg->status = ENDIAN_HANDLE_WORD(statusCode);

	len = sizeof(pAuthMsg->authAlgo) + sizeof(pAuthMsg->seqNum) + sizeof(pAuthMsg->status);

	if (pExtraIes != NULL)
	{
        os_memoryCopy(pMlme->hOs, &authMsg[len], pExtraIes, uExtraIesLen);
		len += uExtraIesLen;
	}

	*authMsgLen = len;
	return TI_OK;
}
Exemplo n.º 22
0
/*                      TnetwDrv_SetInitParams()
 ****************************************************************************/
static TI_STATUS TnetwDrv_SetInitParams (TI_HANDLE hTnetwDrv, TnetwDrv_InitParams_t* pInitParams)
{
    TnetwDrv_t * pTnetwDrv = (TnetwDrv_t *)hTnetwDrv;        
    TnetwDrv_InitParams_t *pInitTableCopy;
    UINT32       index;
    
    pInitTableCopy = pTnetwDrv->pInitTableCopy = os_memoryAlloc (pTnetwDrv->hOs, sizeof(TnetwDrv_InitParams_t));
    if (pTnetwDrv->pInitTableCopy != NULL)
    {
        os_memoryZero (pTnetwDrv->hOs, pTnetwDrv->pInitTableCopy, sizeof(TnetwDrv_InitParams_t));
        /* Copy the init info to the buffer */
        os_memoryCopy (pTnetwDrv->hOs, pTnetwDrv->pInitTableCopy, pInitParams, sizeof(TnetwDrv_InitParams_t));
        /* Change the Severity table to character */ 
        for (index = 0; index < sizeof(((report_t *)pTnetwDrv->hReport)->SeverityTable); index++)
        {
            pInitTableCopy->reportParams.SeverityTable[index] += '0';
        }
        /* Change the module table to character */ 
        for (index = 0; index < sizeof(((report_t *)pTnetwDrv->hReport)->ModuleTable); index++)
        {
            pInitTableCopy->reportParams.ModuleTable[index] += '0';
        }
    }   
    else
    {
        WLAN_REPORT_ERROR(pTnetwDrv->hReport, TNETW_DRV_MODULE_LOG,
                          ("TnetwDrv_SetInitParams: unable to allocate init params buffer!\n") );
        return NOK;
    }

    return OK;
}
Exemplo n.º 23
0
/** 
 * \fn     mlme_assocSSIDBuild 
 * \brief  builds the SSID IE of assoc request 
 * 
 * builds the SSID IE of assoc request according to the mlme params 
 * 
 * \param  pCtx - pointer to mlme_t
 * \param  pSSID - <output> pointer to the built SSID buffer
 * \param  ssidLen - <output> length of the built SSID buffer

 * \return TI_OK if auth send successfully
 *         TI_NOK otherwise
 * 
 * \sa     mlme_assocRequestMsgBuild 
 */ 
TI_STATUS mlme_assocSSIDBuild(mlme_t *pCtx, TI_UINT8 *pSSID, TI_UINT32 *ssidLen)
{
    paramInfo_t         param;
    TI_STATUS               status;
    dot11_SSID_t        *pDot11Ssid;

    pDot11Ssid = (dot11_SSID_t*)pSSID;
    /* set SSID element id */
    pDot11Ssid->hdr[0] = SSID_IE_ID;

    /* get SSID */
    param.paramType = SME_DESIRED_SSID_ACT_PARAM;
    status =  sme_GetParam(pCtx->hSme, &param);
    if (status != TI_OK)
    {
        return status;
    }

    /* check for ANY ssid */
    if (param.content.smeDesiredSSID.len != 0)
    {
        pDot11Ssid->hdr[1] = param.content.smeDesiredSSID.len;
        os_memoryCopy(pCtx->hOs,
                      (void *)pDot11Ssid->serviceSetId,
                      (void *)param.content.smeDesiredSSID.str,
                      param.content.smeDesiredSSID.len);

    } else {
        /* if ANY ssid is configured, use the current SSID */
        param.paramType = SITE_MGR_CURRENT_SSID_PARAM;
        status =  siteMgr_getParam(pCtx->hSiteMgr, &param);
        if (status != TI_OK)
        {
            return status;
        }
        pDot11Ssid->hdr[1] = param.content.siteMgrCurrentSSID.len;
        os_memoryCopy(pCtx->hOs,
                      (void *)pDot11Ssid->serviceSetId,
                      (void *)param.content.siteMgrCurrentSSID.str,
                      param.content.siteMgrCurrentSSID.len);

    }

    *ssidLen = pDot11Ssid->hdr[1] + sizeof(dot11_eleHdr_t);

    return TI_OK;
}
Exemplo n.º 24
0
/***************************************************************************
*                           txCtrlParams_getParam
****************************************************************************
* DESCRIPTION:  Get a specific parameter by an external user application.
*
* OUTPUT:       pParamInfo - structure which include the value of
*               the requested parameter
***************************************************************************/
TI_STATUS txCtrlParams_getParam(TI_HANDLE hTxCtrl, paramInfo_t *pParamInfo)
{
	txCtrl_t *pTxCtrl = (txCtrl_t *)hTxCtrl;
	TI_UINT32 ac;

	if (pTxCtrl == NULL) { /* check handle validity */
		return TI_NOK;
	}

	switch (pParamInfo->paramType) {
	case TX_CTRL_COUNTERS_PARAM:
		/* Convert total-delays units from usec to mSec. */
		for (ac = 0 ; ac < MAX_NUM_OF_AC ; ac++) {
			pTxCtrl->txDataCounters[ac].SumTotalDelayMs = pTxCtrl->SumTotalDelayUs[ac] / 1000;
		}
		os_memoryCopy( pTxCtrl->hOs, pParamInfo->content.pTxDataCounters, &(pTxCtrl->txDataCounters[0]),
		               sizeof(TTxDataCounters) * MAX_NUM_OF_AC);
		pParamInfo->paramLength = sizeof(TTxDataCounters) * MAX_NUM_OF_AC;
		break;

	case TX_CTRL_GET_DATA_FRAME_COUNTER:
		pParamInfo->content.txPacketsCount = 0;
		for (ac = 0; ac < MAX_NUM_OF_AC; ac++)
			pParamInfo->content.txPacketsCount += pTxCtrl->txDataCounters[ac].XmitOk;
		break;

	case TX_CTRL_REPORT_TS_STATISTICS:
		ac = pParamInfo->content.tsMetricsCounters.acID;
		os_memoryCopy(pTxCtrl->hOs,
		              pParamInfo->content.tsMetricsCounters.pTxDataCounters,
		              &(pTxCtrl->txDataCounters[ac]),
		              sizeof(TTxDataCounters));
		os_memoryZero(pTxCtrl->hOs, &(pTxCtrl->txDataCounters[ac]), sizeof(TTxDataCounters));
		break;

	case TX_CTRL_GENERIC_ETHERTYPE:
		pParamInfo->content.txGenericEthertype = pTxCtrl->genericEthertype;
		break;


	default:
		return PARAM_NOT_SUPPORTED;

	}

	return TI_OK;
}
Exemplo n.º 25
0
/**
*
* mainSecSmNull_setKey
*
* \b Description: 
*
* Start the NULL main security SM. Reports success to the rsn module immediately.
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  TI_OK on success, TI_NOK otherwise.
*
* \sa 
*/
TI_STATUS mainSecKeysOnly_setSessionKey(mainSec_t * pMainSec, TI_UINT8 * pKey,
					TI_UINT8 keyLen)
{
	os_memoryCopy(pMainSec->hOs, pMainSec->sessionKey, pKey, keyLen);
	pMainSec->sessionKeyLen = keyLen;

	return TI_OK;
}
TI_STATUS keyDeriveWep_derive(struct _keyDerive_t *pKeyDerive, encodedKeyMaterial_t *pEncodedKey)
{
	TI_STATUS status;
	TSecurityKeys	key;
	struct _admCtrl_t *admCtrl = NULL;

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

	if ((pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_40) &&
	        (pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_104) &&
	        (pEncodedKey->keyLen != DERIVE_WEP_KEY_LEN_232)) {
		TRACE1(pKeyDerive->hReport, REPORT_SEVERITY_ERROR, "DeriveWep_derive: ERROR: it is not WEP key lenghth (len=%d) !!!\n", pEncodedKey->keyLen);
		return TI_NOK;
	}

	// If using TSN Set the WEP key as a mapped key to the BCast address */
	if(pKeyDerive->pMainKeys->pParent &&
	   pKeyDerive->pMainKeys->pParent->pParent) {
		admCtrl = pKeyDerive->pMainKeys->pParent->pParent->pAdmCtrl;
	}

	if(admCtrl && (
	   admCtrl->unicastSuite == TWD_CIPHER_AES_CCMP ||
	   admCtrl->unicastSuite == TWD_CIPHER_TKIP)) {
		key.macAddress[0] = 0xff;
		key.macAddress[1] = 0xff;
		key.macAddress[2] = 0xff;
		key.macAddress[3] = 0xff;
		key.macAddress[4] = 0xff;
		key.macAddress[5] = 0xff;
	}

	key.keyType = KEY_WEP;
	key.keyIndex = (TI_UINT8)pEncodedKey->keyId;
	key.encLen = (TI_UINT16)pEncodedKey->keyLen;
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey, pEncodedKey->pData, pEncodedKey->keyLen);

	status = pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	if (status == TI_OK) {
		os_memoryCopy(pKeyDerive->hOs, &pKeyDerive->key, pEncodedKey, sizeof(encodedKeyMaterial_t));
	}

	return status;
}
Exemplo n.º 27
0
TI_STATUS keyDeriveTkip_derive(struct _keyDerive_t * pKeyDerive,
			       encodedKeyMaterial_t * pEncodedKey)
{
	TI_STATUS status;
	TSecurityKeys key;
	keyMaterialTkip_t *keyMaterialTkip;

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

	key.keyType = KEY_TKIP;
	key.keyIndex = (TI_UINT8) pEncodedKey->keyId;
	key.encLen = KEY_DERIVE_TKIP_ENC_LEN;

	/* Note: Reduce 2 bytes from the size of keyMaterialTkip_t in the following check, 
	   because it is added as padding at the end due to the OS_PACKED removal. */
	if (pEncodedKey->keyLen < (sizeof(keyMaterialTkip_t) - 2)) {
		TRACE1(pKeyDerive->hReport, REPORT_SEVERITY_ERROR,
		       "KEY_DERIVE_TKIP: ERROR: wrong key length %d !!!\n",
		       pEncodedKey->keyLen);
		return TI_NOK;
	}

	keyMaterialTkip = (keyMaterialTkip_t *) pEncodedKey->pData;
	/* Copy encryption key */
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey,
		      (void *)keyMaterialTkip->encKey, KEY_DERIVE_TKIP_ENC_LEN);
	if (pEncodedKey->keyId & 0x10000000) {	/* Copy MIC RX */
		os_memoryCopy(pKeyDerive->hOs, (void *)key.micTxKey,
			      (void *)keyMaterialTkip->micRxKey,
			      KEY_DERIVE_TKIP_MIC_LEN);
		/* Copy MIC RX */
		os_memoryCopy(pKeyDerive->hOs, (void *)key.micRxKey,
			      (void *)keyMaterialTkip->micTxKey,
			      KEY_DERIVE_TKIP_MIC_LEN);
	} else {		/* Copy MIC RX */
		os_memoryCopy(pKeyDerive->hOs, (void *)key.micRxKey,
			      (void *)keyMaterialTkip->micRxKey,
			      KEY_DERIVE_TKIP_MIC_LEN);
		/* Copy MIC RX */
		os_memoryCopy(pKeyDerive->hOs, (void *)key.micTxKey,
			      (void *)keyMaterialTkip->micTxKey,
			      KEY_DERIVE_TKIP_MIC_LEN);
	}

	/* Copy MAC address key */
	MAC_COPY(key.macAddress, keyMaterialTkip->macAddress);
	/* Copy RSC */
	os_memoryCopy(pKeyDerive->hOs, (void *)key.keyRsc,
		      (void *)keyMaterialTkip->keyRSC, KEY_RSC_LEN);

	status = pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	if (status == TI_OK) {
		os_memoryCopy(pKeyDerive->hOs, &pKeyDerive->key, pEncodedKey,
			      sizeof(encodedKeyMaterial_t));
	}

	return status;
}
Exemplo n.º 28
0
TI_STATUS keyDeriveAes_derive(struct _keyDerive_t *pKeyDerive, encodedKeyMaterial_t *pEncodedKey)
{
	TI_STATUS status;
	TSecurityKeys	key;
	keyMaterialAes_t   *keyMaterialAes = NULL;
	
	/* Small verification */
	if ((pEncodedKey==NULL) || (pKeyDerive == NULL))
	{
		return TI_NOK;
	}
	
    /* Note: Reduce 2 bytes from the size of keyMaterialAes_t in the following check, 
	         because it is added as padding at the end due to the OS_PACKED removal. */
    if ( pEncodedKey->keyLen < (sizeof(keyMaterialAes_t) - 2) )
	{
TRACE1(pKeyDerive->hReport, REPORT_SEVERITY_ERROR, "KEY_DERIVE_AES: ERROR: wrong key length %d !!!\n",						pEncodedKey->keyLen);
		return TI_NOK;
	}

	keyMaterialAes = (keyMaterialAes_t*)pEncodedKey->pData;

	
	/* Fill security key structure */
	os_memoryZero(pKeyDerive->hOs, &key, sizeof(TSecurityKeys));

	key.keyType   = KEY_AES;
	key.keyIndex  = (TI_UINT8)pEncodedKey->keyId;
	key.encLen    = DERIVE_AES_KEY_LEN;
	os_memoryCopy(pKeyDerive->hOs, (void *)key.encKey, pEncodedKey->pData + MAC_ADDR_LEN+KEY_RSC_LEN, 
		          DERIVE_AES_KEY_LEN);

	/* Copy MAC address key */
	MAC_COPY (key.macAddress, keyMaterialAes->macAddress);
	/* Copy RSC */
	os_memoryCopy(pKeyDerive->hOs, (void *)key.keyRsc, (void *)keyMaterialAes->keyRSC, KEY_RSC_LEN);

	status = pKeyDerive->pMainKeys->setKey(pKeyDerive->pMainKeys, &key);
	if (status == TI_OK)
	{
		os_memoryCopy(pKeyDerive->hOs, &pKeyDerive->key, pEncodedKey, sizeof(encodedKeyMaterial_t));
	}
	
	return status;
}
Exemplo n.º 29
0
/************************************************************************
 *                        report_create                                 *
 ************************************************************************/
handle_t report_Create (handle_t hOs)
{
    TReport *pReport;

    pReport = os_memoryAlloc(hOs, sizeof(TReport));
    if (!pReport)
    {
        return NULL;
    }

    pReport->hOs = hOs;

    os_memoryZero(hOs, pReport->aSeverityTable, sizeof(pReport->aSeverityTable));
    os_memoryZero(hOs, pReport->aModuleTable, sizeof(pReport->aModuleTable));

    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[NAVC_MODULE_LOG]), "NAVC  ",       sizeof("NAVC  "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[BT_MODULE_LOG]),   "BT       ",    sizeof("BT       "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[FM_MODULE_LOG]),   "FM  ",         sizeof("FM  "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[MCPF_MODULE_LOG]), "MCPF      ",   sizeof("MCPF      "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[TRANS_MODULE_LOG]), "TRANS   ",    sizeof("TRANS   "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[QUEUE_MODULE_LOG]), "QUEUE      ", sizeof("QUEUE      "));
    os_memoryCopy(hOs, (void *)(pReport->aModuleDesc[REPORT_MODULE_LOG]), "REPORT     ", sizeof("REPORT     "));
        
    return (handle_t)pReport;
}
Exemplo n.º 30
0
/***************************************************************************
*					SoftGemini_setParamsToFW					    	       *
****************************************************************************
* DESCRIPTION:	The function sets the FW with the appropriate parameters set.  
*
* INPUTS:		pSoftGemini - the object
*
*
* OUTPUT:			
* 
* RETURNS:		
***************************************************************************/
static TI_STATUS SoftGemini_setParamsToFW(TI_HANDLE hSoftGemini, TSoftGeminiParams *softGeminiParams)
{
	SoftGemini_t *pSoftGemini = (SoftGemini_t *)hSoftGemini;
	TTwdParamInfo param;

	os_memoryCopy(pSoftGemini->hOs,&param.content.SoftGeminiParam, softGeminiParams, sizeof(TSoftGeminiParams));
	param.paramType = TWD_SG_CONFIG_PARAM_ID;
	return TWD_SetParam (pSoftGemini->hTWD, &param);
}