Commit b877f4cf authored by Ying Luo's avatar Ying Luo Committed by John W. Linville

mwifiex: add AES_CMAC support in key_material cmd

The sequence counter will be sent to firmware via key_material
command.
Signed-off-by: default avatarYing Luo <luoy@marvell.com>
Signed-off-by: default avatarStone Piao <piaoyun@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 53b11231
......@@ -65,10 +65,12 @@ enum KEY_TYPE_ID {
KEY_TYPE_ID_TKIP,
KEY_TYPE_ID_AES,
KEY_TYPE_ID_WAPI,
KEY_TYPE_ID_AES_CMAC,
};
#define KEY_MCAST BIT(0)
#define KEY_UNICAST BIT(1)
#define KEY_ENABLED BIT(2)
#define KEY_IGTK BIT(10)
#define WAPI_KEY_LEN 50
......@@ -583,6 +585,13 @@ struct mwifiex_ie_type_key_param_set {
u8 key[50];
} __packed;
#define IGTK_PN_LEN 8
struct mwifiex_cmac_param {
u8 ipn[IGTK_PN_LEN];
u8 key[WLAN_KEY_LEN_AES_CMAC];
} __packed;
struct host_cmd_ds_802_11_key_material {
__le16 action;
struct mwifiex_ie_type_key_param_set key_param_set;
......
......@@ -621,6 +621,20 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
return ret;
}
if (enc_key->key_len == WLAN_KEY_LEN_CCMP) {
if (enc_key->is_igtk_key) {
dev_dbg(priv->adapter->dev, "cmd: CMAC_AES\n");
key_material->key_param_set.key_type_id =
cpu_to_le16(KEY_TYPE_ID_AES_CMAC);
if (cmd_oid == KEY_INFO_ENABLED)
key_material->key_param_set.key_info =
cpu_to_le16(KEY_ENABLED);
else
key_material->key_param_set.key_info =
cpu_to_le16(!KEY_ENABLED);
key_material->key_param_set.key_info |=
cpu_to_le16(KEY_IGTK);
} else {
dev_dbg(priv->adapter->dev, "cmd: WPA_AES\n");
key_material->key_param_set.key_type_id =
cpu_to_le16(KEY_TYPE_ID_AES);
......@@ -638,6 +652,7 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
else /* AES group key: multicast */
key_material->key_param_set.key_info |=
cpu_to_le16(KEY_MCAST);
}
} else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) {
dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n");
key_material->key_param_set.key_type_id =
......@@ -668,6 +683,24 @@ mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
key_param_len = (u16)(enc_key->key_len + KEYPARAMSET_FIXED_LEN)
+ sizeof(struct mwifiex_ie_types_header);
if (le16_to_cpu(key_material->key_param_set.key_type_id) ==
KEY_TYPE_ID_AES_CMAC) {
struct mwifiex_cmac_param *param =
(void *)key_material->key_param_set.key;
memcpy(param->ipn, enc_key->pn, IGTK_PN_LEN);
memcpy(param->key, enc_key->key_material,
enc_key->key_len);
key_param_len = sizeof(struct mwifiex_cmac_param);
key_material->key_param_set.key_len =
cpu_to_le16(key_param_len);
key_param_len += KEYPARAMSET_FIXED_LEN;
key_material->key_param_set.length =
cpu_to_le16(key_param_len);
key_param_len += sizeof(struct mwifiex_ie_types_header);
}
cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN
+ key_param_len);
......
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