qcacmn: Setkey convergence for TLV and non-TLV boards
Changes to use single structure for setkey in TLV and non-TLV cases. Change-Id: I4cb249ec15beeced5223d8593a3a7fdb5645462c CRs-fixed: 1117377
This commit is contained in:

committed by
qcabuildsw

parent
7deb4b3287
commit
bdee34067b
@@ -4297,27 +4297,6 @@ QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
|
|||||||
return QDF_STATUS_E_FAILURE;
|
return QDF_STATUS_E_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* wmi_unified_vdev_install_key_cmd_send() - WMI install key function
|
|
||||||
* @param wmi_handle : handle to WMI.
|
|
||||||
* @param macaddr : MAC address
|
|
||||||
* @param param : pointer to hold key parameter
|
|
||||||
*
|
|
||||||
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
|
|
||||||
*/
|
|
||||||
QDF_STATUS wmi_unified_vdev_install_key_cmd_send(void *wmi_hdl,
|
|
||||||
uint8_t macaddr[IEEE80211_ADDR_LEN],
|
|
||||||
struct vdev_install_key_params *param)
|
|
||||||
{
|
|
||||||
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
|
|
||||||
|
|
||||||
if (wmi_handle->ops->send_vdev_install_key_cmd)
|
|
||||||
return wmi_handle->ops->send_vdev_install_key_cmd(wmi_handle,
|
|
||||||
macaddr, param);
|
|
||||||
|
|
||||||
return QDF_STATUS_E_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wmi_unified_pdev_set_regdomain_params_cmd_send() - WMI set regdomain function
|
* wmi_unified_pdev_set_regdomain_params_cmd_send() - WMI set regdomain function
|
||||||
* @param wmi_handle : handle to WMI.
|
* @param wmi_handle : handle to WMI.
|
||||||
|
@@ -313,55 +313,24 @@ QDF_STATUS send_vdev_config_ratemask_cmd_non_tlv(wmi_unified_t wmi_handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send_vdev_install_key_cmd_non_tlv() - config security key in fw
|
* send_setup_install_key_cmd_non_tlv() - config security key in fw
|
||||||
* @wmi_handle: wmi handle
|
* @wmi_handle: wmi handle
|
||||||
* @param: pointer to hold key params
|
* @param: pointer to hold key params
|
||||||
* @macaddr: vdev mac address
|
* @macaddr: vdev mac address
|
||||||
*
|
*
|
||||||
* Return: 0 for success or error code
|
* Return: 0 for success or error code
|
||||||
*/
|
*/
|
||||||
QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
QDF_STATUS send_setup_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
||||||
uint8_t macaddr[IEEE80211_ADDR_LEN],
|
struct set_key_params *param)
|
||||||
struct vdev_install_key_params *param)
|
|
||||||
{
|
{
|
||||||
wmi_vdev_install_key_cmd *cmd;
|
wmi_vdev_install_key_cmd *cmd;
|
||||||
wmi_buf_t buf;
|
wmi_buf_t buf;
|
||||||
/* length depends on ieee key length */
|
/* length depends on ieee key length */
|
||||||
int len = sizeof(wmi_vdev_install_key_cmd) + param->wk_keylen;
|
int len = sizeof(wmi_vdev_install_key_cmd) + param->key_len;
|
||||||
uint8_t wmi_cipher_type;
|
uint8_t wmi_cipher_type;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Cipher MAP has to be in the same order as ieee80211_cipher_type */
|
wmi_cipher_type = param->key_cipher;
|
||||||
static const u_int8_t wmi_ciphermap[] = {
|
|
||||||
WMI_CIPHER_WEP, /* IEEE80211_CIPHER_WEP */
|
|
||||||
WMI_CIPHER_TKIP, /* IEEE80211_CIPHER_TKIP */
|
|
||||||
WMI_CIPHER_AES_OCB, /* IEEE80211_CIPHER_AES_OCB */
|
|
||||||
WMI_CIPHER_AES_CCM, /* IEEE80211_CIPHER_AES_CCM */
|
|
||||||
#if ATH_SUPPORT_WAPI
|
|
||||||
WMI_CIPHER_WAPI, /* IEEE80211_CIPHER_WAPI */
|
|
||||||
#else
|
|
||||||
(u_int8_t) 0xff, /* IEEE80211_CIPHER_WAPI */
|
|
||||||
#endif
|
|
||||||
WMI_CIPHER_CKIP, /* IEEE80211_CIPHER_CKIP */
|
|
||||||
WMI_CIPHER_AES_CMAC,
|
|
||||||
WMI_CIPHER_AES_CCM, /* IEEE80211_CIPHER_AES_CCM 256 */
|
|
||||||
WMI_CIPHER_AES_CMAC,
|
|
||||||
WMI_CIPHER_AES_GCM, /* IEEE80211_CIPHER_AES_GCM */
|
|
||||||
WMI_CIPHER_AES_GCM, /* IEEE80211_CIPHER_AES_GCM 256 */
|
|
||||||
WMI_CIPHER_AES_GMAC,
|
|
||||||
WMI_CIPHER_AES_GMAC,
|
|
||||||
WMI_CIPHER_NONE, /* IEEE80211_CIPHER_NONE */
|
|
||||||
};
|
|
||||||
|
|
||||||
if (param->force_none == 1) {
|
|
||||||
wmi_cipher_type = WMI_CIPHER_NONE;
|
|
||||||
} else if ((!param->is_host_based_crypt)) {
|
|
||||||
KASSERT(param->ic_cipher <
|
|
||||||
(sizeof(wmi_ciphermap)/sizeof(wmi_ciphermap[0])),
|
|
||||||
("invalid cipher type %u", param->ic_cipher));
|
|
||||||
wmi_cipher_type = wmi_ciphermap[param->ic_cipher];
|
|
||||||
} else
|
|
||||||
wmi_cipher_type = WMI_CIPHER_NONE;
|
|
||||||
|
|
||||||
/* ieee_key length does not have mic keylen */
|
/* ieee_key length does not have mic keylen */
|
||||||
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
||||||
@@ -376,45 +345,28 @@ QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
|||||||
}
|
}
|
||||||
cmd = (wmi_vdev_install_key_cmd *)wmi_buf_data(buf);
|
cmd = (wmi_vdev_install_key_cmd *)wmi_buf_data(buf);
|
||||||
|
|
||||||
cmd->vdev_id = param->if_id;
|
cmd->vdev_id = param->vdev_id;
|
||||||
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
|
WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_mac, &cmd->peer_macaddr);
|
||||||
|
|
||||||
|
cmd->key_ix = param->key_idx;
|
||||||
|
|
||||||
/* Mapping ieee key flags to WMI key flags */
|
|
||||||
if (param->is_group_key) {
|
|
||||||
cmd->key_flags |= GROUP_USAGE;
|
|
||||||
/* send the ieee keyix for multicast */
|
|
||||||
cmd->key_ix = param->wk_keyix;
|
|
||||||
} else if (param->is_xmit_or_recv_key) {
|
|
||||||
cmd->key_flags |= PAIRWISE_USAGE;
|
|
||||||
/* Target expects keyix 0 for unicast
|
|
||||||
other than static wep cipher */
|
|
||||||
if (param->wk_keyix >= (IEEE80211_WEP_NKID + 1))
|
|
||||||
cmd->key_ix = 0;
|
|
||||||
else
|
|
||||||
cmd->key_ix = param->wk_keyix;
|
|
||||||
}
|
|
||||||
/* If this WEP key is the default xmit key, TX_USAGE flag is enabled */
|
/* If this WEP key is the default xmit key, TX_USAGE flag is enabled */
|
||||||
if (param->def_keyid == 1)
|
cmd->key_flags = param->key_flags;
|
||||||
cmd->key_flags |= TX_USAGE;
|
|
||||||
|
|
||||||
cmd->key_len = param->wk_keylen;
|
cmd->key_len = param->key_len;
|
||||||
cmd->key_cipher = wmi_cipher_type;
|
cmd->key_cipher = wmi_cipher_type;
|
||||||
/* setting the mic lengths. Just Added for TKIP alone */
|
cmd->key_txmic_len = param->key_txmic_len;
|
||||||
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
cmd->key_rxmic_len = param->key_rxmic_len;
|
||||||
(wmi_cipher_type == WMI_CIPHER_WAPI)) {
|
|
||||||
cmd->key_txmic_len = 8;
|
|
||||||
cmd->key_rxmic_len = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* target will use the same rsc counter for
|
/* target will use the same rsc counter for
|
||||||
various tids from from ieee key rsc */
|
various tids from from ieee key rsc */
|
||||||
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
||||||
(wmi_cipher_type == WMI_CIPHER_AES_OCB)
|
(wmi_cipher_type == WMI_CIPHER_AES_OCB)
|
||||||
|| (wmi_cipher_type == WMI_CIPHER_AES_CCM)) {
|
|| (wmi_cipher_type == WMI_CIPHER_AES_CCM)) {
|
||||||
qdf_mem_copy(&cmd->key_rsc_counter, ¶m->wk_keyrsc[0],
|
qdf_mem_copy(&cmd->key_rsc_counter, ¶m->key_rsc_counter[0],
|
||||||
sizeof(param->wk_keyrsc[0]));
|
sizeof(param->key_rsc_counter[0]));
|
||||||
qdf_mem_copy(&cmd->key_tsc_counter, ¶m->wk_keytsc,
|
qdf_mem_copy(&cmd->key_tsc_counter, ¶m->key_tsc_counter,
|
||||||
sizeof(param->wk_keytsc));
|
sizeof(param->key_tsc_counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ATH_SUPPORT_WAPI
|
#ifdef ATH_SUPPORT_WAPI
|
||||||
@@ -429,11 +381,11 @@ QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
|||||||
*/
|
*/
|
||||||
for (i = (WPI_IV_LEN-1), j = 0; i >= 0; i--, j++)
|
for (i = (WPI_IV_LEN-1), j = 0; i >= 0; i--, j++)
|
||||||
*(((uint8_t *)&cmd->wpi_key_rsc_counter)+j) =
|
*(((uint8_t *)&cmd->wpi_key_rsc_counter)+j) =
|
||||||
param->wk_recviv[i];
|
param->rx_iv[i];
|
||||||
|
|
||||||
for (i = (WPI_IV_LEN/4-1), j = 0; i >= 0; i--, j++)
|
for (i = (WPI_IV_LEN/4-1), j = 0; i >= 0; i--, j++)
|
||||||
*(((uint32_t *)&cmd->wpi_key_tsc_counter)+j) =
|
*(((uint32_t *)&cmd->wpi_key_tsc_counter)+j) =
|
||||||
param->wk_txiv[i];
|
param->tx_iv[i];
|
||||||
|
|
||||||
qdf_print("RSC:");
|
qdf_print("RSC:");
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
@@ -449,12 +401,7 @@ QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for big endian host, copy engine byte_swap is enabled
|
qdf_mem_copy(cmd->key_data, param->key_data,
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(cmd->key_data, param->key_data,
|
|
||||||
cmd->key_len);
|
cmd->key_len);
|
||||||
|
|
||||||
return wmi_unified_cmd_send(wmi_handle, buf, len,
|
return wmi_unified_cmd_send(wmi_handle, buf, len,
|
||||||
@@ -7962,7 +7909,8 @@ struct wmi_ops non_tlv_ops = {
|
|||||||
.send_vdev_set_fwtest_param_cmd =
|
.send_vdev_set_fwtest_param_cmd =
|
||||||
send_vdev_set_fwtest_param_cmd_non_tlv,
|
send_vdev_set_fwtest_param_cmd_non_tlv,
|
||||||
.send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_non_tlv,
|
.send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_non_tlv,
|
||||||
.send_vdev_install_key_cmd = send_vdev_install_key_cmd_non_tlv,
|
.send_setup_install_key_cmd =
|
||||||
|
send_setup_install_key_cmd_non_tlv,
|
||||||
.send_wow_wakeup_cmd = send_wow_wakeup_cmd_non_tlv,
|
.send_wow_wakeup_cmd = send_wow_wakeup_cmd_non_tlv,
|
||||||
.send_wow_add_wakeup_event_cmd = send_wow_add_wakeup_event_cmd_non_tlv,
|
.send_wow_add_wakeup_event_cmd = send_wow_add_wakeup_event_cmd_non_tlv,
|
||||||
.send_wow_add_wakeup_pattern_cmd =
|
.send_wow_add_wakeup_pattern_cmd =
|
||||||
|
@@ -4083,7 +4083,7 @@ QDF_STATUS send_probe_rsp_tmpl_send_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_WLAN_WAPI
|
#if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI)
|
||||||
#define WPI_IV_LEN 16
|
#define WPI_IV_LEN 16
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4153,8 +4153,6 @@ QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
cmd->vdev_id = key_params->vdev_id;
|
cmd->vdev_id = key_params->vdev_id;
|
||||||
cmd->key_ix = key_params->key_idx;
|
cmd->key_ix = key_params->key_idx;
|
||||||
|
|
||||||
if (key_params->key_idx >= (IEEE80211_WEP_NKID + 1))
|
|
||||||
cmd->key_ix = 0;
|
|
||||||
|
|
||||||
WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr);
|
WMI_CHAR_ARRAY_TO_MAC_ADDR(key_params->peer_mac, &cmd->peer_macaddr);
|
||||||
cmd->key_flags |= key_params->key_flags;
|
cmd->key_flags |= key_params->key_flags;
|
||||||
@@ -4164,7 +4162,7 @@ QDF_STATUS send_setup_install_key_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
cmd->key_txmic_len = key_params->key_txmic_len;
|
cmd->key_txmic_len = key_params->key_txmic_len;
|
||||||
cmd->key_rxmic_len = key_params->key_rxmic_len;
|
cmd->key_rxmic_len = key_params->key_rxmic_len;
|
||||||
}
|
}
|
||||||
#ifdef FEATURE_WLAN_WAPI
|
#if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI)
|
||||||
wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter,
|
wmi_update_wpi_key_counter(cmd->wpi_key_tsc_counter,
|
||||||
key_params->tx_iv,
|
key_params->tx_iv,
|
||||||
cmd->wpi_key_rsc_counter,
|
cmd->wpi_key_rsc_counter,
|
||||||
|
Reference in New Issue
Block a user