|
@@ -1904,51 +1904,6 @@ void wma_update_frag_params(tp_wma_handle wma, uint32_t value)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#ifndef CRYPTO_SET_KEY_CONVERGED
|
|
|
-
|
|
|
- * wma_read_cfg_wepkey() - fill key_info for WEP key
|
|
|
- * @wma_handle: wma handle
|
|
|
- * @key_info: key_info ptr
|
|
|
- * @def_key_idx: default key index
|
|
|
- * @num_keys: number of keys
|
|
|
- * @vdev: vdev pointer
|
|
|
- *
|
|
|
- * This function reads WEP keys from cfg and fills
|
|
|
- * up key_info.
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_read_cfg_wepkey(tp_wma_handle wma_handle,
|
|
|
- tSirKeys *key_info, uint32_t *def_key_idx,
|
|
|
- uint8_t *num_keys,
|
|
|
- struct wlan_objmgr_vdev *vdev)
|
|
|
-{
|
|
|
- QDF_STATUS status;
|
|
|
- qdf_size_t val = SIR_MAC_KEY_LENGTH;
|
|
|
- uint8_t i, j;
|
|
|
- struct mac_context *mac_ctx = wma_handle->mac_context;
|
|
|
-
|
|
|
- WMA_LOGD("Reading WEP keys from cfg");
|
|
|
-
|
|
|
-
|
|
|
- *def_key_idx = mac_ctx->mlme_cfg->wep_params.wep_default_key_id;
|
|
|
-
|
|
|
- for (i = 0, j = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++) {
|
|
|
- status = mlme_get_wep_key(vdev, &mac_ctx->mlme_cfg->wep_params,
|
|
|
- (MLME_WEP_DEFAULT_KEY_1 +
|
|
|
- i), key_info[j].key, &val);
|
|
|
- if (QDF_IS_STATUS_ERROR(status)) {
|
|
|
- WMA_LOGE("WEP key is not configured at :%d", i);
|
|
|
- } else {
|
|
|
- key_info[j].keyId = i;
|
|
|
- key_info[j].keyLength = (uint16_t) val;
|
|
|
- j++;
|
|
|
- }
|
|
|
- }
|
|
|
- *num_keys = j;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
#ifdef FEATURE_WLAN_WAPI
|
|
|
#define WPI_IV_LEN 16
|
|
|
#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
|
|
@@ -2031,284 +1986,6 @@ static inline void wma_fill_in_wapi_key_params(
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
-#ifndef CRYPTO_SET_KEY_CONVERGED
|
|
|
-
|
|
|
- * wma_skip_bip_key_set() - skip the BIP key step or not
|
|
|
- * @wma_handle: wma handle
|
|
|
- * @iface: txrx node
|
|
|
- * @key_cipher: key cipher
|
|
|
- *
|
|
|
- * if target not support the BIP key cipher, skip the set key command.
|
|
|
- *
|
|
|
- * Return: true to skip set key to target, otherwise set key to target
|
|
|
- */
|
|
|
-static bool
|
|
|
-wma_skip_bip_key_set(tp_wma_handle wma_handle, uint32_t key_cipher)
|
|
|
-{
|
|
|
- if ((key_cipher == WMI_CIPHER_AES_GMAC ||
|
|
|
- key_cipher == WMI_CIPHER_BIP_GMAC_256) &&
|
|
|
- !wmi_service_enabled(wma_handle->wmi_handle,
|
|
|
- wmi_service_gmac_offload_support))
|
|
|
- return true;
|
|
|
- return false;
|
|
|
-}
|
|
|
-
|
|
|
-static void wma_set_peer_unicast_cipher(tp_wma_handle wma,
|
|
|
- struct set_key_params *params)
|
|
|
-{
|
|
|
- struct wlan_objmgr_peer *peer;
|
|
|
-
|
|
|
- peer = wlan_objmgr_get_peer(wma->psoc,
|
|
|
- wlan_objmgr_pdev_get_pdev_id(wma->pdev),
|
|
|
- params->peer_mac, WLAN_LEGACY_WMA_ID);
|
|
|
- if (!peer) {
|
|
|
- WMA_LOGE("Peer of peer_mac %pM not found", params->peer_mac);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- wlan_peer_set_unicast_cipher(peer, params->key_cipher);
|
|
|
- wlan_objmgr_peer_release_ref(peer, WLAN_LEGACY_WMA_ID);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
- * wma_setup_install_key_cmd() - set key parameters
|
|
|
- * @wma_handle: wma handle
|
|
|
- * @key_params: key parameters
|
|
|
- * @mode: op mode
|
|
|
- *
|
|
|
- * This function fills structure from information
|
|
|
- * passed in key_params.
|
|
|
- *
|
|
|
- * Return: QDF_STATUS_SUCCESS - success
|
|
|
- QDF_STATUS_E_FAILURE - failure
|
|
|
- QDF_STATUS_E_NOMEM - invalid request
|
|
|
- */
|
|
|
-static QDF_STATUS wma_setup_install_key_cmd(tp_wma_handle wma_handle,
|
|
|
- struct wma_set_key_params
|
|
|
- *key_params, uint8_t mode)
|
|
|
-{
|
|
|
- struct set_key_params params;
|
|
|
- QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
- struct wma_txrx_node *iface = NULL;
|
|
|
- enum cdp_sec_type sec_type = cdp_sec_type_none;
|
|
|
- void *soc = cds_get_context(QDF_MODULE_ID_SOC);
|
|
|
- void *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
|
|
|
- uint32_t pn[4] = {0, 0, 0, 0};
|
|
|
- struct cdp_peer *peer;
|
|
|
- bool skip_set_key;
|
|
|
-
|
|
|
- if ((key_params->key_type == eSIR_ED_NONE &&
|
|
|
- key_params->key_len) || (key_params->key_type != eSIR_ED_NONE &&
|
|
|
- !key_params->key_len)) {
|
|
|
- WMA_LOGE("%s:Invalid set key request", __func__);
|
|
|
- return QDF_STATUS_E_NOMEM;
|
|
|
- }
|
|
|
-
|
|
|
- if (!wma_handle) {
|
|
|
- WMA_LOGE(FL("Invalid wma_handle for vdev_id: %d"),
|
|
|
- key_params->vdev_id);
|
|
|
- return QDF_STATUS_E_INVAL;
|
|
|
- }
|
|
|
-
|
|
|
- if (!wma_is_vdev_valid(key_params->vdev_id)) {
|
|
|
- WMA_LOGE("%s: vdev id:%d is not active ", __func__,
|
|
|
- key_params->vdev_id);
|
|
|
- return QDF_STATUS_E_INVAL;
|
|
|
- }
|
|
|
-
|
|
|
- peer = cdp_peer_find_by_addr(soc, txrx_pdev, key_params->peer_mac);
|
|
|
- iface = &wma_handle->interfaces[key_params->vdev_id];
|
|
|
-
|
|
|
- params.vdev_id = key_params->vdev_id;
|
|
|
- params.key_idx = key_params->key_idx;
|
|
|
- qdf_mem_copy(params.peer_mac, key_params->peer_mac, QDF_MAC_ADDR_SIZE);
|
|
|
-
|
|
|
-#ifdef FEATURE_WLAN_WAPI
|
|
|
- qdf_mem_zero(params.tx_iv, 16);
|
|
|
- qdf_mem_zero(params.rx_iv, 16);
|
|
|
-#endif
|
|
|
- params.key_txmic_len = 0;
|
|
|
- params.key_rxmic_len = 0;
|
|
|
- qdf_mem_copy(¶ms.key_rsc_ctr,
|
|
|
- &key_params->key_rsc[0], sizeof(uint64_t));
|
|
|
- params.key_flags = 0;
|
|
|
- if (key_params->unicast)
|
|
|
- params.key_flags |= PAIRWISE_USAGE;
|
|
|
- else
|
|
|
- params.key_flags |= GROUP_USAGE;
|
|
|
-
|
|
|
- switch (key_params->key_type) {
|
|
|
- case eSIR_ED_NONE:
|
|
|
- params.key_cipher = WMI_CIPHER_NONE;
|
|
|
- sec_type = cdp_sec_type_none;
|
|
|
- break;
|
|
|
- case eSIR_ED_WEP40:
|
|
|
- case eSIR_ED_WEP104:
|
|
|
- params.key_cipher = WMI_CIPHER_WEP;
|
|
|
- if (key_params->unicast &&
|
|
|
- params.key_idx == key_params->def_key_idx) {
|
|
|
- WMA_LOGD("STA Mode: cmd->key_flags |= TX_USAGE");
|
|
|
- params.key_flags |= TX_USAGE;
|
|
|
- } else if ((mode == wlan_op_mode_ap) &&
|
|
|
- (params.key_idx == key_params->def_key_idx)) {
|
|
|
- WMA_LOGD("AP Mode: cmd->key_flags |= TX_USAGE");
|
|
|
- params.key_flags |= TX_USAGE;
|
|
|
- }
|
|
|
- sec_type = cdp_sec_type_wep104;
|
|
|
- break;
|
|
|
- case eSIR_ED_TKIP:
|
|
|
- params.key_txmic_len = WMA_TXMIC_LEN;
|
|
|
- params.key_rxmic_len = WMA_RXMIC_LEN;
|
|
|
- params.key_cipher = WMI_CIPHER_TKIP;
|
|
|
- sec_type = cdp_sec_type_tkip;
|
|
|
- break;
|
|
|
-#ifdef FEATURE_WLAN_WAPI
|
|
|
- case eSIR_ED_WPI:
|
|
|
- {
|
|
|
- wma_fill_in_wapi_key_params(key_params, ¶ms, mode);
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
- case eSIR_ED_CCMP:
|
|
|
- params.key_cipher = WMI_CIPHER_AES_CCM;
|
|
|
- sec_type = cdp_sec_type_aes_ccmp;
|
|
|
- break;
|
|
|
-#ifdef WLAN_FEATURE_11W
|
|
|
- case eSIR_ED_AES_128_CMAC:
|
|
|
- params.key_cipher = WMI_CIPHER_AES_CMAC;
|
|
|
- break;
|
|
|
- case eSIR_ED_AES_GMAC_128:
|
|
|
- case eSIR_ED_AES_GMAC_256:
|
|
|
- params.key_cipher = WMI_CIPHER_AES_GMAC;
|
|
|
- break;
|
|
|
-#endif
|
|
|
-
|
|
|
- case eSIR_ED_GCMP:
|
|
|
- case eSIR_ED_GCMP_256:
|
|
|
- params.key_cipher = WMI_CIPHER_AES_GCM;
|
|
|
- break;
|
|
|
- default:
|
|
|
-
|
|
|
- WMA_LOGE("%s:Invalid encryption type:%d", __func__,
|
|
|
- key_params->key_type);
|
|
|
- status = QDF_STATUS_E_NOMEM;
|
|
|
- goto end;
|
|
|
- }
|
|
|
-
|
|
|
-#ifdef BIG_ENDIAN_HOST
|
|
|
- {
|
|
|
-
|
|
|
- * But the key data content is in network byte order
|
|
|
- * Need to byte swap the key data content - so when copy engine
|
|
|
- * does byte_swap - target gets key_data content in the correct
|
|
|
- * order.
|
|
|
- */
|
|
|
- int8_t i;
|
|
|
- uint32_t *destp, *srcp;
|
|
|
-
|
|
|
- destp = (uint32_t *) params.key_data;
|
|
|
- srcp = (uint32_t *) key_params->key_data;
|
|
|
- for (i = 0;
|
|
|
- i < roundup(key_params->key_len, sizeof(uint32_t)) / 4;
|
|
|
- i++) {
|
|
|
- *destp = le32_to_cpu(*srcp);
|
|
|
- destp++;
|
|
|
- srcp++;
|
|
|
- }
|
|
|
- }
|
|
|
-#else
|
|
|
- qdf_mem_copy((void *)params.key_data,
|
|
|
- (const void *)key_params->key_data, key_params->key_len);
|
|
|
-#endif
|
|
|
- params.key_len = key_params->key_len;
|
|
|
-
|
|
|
-#ifdef WLAN_FEATURE_11W
|
|
|
- iface = &wma_handle->interfaces[key_params->vdev_id];
|
|
|
-
|
|
|
- if ((key_params->key_type == eSIR_ED_AES_128_CMAC) ||
|
|
|
- (key_params->key_type == eSIR_ED_AES_GMAC_128) ||
|
|
|
- (key_params->key_type == eSIR_ED_AES_GMAC_256)) {
|
|
|
- if (iface) {
|
|
|
- iface->key.key_length = key_params->key_len;
|
|
|
- iface->key.key_cipher = params.key_cipher;
|
|
|
- qdf_mem_copy(iface->key.key,
|
|
|
- (const void *)key_params->key_data,
|
|
|
- iface->key.key_length);
|
|
|
- if ((params.key_idx == WMA_IGTK_KEY_INDEX_4) ||
|
|
|
- (params.key_idx == WMA_IGTK_KEY_INDEX_5))
|
|
|
- qdf_mem_zero(iface->key.key_id[params.key_idx -
|
|
|
- WMA_IGTK_KEY_INDEX_4].ipn,
|
|
|
- CMAC_IPN_LEN);
|
|
|
- }
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
- if (key_params->unicast)
|
|
|
- wma_set_peer_unicast_cipher(wma_handle, ¶ms);
|
|
|
-
|
|
|
- WMA_LOGD("Key setup : vdev_id %d key_idx %d key_type %d key_len %d",
|
|
|
- key_params->vdev_id, key_params->key_idx,
|
|
|
- key_params->key_type, key_params->key_len);
|
|
|
- WMA_LOGD("unicast %d peer_mac %pM def_key_idx %d",
|
|
|
- key_params->unicast, key_params->peer_mac,
|
|
|
- key_params->def_key_idx);
|
|
|
- WMA_LOGD("keyrsc param %llu", params.key_rsc_ctr);
|
|
|
-
|
|
|
-
|
|
|
- * To prevent from any replay-attack, PN number provided by
|
|
|
- * upper layer is used.
|
|
|
- *
|
|
|
- * Plumb the PN number to HW which will be used to evaluate whether
|
|
|
- * incoming traffic is not replayed.
|
|
|
- *
|
|
|
- * supplicant would have some thing like following, example:
|
|
|
- *
|
|
|
- * num = 0x123456789ABCDEFF (64 bit number)
|
|
|
- * uint8_t keyrsc[16] would look like following
|
|
|
- *
|
|
|
- * bit 0 7 15 23 31 39 47 55 63
|
|
|
- * +------+-------+-------+-------+-------+-------+-------+-------+
|
|
|
- * byte | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|
|
|
- * +------+-------+-------+-------+-------+-------+-------+-------+
|
|
|
- * value| 0xFF | 0XDE | 0xBC | 0x9A | 0x78 | 0x56 | 0x34 | 0x12 |
|
|
|
- * +------+-------+-------+-------+-------+-------+-------+-------+
|
|
|
- */
|
|
|
- qdf_mem_copy(&pn[0],
|
|
|
- &key_params->key_rsc[0], sizeof(pn));
|
|
|
- wma_debug("key_type[%s] pn[%x:%x:%x:%x]",
|
|
|
- (key_params->unicast) ? "unicast" : "group",
|
|
|
- key_params->key_rsc[3], key_params->key_rsc[2],
|
|
|
- key_params->key_rsc[1], key_params->key_rsc[0]);
|
|
|
- cdp_set_pn_check(soc, key_params->vdev_id, key_params->peer_mac,
|
|
|
- sec_type, pn);
|
|
|
- cdp_set_key(soc, peer, key_params->unicast,
|
|
|
- (uint32_t *)(key_params->key_data +
|
|
|
- WMA_IV_KEY_LEN +
|
|
|
- WMA_TXMIC_LEN));
|
|
|
-
|
|
|
- skip_set_key = wma_skip_bip_key_set(wma_handle, params.key_cipher);
|
|
|
- if (!skip_set_key)
|
|
|
- status = wmi_unified_setup_install_key_cmd(
|
|
|
- wma_handle->wmi_handle, ¶ms);
|
|
|
-
|
|
|
- if (!key_params->unicast) {
|
|
|
-
|
|
|
- WMA_LOGD("Release set key wake lock");
|
|
|
- qdf_runtime_pm_allow_suspend(
|
|
|
- &iface->vdev_set_key_runtime_wakelock);
|
|
|
- wma_release_wakelock(&iface->vdev_set_key_wakelock);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (iface)
|
|
|
- iface->is_waiting_for_key = false;
|
|
|
-
|
|
|
-end:
|
|
|
- qdf_mem_zero(¶ms, sizeof(struct set_key_params));
|
|
|
- return status;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
#ifdef QCA_IBSS_SUPPORT
|
|
|
|
|
|
* wma_calc_ibss_heart_beat_timer() - calculate IBSS heart beat timer
|
|
@@ -2403,358 +2080,6 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-#ifndef CRYPTO_SET_KEY_CONVERGED
|
|
|
-#ifdef QCA_IBSS_SUPPORT
|
|
|
-
|
|
|
- * wma_set_ibsskey_helper() - cached IBSS key in wma handle
|
|
|
- * @wma_handle: wma handle
|
|
|
- * @key_info: set bss key info
|
|
|
- * @peerMacAddr: peer mac address
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
|
|
|
- tpSetBssKeyParams key_info,
|
|
|
- struct qdf_mac_addr peer_macaddr)
|
|
|
-{
|
|
|
- struct wma_set_key_params key_params;
|
|
|
- QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
- uint32_t i;
|
|
|
- uint32_t def_key_idx = 0;
|
|
|
- int opmode;
|
|
|
- void *soc = cds_get_context(QDF_MODULE_ID_SOC);
|
|
|
- struct wlan_objmgr_vdev *vdev;
|
|
|
-
|
|
|
- WMA_LOGD("BSS key setup for peer");
|
|
|
-
|
|
|
- qdf_mem_zero(&key_params, sizeof(key_params));
|
|
|
- opmode = cdp_get_opmode(soc, key_info->vdev_id);
|
|
|
- qdf_mem_zero(&key_params, sizeof(key_params));
|
|
|
- key_params.vdev_id = key_info->vdev_id;
|
|
|
- key_params.key_type = key_info->encType;
|
|
|
- key_params.singl_tid_rc = key_info->singleTidRc;
|
|
|
- key_params.unicast = false;
|
|
|
- ASSERT(wlan_op_mode_ibss == opmode);
|
|
|
-
|
|
|
- qdf_mem_copy(key_params.peer_mac, peer_macaddr.bytes,
|
|
|
- QDF_MAC_ADDR_SIZE);
|
|
|
-
|
|
|
- if (key_info->numKeys == 0 &&
|
|
|
- (key_info->encType == eSIR_ED_WEP40 ||
|
|
|
- key_info->encType == eSIR_ED_WEP104)) {
|
|
|
- vdev =
|
|
|
- wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc,
|
|
|
- key_info->vdev_id,
|
|
|
- WLAN_LEGACY_WMA_ID);
|
|
|
- wma_read_cfg_wepkey(wma_handle, key_info->key,
|
|
|
- &def_key_idx, &key_info->numKeys, vdev);
|
|
|
- wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
|
|
|
- } else if ((key_info->encType == eSIR_ED_WEP40) ||
|
|
|
- (key_info->encType == eSIR_ED_WEP104)) {
|
|
|
- struct wma_txrx_node *intf =
|
|
|
- &wma_handle->interfaces[key_info->vdev_id];
|
|
|
- key_params.def_key_idx = intf->wep_default_key_idx;
|
|
|
- }
|
|
|
-
|
|
|
- for (i = 0; i < key_info->numKeys; i++) {
|
|
|
- if (key_params.key_type != eSIR_ED_NONE &&
|
|
|
- !key_info->key[i].keyLength)
|
|
|
- continue;
|
|
|
- key_params.key_idx = key_info->key[i].keyId;
|
|
|
- key_params.key_len = key_info->key[i].keyLength;
|
|
|
- if (key_info->encType == eSIR_ED_TKIP) {
|
|
|
- qdf_mem_copy(key_params.key_data,
|
|
|
- key_info->key[i].key, 16);
|
|
|
- qdf_mem_copy(&key_params.key_data[16],
|
|
|
- &key_info->key[i].key[24], 8);
|
|
|
- qdf_mem_copy(&key_params.key_data[24],
|
|
|
- &key_info->key[i].key[16], 8);
|
|
|
- } else
|
|
|
- qdf_mem_copy((void *)key_params.key_data,
|
|
|
- (const void *)key_info->key[i].key,
|
|
|
- key_info->key[i].keyLength);
|
|
|
-
|
|
|
- WMA_LOGD("%s: peer bcast key[%d] length %d", __func__, i,
|
|
|
- key_info->key[i].keyLength);
|
|
|
-
|
|
|
- status = wma_setup_install_key_cmd(wma_handle, &key_params,
|
|
|
- opmode);
|
|
|
- if (status == QDF_STATUS_E_NOMEM) {
|
|
|
- WMA_LOGE("%s:Failed to setup install key buf",
|
|
|
- __func__);
|
|
|
- return;
|
|
|
- } else if (status == QDF_STATUS_E_FAILURE) {
|
|
|
- WMA_LOGE("%s:Failed to send install key command",
|
|
|
- __func__);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-#else
|
|
|
-static inline
|
|
|
-void wma_set_ibsskey_helper(tp_wma_handle wma_handle,
|
|
|
- tpSetBssKeyParams key_info,
|
|
|
- struct qdf_mac_addr peer_macaddr)
|
|
|
-{
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-void wma_set_bsskey(tp_wma_handle wma_handle, tpSetBssKeyParams key_info)
|
|
|
-{
|
|
|
- struct wma_set_key_params key_params;
|
|
|
- QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
- uint32_t i;
|
|
|
- uint32_t def_key_idx = 0;
|
|
|
- uint32_t wlan_opmode;
|
|
|
- uint8_t *mac_addr, *bssid;
|
|
|
- void *soc = cds_get_context(QDF_MODULE_ID_SOC);
|
|
|
- struct wlan_objmgr_vdev *vdev;
|
|
|
-
|
|
|
- WMA_LOGD("BSS key setup");
|
|
|
- wlan_opmode = cdp_get_opmode(soc, key_info->vdev_id);
|
|
|
-
|
|
|
-
|
|
|
- * For IBSS, WMI expects the BSS key to be set per peer key
|
|
|
- * So cache the BSS key in the wma_handle and re-use it when the
|
|
|
- * STA key is been setup for a peer
|
|
|
- */
|
|
|
- if (wlan_op_mode_ibss == wlan_opmode) {
|
|
|
- key_info->status = QDF_STATUS_SUCCESS;
|
|
|
- if (wma_handle->ibss_started > 0)
|
|
|
- goto out;
|
|
|
- WMA_LOGD("Caching IBSS Key");
|
|
|
- qdf_mem_copy(&wma_handle->ibsskey_info, key_info,
|
|
|
- sizeof(tSetBssKeyParams));
|
|
|
- }
|
|
|
-
|
|
|
- qdf_mem_zero(&key_params, sizeof(key_params));
|
|
|
- key_params.vdev_id = key_info->vdev_id;
|
|
|
- key_params.key_type = key_info->encType;
|
|
|
- key_params.singl_tid_rc = key_info->singleTidRc;
|
|
|
- key_params.unicast = false;
|
|
|
- if (wlan_opmode == wlan_op_mode_sta) {
|
|
|
- bssid = wma_get_vdev_bssid
|
|
|
- (wma_handle->interfaces[key_info->vdev_id].vdev);
|
|
|
- if (!bssid) {
|
|
|
- WMA_LOGE("%s: Failed to get bssid for vdev_%d",
|
|
|
- __func__, key_info->vdev_id);
|
|
|
- key_info->status = QDF_STATUS_E_FAILURE;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- qdf_mem_copy(key_params.peer_mac, bssid, QDF_MAC_ADDR_SIZE);
|
|
|
- } else {
|
|
|
- mac_addr = cdp_get_vdev_mac_addr(soc, key_params.vdev_id);
|
|
|
- if (!mac_addr) {
|
|
|
- WMA_LOGE("%s: mac_addr is NULL for vdev with id %d",
|
|
|
- __func__, key_info->vdev_id);
|
|
|
- goto out;
|
|
|
- }
|
|
|
-
|
|
|
- qdf_mem_copy(key_params.peer_mac, mac_addr,
|
|
|
- QDF_MAC_ADDR_SIZE);
|
|
|
- WMA_LOGD("BSS Key setup with vdev_mac %pM\n",
|
|
|
- mac_addr);
|
|
|
- }
|
|
|
-
|
|
|
- if (key_info->numKeys == 0 &&
|
|
|
- (key_info->encType == eSIR_ED_WEP40 ||
|
|
|
- key_info->encType == eSIR_ED_WEP104)) {
|
|
|
- vdev =
|
|
|
- wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc,
|
|
|
- key_info->vdev_id,
|
|
|
- WLAN_LEGACY_WMA_ID);
|
|
|
- wma_read_cfg_wepkey(wma_handle, key_info->key,
|
|
|
- &def_key_idx, &key_info->numKeys, vdev);
|
|
|
- wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
|
|
|
- } else if ((key_info->encType == eSIR_ED_WEP40) ||
|
|
|
- (key_info->encType == eSIR_ED_WEP104)) {
|
|
|
- struct wma_txrx_node *intf =
|
|
|
- &wma_handle->interfaces[key_info->vdev_id];
|
|
|
- key_params.def_key_idx = intf->wep_default_key_idx;
|
|
|
- }
|
|
|
-
|
|
|
- for (i = 0; i < key_info->numKeys; i++) {
|
|
|
- if (key_params.key_type != eSIR_ED_NONE &&
|
|
|
- !key_info->key[i].keyLength)
|
|
|
- continue;
|
|
|
- if (key_info->encType == eSIR_ED_WPI) {
|
|
|
- key_params.key_idx = key_info->key[i].keyId;
|
|
|
- key_params.def_key_idx = key_info->key[i].keyId;
|
|
|
- } else {
|
|
|
- key_params.key_idx = key_info->key[i].keyId;
|
|
|
- }
|
|
|
-
|
|
|
- key_params.key_len = key_info->key[i].keyLength;
|
|
|
- qdf_mem_copy(key_params.key_rsc,
|
|
|
- key_info->key[i].keyRsc,
|
|
|
- WLAN_CRYPTO_RSC_SIZE);
|
|
|
- if (key_info->encType == eSIR_ED_TKIP) {
|
|
|
- qdf_mem_copy(key_params.key_data,
|
|
|
- key_info->key[i].key, 16);
|
|
|
- qdf_mem_copy(&key_params.key_data[16],
|
|
|
- &key_info->key[i].key[24], 8);
|
|
|
- qdf_mem_copy(&key_params.key_data[24],
|
|
|
- &key_info->key[i].key[16], 8);
|
|
|
- } else
|
|
|
- qdf_mem_copy((void *)key_params.key_data,
|
|
|
- (const void *)key_info->key[i].key,
|
|
|
- key_info->key[i].keyLength);
|
|
|
-
|
|
|
- WMA_LOGD("%s: bss key[%d] length %d", __func__, i,
|
|
|
- key_info->key[i].keyLength);
|
|
|
-
|
|
|
- status = wma_setup_install_key_cmd(wma_handle, &key_params,
|
|
|
- wlan_opmode);
|
|
|
- if (status == QDF_STATUS_E_NOMEM) {
|
|
|
- WMA_LOGE("%s:Failed to setup install key buf",
|
|
|
- __func__);
|
|
|
- key_info->status = QDF_STATUS_E_NOMEM;
|
|
|
- goto out;
|
|
|
- } else if (status == QDF_STATUS_E_FAILURE) {
|
|
|
- WMA_LOGE("%s:Failed to send install key command",
|
|
|
- __func__);
|
|
|
- key_info->status = QDF_STATUS_E_FAILURE;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- wma_handle->ibss_started++;
|
|
|
-
|
|
|
- key_info->status = QDF_STATUS_SUCCESS;
|
|
|
-
|
|
|
- qdf_mem_zero(&key_params, sizeof(struct wma_set_key_params));
|
|
|
-
|
|
|
-out:
|
|
|
- wma_send_msg_high_priority(wma_handle, WMA_SET_BSSKEY_RSP,
|
|
|
- (void *)key_info, 0);
|
|
|
-}
|
|
|
-
|
|
|
-void wma_set_stakey(tp_wma_handle wma_handle, tpSetStaKeyParams key_info)
|
|
|
-{
|
|
|
- int32_t i;
|
|
|
- QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
- struct cdp_pdev *txrx_pdev;
|
|
|
- void *peer;
|
|
|
- uint8_t num_keys = 0;
|
|
|
- struct wma_set_key_params key_params;
|
|
|
- uint32_t def_key_idx = 0;
|
|
|
- int opmode;
|
|
|
- void *soc = cds_get_context(QDF_MODULE_ID_SOC);
|
|
|
- struct wlan_objmgr_vdev *vdev;
|
|
|
-
|
|
|
- WMA_LOGD("STA key setup");
|
|
|
-
|
|
|
-
|
|
|
- txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
|
|
|
- if (!txrx_pdev) {
|
|
|
- WMA_LOGE("%s:Invalid txrx pdev handle", __func__);
|
|
|
- key_info->status = QDF_STATUS_E_FAILURE;
|
|
|
- goto out;
|
|
|
- }
|
|
|
-
|
|
|
- peer = cdp_peer_find_by_addr(soc, txrx_pdev,
|
|
|
- key_info->peer_macaddr.bytes);
|
|
|
- if (!peer) {
|
|
|
- WMA_LOGE("%s:Invalid peer for key setting", __func__);
|
|
|
- key_info->status = QDF_STATUS_E_FAILURE;
|
|
|
- goto out;
|
|
|
- }
|
|
|
-
|
|
|
- opmode = cdp_get_opmode(soc, key_info->vdev_id);
|
|
|
-
|
|
|
- if (key_info->defWEPIdx == WMA_INVALID_KEY_IDX &&
|
|
|
- (key_info->encType == eSIR_ED_WEP40 ||
|
|
|
- key_info->encType == eSIR_ED_WEP104) &&
|
|
|
- opmode != wlan_op_mode_ap) {
|
|
|
- vdev =
|
|
|
- wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc,
|
|
|
- key_info->vdev_id,
|
|
|
- WLAN_LEGACY_WMA_ID);
|
|
|
- wma_read_cfg_wepkey(wma_handle, key_info->key,
|
|
|
- &def_key_idx, &num_keys, vdev);
|
|
|
- wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
|
|
|
- key_info->defWEPIdx = def_key_idx;
|
|
|
- } else {
|
|
|
- num_keys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
|
|
|
- if (key_info->encType != eSIR_ED_NONE) {
|
|
|
- for (i = 0; i < num_keys; i++) {
|
|
|
- if (key_info->key[i].keyDirection ==
|
|
|
- eSIR_TX_DEFAULT) {
|
|
|
- key_info->defWEPIdx = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- qdf_mem_zero(&key_params, sizeof(key_params));
|
|
|
- key_params.vdev_id = key_info->vdev_id;
|
|
|
- key_params.key_type = key_info->encType;
|
|
|
- key_params.singl_tid_rc = key_info->singleTidRc;
|
|
|
- key_params.unicast = true;
|
|
|
- key_params.def_key_idx = key_info->defWEPIdx;
|
|
|
- qdf_mem_copy((void *)key_params.peer_mac,
|
|
|
- (const void *)key_info->peer_macaddr.bytes,
|
|
|
- QDF_MAC_ADDR_SIZE);
|
|
|
- for (i = 0; i < num_keys; i++) {
|
|
|
- if (key_params.key_type != eSIR_ED_NONE &&
|
|
|
- !key_info->key[i].keyLength)
|
|
|
- continue;
|
|
|
- if (key_info->encType == eSIR_ED_TKIP) {
|
|
|
- qdf_mem_copy(key_params.key_data,
|
|
|
- key_info->key[i].key, 16);
|
|
|
- qdf_mem_copy(&key_params.key_data[16],
|
|
|
- &key_info->key[i].key[24], 8);
|
|
|
- qdf_mem_copy(&key_params.key_data[24],
|
|
|
- &key_info->key[i].key[16], 8);
|
|
|
- } else
|
|
|
- qdf_mem_copy(key_params.key_data, key_info->key[i].key,
|
|
|
- key_info->key[i].keyLength);
|
|
|
- if (key_info->encType == eSIR_ED_WPI) {
|
|
|
- key_params.key_idx = key_info->key[i].keyId;
|
|
|
- key_params.def_key_idx = key_info->key[i].keyId;
|
|
|
- } else
|
|
|
- key_params.key_idx = i;
|
|
|
-
|
|
|
- key_params.key_len = key_info->key[i].keyLength;
|
|
|
- status = wma_setup_install_key_cmd(wma_handle, &key_params,
|
|
|
- opmode);
|
|
|
- if (status == QDF_STATUS_E_NOMEM) {
|
|
|
- WMA_LOGE("%s:Failed to setup install key buf",
|
|
|
- __func__);
|
|
|
- key_info->status = QDF_STATUS_E_NOMEM;
|
|
|
- goto out;
|
|
|
- }
|
|
|
-
|
|
|
- WMA_LOGD("%s: peer unicast key[%d] %d ", __func__, i,
|
|
|
- key_info->key[i].keyLength);
|
|
|
-
|
|
|
- if (status == QDF_STATUS_E_FAILURE) {
|
|
|
- WMA_LOGE("%s:Failed to send install key command",
|
|
|
- __func__);
|
|
|
- key_info->status = QDF_STATUS_E_FAILURE;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * BSS key is supposed to be cache into wma_handle
|
|
|
- */
|
|
|
- if (wlan_op_mode_ibss == opmode) {
|
|
|
- wma_set_ibsskey_helper(wma_handle, &wma_handle->ibsskey_info,
|
|
|
- key_info->peer_macaddr);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- key_info->status = QDF_STATUS_SUCCESS;
|
|
|
-out:
|
|
|
- qdf_mem_zero(&key_params, sizeof(struct wma_set_key_params));
|
|
|
- if (key_info->sendRsp)
|
|
|
- wma_send_msg_high_priority(wma_handle, WMA_SET_STAKEY_RSP,
|
|
|
- (void *)key_info, 0);
|
|
|
- else
|
|
|
- qdf_mem_free(key_info);
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
|
|
|
* wma_process_update_edca_param_req() - update EDCA params
|
|
|
* @handle: wma handle
|