Commit 9e3c3936 authored by Nathan Errera's avatar Nathan Errera Committed by Luca Coelho

iwlwifi: mvm: support new KEK KCK api

Add a new version to iwl_wowlan_kek_kck_material_cmd
struct to support akm and send the new cmd if supported.
Signed-off-by: default avatarNathan Errera <nathan.errera@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200928121852.6ec5889d793d.I32ad41a27f046a4047cf852c83936142fca4f20b@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 0ea788ed
...@@ -493,7 +493,7 @@ struct iwl_wowlan_tkip_params_cmd { ...@@ -493,7 +493,7 @@ struct iwl_wowlan_tkip_params_cmd {
#define IWL_KCK_MAX_SIZE 32 #define IWL_KCK_MAX_SIZE 32
#define IWL_KEK_MAX_SIZE 32 #define IWL_KEK_MAX_SIZE 32
struct iwl_wowlan_kek_kck_material_cmd { struct iwl_wowlan_kek_kck_material_cmd_v2 {
u8 kck[IWL_KCK_MAX_SIZE]; u8 kck[IWL_KCK_MAX_SIZE];
u8 kek[IWL_KEK_MAX_SIZE]; u8 kek[IWL_KEK_MAX_SIZE];
__le16 kck_len; __le16 kck_len;
...@@ -501,6 +501,18 @@ struct iwl_wowlan_kek_kck_material_cmd { ...@@ -501,6 +501,18 @@ struct iwl_wowlan_kek_kck_material_cmd {
__le64 replay_ctr; __le64 replay_ctr;
} __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */ } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
struct iwl_wowlan_kek_kck_material_cmd_v3 {
u8 kck[IWL_KCK_MAX_SIZE];
u8 kek[IWL_KEK_MAX_SIZE];
__le16 kck_len;
__le16 kek_len;
__le64 replay_ctr;
__le32 akm;
__le32 gtk_cipher;
__le32 igtk_cipher;
__le32 bigtk_cipher;
} __packed; /* KEK_KCK_MATERIAL_API_S_VER_3 */
#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87 #define RF_KILL_INDICATOR_FOR_WOWLAN 0x87
enum iwl_wowlan_rekey_status { enum iwl_wowlan_rekey_status {
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#include "iwl-modparams.h" #include "iwl-modparams.h"
#include "fw-api.h" #include "fw-api.h"
#include "mvm.h" #include "mvm.h"
#include "fw/img.h"
void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
...@@ -739,7 +740,7 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, ...@@ -739,7 +740,7 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
u32 cmd_flags) u32 cmd_flags)
{ {
struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {}; struct iwl_wowlan_kek_kck_material_cmd_v3 kek_kck_cmd = {};
struct iwl_wowlan_tkip_params_cmd tkip_cmd = {}; struct iwl_wowlan_tkip_params_cmd tkip_cmd = {};
bool unified = fw_has_capa(&mvm->fw->ucode_capa, bool unified = fw_has_capa(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
...@@ -751,6 +752,8 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, ...@@ -751,6 +752,8 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
}; };
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret; int ret;
u8 cmd_ver;
size_t cmd_size;
key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL);
if (!key_data.rsc_tsc) if (!key_data.rsc_tsc)
...@@ -833,6 +836,16 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, ...@@ -833,6 +836,16 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
/* configure rekey data only if offloaded rekey is supported (d3) */ /* configure rekey data only if offloaded rekey is supported (d3) */
if (mvmvif->rekey_data.valid) { if (mvmvif->rekey_data.valid) {
cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP,
WOWLAN_KEK_KCK_MATERIAL);
if (WARN_ON(cmd_ver != 2 && cmd_ver != 3 &&
cmd_ver != IWL_FW_CMD_VER_UNKNOWN))
return -EINVAL;
if (cmd_ver == 3)
cmd_size = sizeof(struct iwl_wowlan_kek_kck_material_cmd_v3);
else
cmd_size = sizeof(struct iwl_wowlan_kek_kck_material_cmd_v2);
memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd));
memcpy(kek_kck_cmd.kck, mvmvif->rekey_data.kck, memcpy(kek_kck_cmd.kck, mvmvif->rekey_data.kck,
NL80211_KCK_LEN); NL80211_KCK_LEN);
...@@ -844,7 +857,7 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, ...@@ -844,7 +857,7 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
ret = iwl_mvm_send_cmd_pdu(mvm, ret = iwl_mvm_send_cmd_pdu(mvm,
WOWLAN_KEK_KCK_MATERIAL, cmd_flags, WOWLAN_KEK_KCK_MATERIAL, cmd_flags,
sizeof(kek_kck_cmd), cmd_size,
&kek_kck_cmd); &kek_kck_cmd);
if (ret) if (ret)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment