eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tAniKeyDirection tmpDirection; //tANI_U8 *pBuf; tANI_U8 *p = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); int i = 0; smsLog(pMac, LOGE, FL("keyLength %d\n"), pFTKeyInfo->keyLength); for(i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOGE, FL("%02x"), pFTKeyInfo->Key[i]); msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key ); status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); if ( !HAL_STATUS_SUCCESS(status) ) { return eHAL_STATUS_FAILURE; } palZeroMemory(pMac->hHdd, pMsg, msgLen); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); p = (tANI_U8 *)&pMsg->keyMaterial; // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field // in the tSirKeyMaterial keyMaterial; field). // // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be // shorter than this max size. Is LIM interpreting this ok ? p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + ( pMsg->keyMaterial.numKeys * sizeof( pMsg->keyMaterial.key ) ) )) ); // set pMsg->keyMaterial.edType edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); p += sizeof( pMsg->keyMaterial.edType ); // set the pMsg->keyMaterial.numKeys field *p = pMsg->keyMaterial.numKeys; p += sizeof( pMsg->keyMaterial.numKeys ); // set pSirKey->keyId = keyId; *p = pMsg->keyMaterial.key[ 0 ].keyId; p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); // set pSirKey->unicast = (tANI_U8)fUnicast; *p = (tANI_U8)eANI_BOOLEAN_TRUE; p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); // set pSirKey->keyDirection = aniKeyDirection; tmpDirection = pal_cpu_to_be32(pFTKeyInfo->keyDirection); palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); p += sizeof(tAniKeyDirection); // pSirKey->keyRsc = ;; palCopyMemory( pMac->hHdd, p, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN ); p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); // set pSirKey->paeRole *p = pFTKeyInfo->paeRole; // 0 is Supplicant p++; // set pSirKey->keyLength = keyLength; p = pal_set_U16( p, pal_cpu_to_be16(pFTKeyInfo->keyLength) ); if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { palCopyMemory( pMac->hHdd, p, pFTKeyInfo->Key, pFTKeyInfo->keyLength ); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOGE, " SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n", pFTKeyInfo->keyId, edType, pFTKeyInfo->Key[0], pFTKeyInfo->Key[1], pFTKeyInfo->Key[2], pFTKeyInfo->Key[3], pFTKeyInfo->Key[4], pFTKeyInfo->Key[5], pFTKeyInfo->Key[6], pFTKeyInfo->Key[7], pFTKeyInfo->Key[8], pFTKeyInfo->Key[9], pFTKeyInfo->Key[10], pFTKeyInfo->Key[11], pFTKeyInfo->Key[12], pFTKeyInfo->Key[13], pFTKeyInfo->Key[14], pFTKeyInfo->Key[15]); } } status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }
eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tSirKeyMaterial *keymaterial = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG int i = 0; smsLog(pMac, LOG1, FL("keyLength %d"), pFTKeyInfo->keyLength); for (i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOG1, FL("%02x"), pFTKeyInfo->Key[i]); #endif msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key ); pMsg = vos_mem_malloc(msgLen); if ( NULL == pMsg ) { return eHAL_STATUS_FAILURE; } vos_mem_set(pMsg, msgLen, 0); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); keymaterial = &pMsg->keyMaterial; keymaterial->length = pFTKeyInfo->keyLength; edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); keymaterial->edType = tmpEdType; // Set the pMsg->keyMaterial.length field (this length is defined as all // data that follows the edType field // in the tSirKeyMaterial keyMaterial; field). // // !!NOTE: This keyMaterial.length contains the length of a MAX size key, // though the keyLength can be // shorter than this max size. Is LIM interpreting this ok ? keymaterial->numKeys = 1; keymaterial->key[ 0 ].keyId = pFTKeyInfo->keyId; keymaterial->key[ 0 ].unicast = (tANI_U8)eANI_BOOLEAN_TRUE; keymaterial->key[ 0 ].keyDirection = pFTKeyInfo->keyDirection; vos_mem_copy(&keymaterial->key[ 0 ].keyRsc, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN); keymaterial->key[ 0 ].paeRole = pFTKeyInfo->paeRole; keymaterial->key[ 0 ].keyLength = pFTKeyInfo->keyLength; if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { vos_mem_copy(&keymaterial->key[ 0 ].key, pFTKeyInfo->Key, pFTKeyInfo->keyLength); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOG1, "SME Set Update Ind keyIdx (%d) encType(%d) key = " "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", pMsg->keyMaterial.key[0].keyId, (tAniEdType)pMsg->keyMaterial.edType, pMsg->keyMaterial.key[0].key[0], pMsg->keyMaterial.key[0].key[1], pMsg->keyMaterial.key[0].key[2], pMsg->keyMaterial.key[0].key[3], pMsg->keyMaterial.key[0].key[4], pMsg->keyMaterial.key[0].key[5], pMsg->keyMaterial.key[0].key[6], pMsg->keyMaterial.key[0].key[7], pMsg->keyMaterial.key[0].key[8], pMsg->keyMaterial.key[0].key[9], pMsg->keyMaterial.key[0].key[10], pMsg->keyMaterial.key[0].key[11], pMsg->keyMaterial.key[0].key[12], pMsg->keyMaterial.key[0].key[13], pMsg->keyMaterial.key[0].key[14], pMsg->keyMaterial.key[0].key[15]); } } vos_mem_copy( &pMsg->bssId[ 0 ], &pFTKeyInfo->peerMac[ 0 ], sizeof(tCsrBssid) ); smsLog(pMac, LOG1, "BSSID = "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssId)); status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }