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
2c8d2e0c14
commit
488874a163
@@ -1046,9 +1046,6 @@ QDF_STATUS wmi_unified_vdev_set_fwtest_param_cmd_send(void *wmi_hdl,
|
||||
QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
|
||||
struct config_ratemask_params *param);
|
||||
|
||||
QDF_STATUS wmi_unified_vdev_install_key_cmd_send(void *wmi_hdl,
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN],
|
||||
struct vdev_install_key_params *param);
|
||||
|
||||
QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(void *wmi_hdl,
|
||||
struct pdev_set_regdomain_params *param);
|
||||
|
@@ -626,43 +626,6 @@ struct vdev_set_params {
|
||||
uint32_t param_value;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct vdev_install_key_params - vdev key set cmd parameter
|
||||
* @wk_keylen: key length
|
||||
* @wk_flags: key flags
|
||||
* @ic_cipher: cipher
|
||||
* @if_id: vdev id
|
||||
* @is_group_key: Group key
|
||||
* @wk_keyix: key index
|
||||
* @def_keyid: default key index
|
||||
* @wk_keytsc: Key TSC
|
||||
* @wk_keyrsc: key RSC
|
||||
* @key_data: pounter to key data
|
||||
* @force_none: force
|
||||
* @is_host_based_crypt: Host based encrypt
|
||||
* @is_xmit_or_recv_key: xmit or recieve key
|
||||
* @wk_recviv: WAPI recv IV
|
||||
* @wk_txiv: WAPI TX IV
|
||||
*/
|
||||
struct vdev_install_key_params {
|
||||
uint8_t wk_keylen;
|
||||
uint16_t wk_flags;
|
||||
uint8_t ic_cipher;
|
||||
uint8_t if_id;
|
||||
bool is_group_key;
|
||||
uint16_t wk_keyix;
|
||||
uint8_t def_keyid;
|
||||
uint64_t wk_keytsc;
|
||||
uint64_t *wk_keyrsc;
|
||||
uint8_t *key_data;
|
||||
uint8_t force_none;
|
||||
bool is_host_based_crypt;
|
||||
bool is_xmit_or_recv_key;
|
||||
#if ATH_SUPPORT_WAPI
|
||||
uint8_t *wk_recviv;
|
||||
uint32_t *wk_txiv;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct peer_delete_params - peer delete cmd parameter
|
||||
@@ -1636,6 +1599,8 @@ struct wmi_probe_resp_params {
|
||||
* @key_cipher: key cipher based on security mode
|
||||
* @key_txmic_len: tx mic length
|
||||
* @key_rxmic_len: rx mic length
|
||||
* @key_tsc_counter: key tx sc counter
|
||||
* @key_rsc_counter: key rx sc counter
|
||||
* @rx_iv: receive IV, applicable only in case of WAPI
|
||||
* @tx_iv: transmit IV, applicable only in case of WAPI
|
||||
* @key_data: key data
|
||||
@@ -1649,7 +1614,9 @@ struct set_key_params {
|
||||
uint32_t key_cipher;
|
||||
uint32_t key_txmic_len;
|
||||
uint32_t key_rxmic_len;
|
||||
#ifdef FEATURE_WLAN_WAPI
|
||||
uint64_t key_tsc_counter;
|
||||
uint64_t *key_rsc_counter;
|
||||
#if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI)
|
||||
uint8_t rx_iv[16];
|
||||
uint8_t tx_iv[16];
|
||||
#endif
|
||||
|
@@ -842,9 +842,6 @@ QDF_STATUS (*send_vdev_set_fwtest_param_cmd)(wmi_unified_t wmi_handle,
|
||||
QDF_STATUS (*send_vdev_config_ratemask_cmd)(wmi_unified_t wmi_handle,
|
||||
struct config_ratemask_params *param);
|
||||
|
||||
QDF_STATUS (*send_vdev_install_key_cmd)(wmi_unified_t wmi_handle,
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN],
|
||||
struct vdev_install_key_params *param);
|
||||
|
||||
QDF_STATUS (*send_wow_wakeup_cmd)(wmi_unified_t wmi_handle);
|
||||
|
||||
|
@@ -4297,27 +4297,6 @@ QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
|
||||
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
|
||||
* @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
|
||||
* @param: pointer to hold key params
|
||||
* @macaddr: vdev mac address
|
||||
*
|
||||
* Return: 0 for success or error code
|
||||
*/
|
||||
QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
||||
uint8_t macaddr[IEEE80211_ADDR_LEN],
|
||||
struct vdev_install_key_params *param)
|
||||
QDF_STATUS send_setup_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
||||
struct set_key_params *param)
|
||||
{
|
||||
wmi_vdev_install_key_cmd *cmd;
|
||||
wmi_buf_t buf;
|
||||
/* 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;
|
||||
int i;
|
||||
|
||||
/* Cipher MAP has to be in the same order as ieee80211_cipher_type */
|
||||
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;
|
||||
wmi_cipher_type = param->key_cipher;
|
||||
|
||||
/* ieee_key length does not have mic keylen */
|
||||
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->vdev_id = param->if_id;
|
||||
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
|
||||
cmd->vdev_id = param->vdev_id;
|
||||
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 (param->def_keyid == 1)
|
||||
cmd->key_flags |= TX_USAGE;
|
||||
cmd->key_flags = param->key_flags;
|
||||
|
||||
cmd->key_len = param->wk_keylen;
|
||||
cmd->key_len = param->key_len;
|
||||
cmd->key_cipher = wmi_cipher_type;
|
||||
/* setting the mic lengths. Just Added for TKIP alone */
|
||||
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
||||
(wmi_cipher_type == WMI_CIPHER_WAPI)) {
|
||||
cmd->key_txmic_len = 8;
|
||||
cmd->key_rxmic_len = 8;
|
||||
}
|
||||
cmd->key_txmic_len = param->key_txmic_len;
|
||||
cmd->key_rxmic_len = param->key_rxmic_len;
|
||||
|
||||
/* target will use the same rsc counter for
|
||||
various tids from from ieee key rsc */
|
||||
if ((wmi_cipher_type == WMI_CIPHER_TKIP) ||
|
||||
(wmi_cipher_type == WMI_CIPHER_AES_OCB)
|
||||
|| (wmi_cipher_type == WMI_CIPHER_AES_CCM)) {
|
||||
qdf_mem_copy(&cmd->key_rsc_counter, ¶m->wk_keyrsc[0],
|
||||
sizeof(param->wk_keyrsc[0]));
|
||||
qdf_mem_copy(&cmd->key_tsc_counter, ¶m->wk_keytsc,
|
||||
sizeof(param->wk_keytsc));
|
||||
qdf_mem_copy(&cmd->key_rsc_counter, ¶m->key_rsc_counter[0],
|
||||
sizeof(param->key_rsc_counter[0]));
|
||||
qdf_mem_copy(&cmd->key_tsc_counter, ¶m->key_tsc_counter,
|
||||
sizeof(param->key_tsc_counter));
|
||||
}
|
||||
|
||||
#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++)
|
||||
*(((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++)
|
||||
*(((uint32_t *)&cmd->wpi_key_tsc_counter)+j) =
|
||||
param->wk_txiv[i];
|
||||
param->tx_iv[i];
|
||||
|
||||
qdf_print("RSC:");
|
||||
for (i = 0; i < 16; i++)
|
||||
@@ -449,13 +401,8 @@ QDF_STATUS send_vdev_install_key_cmd_non_tlv(wmi_unified_t wmi_handle,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* for big endian host, copy engine byte_swap is enabled
|
||||
* 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);
|
||||
qdf_mem_copy(cmd->key_data, param->key_data,
|
||||
cmd->key_len);
|
||||
|
||||
return wmi_unified_cmd_send(wmi_handle, buf, len,
|
||||
WMI_VDEV_INSTALL_KEY_CMDID);
|
||||
@@ -7962,7 +7909,8 @@ struct wmi_ops non_tlv_ops = {
|
||||
.send_vdev_set_fwtest_param_cmd =
|
||||
send_vdev_set_fwtest_param_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_add_wakeup_event_cmd = send_wow_add_wakeup_event_cmd_non_tlv,
|
||||
.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;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_WLAN_WAPI
|
||||
#if defined(ATH_SUPPORT_WAPI) || defined(FEATURE_WLAN_WAPI)
|
||||
#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->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);
|
||||
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_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,
|
||||
key_params->tx_iv,
|
||||
cmd->wpi_key_rsc_counter,
|
||||
|
Reference in New Issue
Block a user