diff mbox series

[v9,09/16] Drop set_tx from all set_key() functions

Message ID 20200104221015.90469-10-alexander@wetzel-home.de
State Changes Requested
Headers show
Series Seamless PTK rekeys | expand

Commit Message

Alexander Wetzel Jan. 4, 2020, 10:10 p.m. UTC
Remove the deprecated set_tx variable from all set_key(), finalizing the
migration to key_flag.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
---
 hostapd/ctrl_iface.c            | 31 +++++++++++++------------------
 src/ap/ap_drv_ops.c             |  5 ++---
 src/ap/ap_drv_ops.h             |  3 +--
 src/ap/hostapd.c                | 10 +++++-----
 src/ap/ieee802_11.c             |  2 +-
 src/ap/ieee802_1x.c             |  6 +++---
 src/ap/wpa_auth_glue.c          |  2 +-
 src/common/wpa_common.c         |  9 +++++++++
 src/common/wpa_common.h         |  2 ++
 src/drivers/driver.h            | 14 +++++++-------
 src/drivers/driver_atheros.c    |  5 ++---
 src/drivers/driver_bsd.c        |  2 +-
 src/drivers/driver_hostap.c     |  3 +--
 src/drivers/driver_ndis.c       |  9 ++++-----
 src/drivers/driver_nl80211.c    | 20 ++++++++------------
 src/drivers/driver_openbsd.c    |  2 +-
 src/drivers/driver_privsep.c    |  7 +++----
 src/drivers/driver_wext.c       | 14 +++++---------
 src/drivers/driver_wext.h       |  5 ++---
 src/rsn_supp/tdls.c             |  4 ++--
 src/rsn_supp/wpa.c              | 10 +++++-----
 src/rsn_supp/wpa.h              |  2 +-
 src/rsn_supp/wpa_ft.c           |  6 +++---
 src/rsn_supp/wpa_i.h            |  4 ++--
 tests/hwsim/test_ap_ciphers.py  |  2 +-
 wpa_supplicant/ctrl_iface.c     | 18 +++++++++---------
 wpa_supplicant/driver_i.h       |  8 +++-----
 wpa_supplicant/ibss_rsn.c       | 12 ++++++------
 wpa_supplicant/mesh_mpm.c       |  6 +++---
 wpa_supplicant/mesh_rsn.c       |  8 ++++----
 wpa_supplicant/preauth_test.c   |  2 +-
 wpa_supplicant/wpa_supplicant.c |  8 ++++----
 wpa_supplicant/wpas_glue.c      | 10 +++++-----
 33 files changed, 120 insertions(+), 131 deletions(-)
diff mbox series

Patch

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 98dcf09a4..60ca0f728 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -2154,7 +2154,7 @@  static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 		if (hostapd_drv_set_key(hapd->conf->iface, hapd,
 					hapd->last_igtk_alg,
 					broadcast_ether_addr,
-					hapd->last_igtk_key_idx, 1, NULL, 0,
+					hapd->last_igtk_key_idx, NULL, 0,
 					zero, hapd->last_igtk_len,
 					KEY_FLAG_GROUP_TX_DEFAULT) < 0)
 			return -1;
@@ -2163,7 +2163,7 @@  static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 		return hostapd_drv_set_key(hapd->conf->iface, hapd,
 					   hapd->last_igtk_alg,
 					   broadcast_ether_addr,
-					   hapd->last_igtk_key_idx, 1, NULL, 0,
+					   hapd->last_igtk_key_idx, NULL, 0,
 					   hapd->last_igtk,
 					   hapd->last_igtk_len,
 					   KEY_FLAG_GROUP_TX_DEFAULT);
@@ -2180,7 +2180,7 @@  static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 		if (hostapd_drv_set_key(hapd->conf->iface, hapd,
 					hapd->last_gtk_alg,
 					broadcast_ether_addr,
-					hapd->last_gtk_key_idx, 1, NULL, 0,
+					hapd->last_gtk_key_idx, NULL, 0,
 					zero, hapd->last_gtk_len,
 					KEY_FLAG_GROUP_TX_DEFAULT) < 0)
 			return -1;
@@ -2189,7 +2189,7 @@  static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 		return hostapd_drv_set_key(hapd->conf->iface, hapd,
 					   hapd->last_gtk_alg,
 					   broadcast_ether_addr,
-					   hapd->last_gtk_key_idx, 1, NULL, 0,
+					   hapd->last_gtk_key_idx, NULL, 0,
 					   hapd->last_gtk, hapd->last_gtk_len,
 					   KEY_FLAG_GROUP_TX_DEFAULT);
 	}
@@ -2207,14 +2207,14 @@  static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd)
 	/* First, use a zero key to avoid any possible duplicate key avoidance
 	 * in the driver. */
 	if (hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg,
-				sta->addr, sta->last_tk_key_idx, 1, NULL, 0,
+				sta->addr, sta->last_tk_key_idx, NULL, 0,
 				zero, sta->last_tk_len,
 				KEY_FLAG_PAIRWISE_RX_TX) < 0)
 		return -1;
 
 	/* Set the previously configured key to reset its TSC/RSC */
 	return hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg,
-				   sta->addr, sta->last_tk_key_idx, 1, NULL, 0,
+				   sta->addr, sta->last_tk_key_idx, NULL, 0,
 				   sta->last_tk, sta->last_tk_len,
 				   KEY_FLAG_PAIRWISE_RX_TX);
 }
@@ -2226,11 +2226,11 @@  static int hostapd_ctrl_set_key(struct hostapd_data *hapd, const char *cmd)
 	const char *pos = cmd;
 	enum wpa_alg alg;
 	enum key_flag key_flag;
-	int idx, set_tx;
+	int idx;
 	u8 seq[6], key[WPA_TK_MAX_LEN];
 	size_t key_len;
 
-	/* parameters: alg addr idx set_tx seq key key_flag */
+	/* parameters: alg addr idx seq key key_flag */
 
 	alg = atoi(pos);
 	pos = os_strchr(pos, ' ');
@@ -2248,11 +2248,6 @@  static int hostapd_ctrl_set_key(struct hostapd_data *hapd, const char *cmd)
 	if (!pos)
 		return -1;
 	pos++;
-	set_tx = atoi(pos);
-	pos = os_strchr(pos, ' ');
-	if (!pos)
-		return -1;
-	pos++;
 	if (hexstr2bin(pos, seq, sizeof(seq)) < 0)
 		return -1;
 	pos += 2 * 6;
@@ -2276,7 +2271,7 @@  static int hostapd_ctrl_set_key(struct hostapd_data *hapd, const char *cmd)
 
 	wpa_printf(MSG_INFO, "TESTING: Set key");
 	return hostapd_drv_set_key(hapd->conf->iface, hapd, alg, addr, idx,
-				   set_tx, seq, 6, key, key_len, key_flag);
+				   seq, 6, key, key_len, key_flag);
 }
 
 
@@ -2291,7 +2286,7 @@  static void restore_tk(void *ctx1, void *ctx2)
 	 * in replay protection issues for now since there is no clean way of
 	 * preventing encryption of a single EAPOL frame. */
 	hostapd_drv_set_key(hapd->conf->iface, hapd, sta->last_tk_alg,
-			    sta->addr, sta->last_tk_key_idx, 1, NULL, 0,
+			    sta->addr, sta->last_tk_key_idx, NULL, 0,
 			    sta->last_tk, sta->last_tk_len,
 			    KEY_FLAG_PAIRWISE_RX_TX);
 }
@@ -2316,7 +2311,7 @@  static int hostapd_ctrl_resend_m1(struct hostapd_data *hapd, const char *cmd)
 		wpa_printf(MSG_INFO, "TESTING: Clear TK for " MACSTR,
 			   MAC2STR(sta->addr));
 		hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE,
-				    sta->addr, sta->last_tk_key_idx, 0, NULL, 0,
+				    sta->addr, sta->last_tk_key_idx, NULL, 0,
 				    NULL, 0, KEY_FLAG_PAIRWISE);
 	}
 
@@ -2346,7 +2341,7 @@  static int hostapd_ctrl_resend_m3(struct hostapd_data *hapd, const char *cmd)
 		wpa_printf(MSG_INFO, "TESTING: Clear TK for " MACSTR,
 			   MAC2STR(sta->addr));
 		hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE,
-				    sta->addr, sta->last_tk_key_idx, 0, NULL, 0,
+				    sta->addr, sta->last_tk_key_idx, NULL, 0,
 				    NULL, 0, KEY_FLAG_PAIRWISE);
 	}
 
@@ -2376,7 +2371,7 @@  static int hostapd_ctrl_resend_group_m1(struct hostapd_data *hapd,
 		wpa_printf(MSG_INFO, "TESTING: Clear TK for " MACSTR,
 			   MAC2STR(sta->addr));
 		hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_NONE,
-				    sta->addr, sta->last_tk_key_idx, 0, NULL, 0,
+				    sta->addr, sta->last_tk_key_idx, NULL, 0,
 				    NULL, 0, KEY_FLAG_PAIRWISE);
 	}
 
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 62f41b758..230094625 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -680,14 +680,13 @@  int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
 
 int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
 			enum wpa_alg alg, const u8 *addr,
-			int key_idx, int set_tx,
-			const u8 *seq, size_t seq_len,
+			int key_idx, const u8 *seq, size_t seq_len,
 			const u8 *key, size_t key_len, enum key_flag key_flag)
 {
 	if (hapd->driver == NULL || hapd->driver->set_key == NULL)
 		return 0;
 	return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
-				     key_idx, set_tx, seq, seq_len, key,
+				     key_idx, seq, seq_len, key,
 				     key_len, key_flag);
 }
 
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index ca31ade86..7080d8c3a 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -89,8 +89,7 @@  int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
 int hostapd_drv_set_key(const char *ifname,
 			struct hostapd_data *hapd,
 			enum wpa_alg alg, const u8 *addr,
-			int key_idx, int set_tx,
-			const u8 *seq, size_t seq_len,
+			int key_idx, const u8 *seq, size_t seq_len,
 			const u8 *key, size_t key_len, enum key_flag key_flag);
 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
 			  const void *msg, size_t len, int noack,
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 0276515d7..49ec71752 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -292,7 +292,7 @@  static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
 	if (!ifname || !hapd->drv_priv)
 		return;
 	for (i = 0; i < NUM_WEP_KEYS; i++) {
-		if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i, 0,
+		if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
 					NULL, 0, NULL, 0, KEY_FLAG_GROUP)) {
 			wpa_printf(MSG_DEBUG, "Failed to clear default "
 				   "encryption keys (ifname=%s keyidx=%d)",
@@ -302,8 +302,8 @@  static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
 	if (hapd->conf->ieee80211w) {
 		for (i = NUM_WEP_KEYS; i < NUM_WEP_KEYS + 2; i++) {
 			if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE,
-						NULL, i, 0, NULL, 0,
-						NULL, 0, KEY_FLAG_GROUP)) {
+						NULL, i, NULL, 0, NULL,
+						0, KEY_FLAG_GROUP)) {
 				wpa_printf(MSG_DEBUG, "Failed to clear "
 					   "default mgmt encryption keys "
 					   "(ifname=%s keyidx=%d)", ifname, i);
@@ -329,7 +329,7 @@  static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
 	if (ssid->wep.default_len &&
 	    hostapd_drv_set_key(hapd->conf->iface,
 				hapd, WPA_ALG_WEP, broadcast_ether_addr, idx,
-				1, NULL, 0, ssid->wep.key[idx],
+				NULL, 0, ssid->wep.key[idx],
 				ssid->wep.len[idx],
 				KEY_FLAG_GROUP_RX_TX_DEFAULT)) {
 		wpa_printf(MSG_WARNING, "Could not set WEP encryption.");
@@ -555,7 +555,7 @@  static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
 	for (i = 0; i < 4; i++) {
 		if (hapd->conf->ssid.wep.key[i] &&
 		    hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
-					i == hapd->conf->ssid.wep.idx, NULL, 0,
+					NULL, 0,
 					hapd->conf->ssid.wep.key[i],
 					hapd->conf->ssid.wep.len[i],
 					i == hapd->conf->ssid.wep.idx ?
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index bee65ac3b..119f35761 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4879,7 +4879,7 @@  static void hostapd_set_wds_encryption(struct hostapd_data *hapd,
 	for (i = 0; i < 4; i++) {
 		if (ssid->wep.key[i] &&
 		    hostapd_drv_set_key(ifname_wds, hapd, WPA_ALG_WEP, NULL, i,
-					i == ssid->wep.idx, NULL, 0,
+					NULL, 0,
 					ssid->wep.key[i], ssid->wep.len[i],
 					i == ssid->wep.idx ?
 					     KEY_FLAG_GROUP_RX_TX_DEFAULT :
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index 9b26ff1d7..d8e71a776 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -284,7 +284,7 @@  static void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
 		/* TODO: set encryption in TX callback, i.e., only after STA
 		 * has ACKed EAPOL-Key frame */
 		if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
-					sta->addr, 0, 1, NULL, 0, ikey,
+					sta->addr, 0, NULL, 0, ikey,
 					hapd->conf->individual_wep_key_len,
 					KEY_FLAG_PAIRWISE_RX_TX)) {
 			wpa_printf(MSG_ERROR,
@@ -2178,7 +2178,7 @@  static void ieee802_1x_rekey(void *eloop_ctx, void *timeout_ctx)
 	 * after new broadcast key has been sent to all stations. */
 	if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
 				broadcast_ether_addr,
-				eapol->default_wep_key_idx, 1, NULL, 0,
+				eapol->default_wep_key_idx, NULL, 0,
 				eapol->default_wep_key,
 				hapd->conf->default_wep_key_len,
 				KEY_FLAG_GROUP_RX_TX_DEFAULT)) {
@@ -2472,7 +2472,7 @@  int ieee802_1x_init(struct hostapd_data *hapd)
 	if (hapd->conf->default_wep_key_len) {
 		for (i = 0; i < 4; i++)
 			hostapd_drv_set_key(hapd->conf->iface, hapd,
-					    WPA_ALG_NONE, NULL, i, 0, NULL, 0,
+					    WPA_ALG_NONE, NULL, i, NULL, 0,
 					    NULL, 0, KEY_FLAG_GROUP_RX_TX);
 
 		ieee802_1x_rekey(hapd, NULL);
diff --git a/src/ap/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c
index 84e21fe11..7abb93e73 100644
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -402,7 +402,7 @@  static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg,
 		hapd->last_gtk_len = key_len;
 	}
 #endif /* CONFIG_TESTING_OPTIONS */
-	return hostapd_drv_set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
+	return hostapd_drv_set_key(ifname, hapd, alg, addr, idx, NULL, 0,
 				   key, key_len, key_flag);
 }
 
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index de4b6ecd2..f7c00cd7b 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -963,6 +963,7 @@  int wpa_ft_parse_ies(const u8 *ies, size_t ies_len,
 				parse->rsn_pmkid = data.pmkid;
 			parse->key_mgmt = data.key_mgmt;
 			parse->pairwise_cipher = data.pairwise_cipher;
+			parse->capabilities = data.capabilities;
 			if (update_use_sha384) {
 				use_sha384 =
 					wpa_key_mgmt_sha384(parse->key_mgmt);
@@ -2681,6 +2682,14 @@  static int wpa_parse_generic(const u8 *pos, const u8 *end,
 		return 0;
 	}
 
+	if (pos[1] > RSN_SELECTOR_LEN + 1 &&
+	    RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_KEYID) {
+		ie->key_id = pos + 2 + RSN_SELECTOR_LEN;
+		wpa_hexdump(MSG_DEBUG, "WPA: KeyID in EAPOL-Key",
+			    pos, pos[1] + 2);
+		return 0;
+	}
+
 	if (pos[1] > RSN_SELECTOR_LEN + 2 &&
 	    RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_GROUPKEY) {
 		ie->gtk = pos + 2 + RSN_SELECTOR_LEN;
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index beb1ecd5e..4ef5cd13c 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -465,6 +465,7 @@  struct wpa_ft_ies {
 	int pairwise_cipher;
 	const u8 *rsnxe;
 	size_t rsnxe_len;
+	int capabilities;
 };
 
 int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse,
@@ -476,6 +477,7 @@  struct wpa_eapol_ie_parse {
 	const u8 *rsn_ie;
 	size_t rsn_ie_len;
 	const u8 *pmkid;
+	const u8 *key_id;
 	const u8 *gtk;
 	size_t gtk_len;
 	const u8 *mac_addr;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index a89122c37..b1036f1a3 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1706,6 +1706,8 @@  struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK	0x0200000000000000ULL
 /** Driver can correctly rekey PTKs without Extended Key ID */
 #define WPA_DRIVER_FLAGS_SAFE_PTK0_REKEYS	0x0400000000000000ULL
+/** Driver supports Extended Key ID */
+#define WPA_DRIVER_FLAGS_EXTENDED_KEY_ID	0x0800000000000000ULL
 	u64 flags;
 
 #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
@@ -2323,8 +2325,6 @@  struct wpa_driver_ops {
 	 *	specified key index is to be cleared
 	 * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
 	 *	IGTK
-	 * @set_tx: configure this key as the default Tx key (only used when
-	 *	driver does not support separate unicast/individual key
 	 * @seq: sequence number/packet number, seq_len octets, the next
 	 *	packet number to be used for in replay protection; configured
 	 *	for Rx keys (in most cases, this is only used with broadcast
@@ -2384,10 +2384,10 @@  struct wpa_driver_ops {
 	 * addr can be used to determine whether the key is default or
 	 * individual. If only 4 keys are supported, the default key with key
 	 * index 0 is used as the individual key. STA must be configured to use
-	 * it as the default Tx key (set_tx is set) and accept Rx for all the
-	 * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
-	 * broadcast keys, so key index 0 is available for this kind of
-	 * configuration.
+	 * it as the default Tx key (KEY_FLAG_DEFAULT is set) and accept Rx
+	 * for all the key indexes. In most cases, WPA uses only key indexes 1
+	 * and 2 for broadcast keys, so key index 0 is available for this kind
+	 * of configuration.
 	 *
 	 * Please note that TKIP keys include separate TX and RX MIC keys and
 	 * some drivers may expect them in different order than wpa_supplicant
@@ -2398,7 +2398,7 @@  struct wpa_driver_ops {
 	 * example on how this can be done.
 	 */
 	int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
-		       const u8 *addr, int key_idx, int set_tx,
+		       const u8 *addr, int key_idx,
 		       const u8 *seq, size_t seq_len,
 		       const u8 *key, size_t key_len, enum key_flag key_flag);
 
diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c
index 52e0e1278..763925ef8 100644
--- a/src/drivers/driver_atheros.c
+++ b/src/drivers/driver_atheros.c
@@ -493,9 +493,8 @@  atheros_del_key(void *priv, const u8 *addr, int key_idx)
 
 static int
 atheros_set_key(const char *ifname, void *priv, enum wpa_alg alg,
-		const u8 *addr, int key_idx, int set_tx, const u8 *seq,
-		size_t seq_len, const u8 *key, size_t key_len,
-		enum key_flag key_flag)
+		const u8 *addr, int key_idx, const u8 *seq, size_t seq_len,
+		const u8 *key, size_t key_len, enum key_flag key_flag)
 {
 	struct atheros_driver_data *drv = priv;
 	struct ieee80211req_key wk;
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index ec7d2629e..0a0693a43 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -332,7 +332,7 @@  bsd_ctrl_iface(void *priv, int enable)
 
 static int
 bsd_set_key(const char *ifname, void *priv, enum wpa_alg alg,
-	    const unsigned char *addr, int key_idx, int set_tx, const u8 *seq,
+	    const unsigned char *addr, int key_idx, const u8 *seq,
 	    size_t seq_len, const u8 *key, size_t key_len,
 	    enum key_flag key_flag)
 {
diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c
index bb7284d9e..31ed1019d 100644
--- a/src/drivers/driver_hostap.c
+++ b/src/drivers/driver_hostap.c
@@ -398,8 +398,7 @@  static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param,
 
 static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
 				     enum wpa_alg alg, const u8 *addr,
-				     int key_idx, int set_tx,
-				     const u8 *seq, size_t seq_len,
+				     int key_idx, const u8 *seq, size_t seq_len,
 				     const u8 *key, size_t key_len,
 				     enum key_flag key_flag)
 {
diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c
index 4acfb30f3..bcfcb2e9e 100644
--- a/src/drivers/driver_ndis.c
+++ b/src/drivers/driver_ndis.c
@@ -931,7 +931,7 @@  static int wpa_driver_ndis_remove_key(struct wpa_driver_ndis_data *drv,
 
 
 static int wpa_driver_ndis_add_wep(struct wpa_driver_ndis_data *drv,
-				   int pairwise, int key_idx, int set_tx,
+				   int pairwise, int key_idx,
 				   const u8 *key, size_t key_len,
 				   enum key_flag key_flag)
 {
@@ -966,8 +966,7 @@  static int wpa_driver_ndis_add_wep(struct wpa_driver_ndis_data *drv,
 
 static int wpa_driver_ndis_set_key(const char *ifname, void *priv,
 				   enum wpa_alg alg, const u8 *addr,
-				   int key_idx, int set_tx,
-				   const u8 *seq, size_t seq_len,
+				   int key_idx, const u8 *seq, size_t seq_len,
 				   const u8 *key, size_t key_len,
 				   enum key_flag key_flag)
 {
@@ -994,8 +993,8 @@  static int wpa_driver_ndis_set_key(const char *ifname, void *priv,
 	}
 
 	if (alg == WPA_ALG_WEP) {
-		return wpa_driver_ndis_add_wep(drv, pairwise, key_idx, set_tx,
-					       key, key_len, key_flag);
+		return wpa_driver_ndis_add_wep(drv, pairwise, key_idx, key,
+					       key_len, key_flag);
 	}
 
 	len = 12 + 6 + 6 + 8 + key_len;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e7437355d..aa7e24677 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3013,10 +3013,9 @@  static int nl80211_set_pmk(struct wpa_driver_nl80211_data *drv,
 
 static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
 				      enum wpa_alg alg, const u8 *addr,
-				      int key_idx, int set_tx,
-				      const u8 *seq, size_t seq_len,
-				      const u8 *key, size_t key_len,
-				      enum key_flag key_flag)
+				      int key_idx, const u8 *seq,
+				      size_t seq_len, const u8 *key,
+				      size_t key_len, enum key_flag key_flag)
 {
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	int ifindex;
@@ -3031,8 +3030,8 @@  static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
 
 	ifindex = if_nametoindex(ifname);
 	wpa_printf(MSG_DEBUG, "%s: ifindex=%d (%s) alg=%d addr=%p key_idx=%d "
-		   "set_tx=%d seq_len=%lu key_len=%lu key_flag=%d",
-		   __func__, ifindex, ifname, alg, addr, key_idx, set_tx,
+		   "seq_len=%lu key_len=%lu key_flag=%d",
+		   __func__, ifindex, ifname, alg, addr, key_idx,
 		   (unsigned long) seq_len, (unsigned long) key_len, key_flag);
 #ifdef CONFIG_DRIVER_NL80211_QCA
 	if (alg == WPA_ALG_PMK &&
@@ -3480,8 +3479,7 @@  retry:
 		if (!params->wep_key[i])
 			continue;
 		wpa_driver_nl80211_set_key(bss->ifname, bss, WPA_ALG_WEP,
-					   NULL, i,
-					   i == params->wep_tx_keyidx, NULL, 0,
+					   NULL, i, NULL, 0,
 					   params->wep_key[i],
 					   params->wep_key_len[i],
 					   i == params->wep_tx_keyidx ?
@@ -8644,15 +8642,13 @@  nl80211_tdls_disable_channel_switch(void *priv, const u8 *addr)
 
 static int driver_nl80211_set_key(const char *ifname, void *priv,
 				  enum wpa_alg alg, const u8 *addr,
-				  int key_idx, int set_tx,
-				  const u8 *seq, size_t seq_len,
+				  int key_idx, const u8 *seq, size_t seq_len,
 				  const u8 *key, size_t key_len,
 				  enum key_flag key_flag)
 {
 	struct i802_bss *bss = priv;
 	return wpa_driver_nl80211_set_key(ifname, bss, alg, addr, key_idx,
-					  set_tx, seq, seq_len, key, key_len,
-					  key_flag);
+					  seq, seq_len, key, key_len, key_flag);
 }
 
 
diff --git a/src/drivers/driver_openbsd.c b/src/drivers/driver_openbsd.c
index a96045121..69234dd9e 100644
--- a/src/drivers/driver_openbsd.c
+++ b/src/drivers/driver_openbsd.c
@@ -70,7 +70,7 @@  wpa_driver_openbsd_get_capa(void *priv, struct wpa_driver_capa *capa)
 
 static int
 wpa_driver_openbsd_set_key(const char *ifname, void *priv, enum wpa_alg alg,
-	    const unsigned char *addr, int key_idx, int set_tx, const u8 *seq,
+	    const unsigned char *addr, int key_idx, const u8 *seq,
 	    size_t seq_len, const u8 *key, size_t key_len,
 	    enum key_flag key_flag)
 {
diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c
index 568de3baf..6b1f0a84c 100644
--- a/src/drivers/driver_privsep.c
+++ b/src/drivers/driver_privsep.c
@@ -207,10 +207,9 @@  wpa_driver_privsep_get_scan_results2(void *priv)
 
 static int wpa_driver_privsep_set_key(const char *ifname, void *priv,
 				      enum wpa_alg alg, const u8 *addr,
-				      int key_idx, int set_tx,
-				      const u8 *seq, size_t seq_len,
-				      const u8 *key, size_t key_len,
-				      enum key_flag key_flag)
+				      int key_idx, const u8 *seq,
+				      size_t seq_len, const u8 *key,
+				      size_t key_len, enum key_flag key_flag)
 {
 	struct wpa_driver_privsep_data *drv = priv;
 	struct privsep_cmd_set_key cmd;
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index ade8eed4e..1873689c1 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -1710,8 +1710,7 @@  static int wpa_driver_wext_set_psk(struct wpa_driver_wext_data *drv,
 
 static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
 				       const u8 *addr, int key_idx,
-				       int set_tx, const u8 *seq,
-				       size_t seq_len,
+				       const u8 *seq, size_t seq_len,
 				       const u8 *key, size_t key_len,
 				       enum key_flag key_flag)
 {
@@ -1810,8 +1809,6 @@  static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
  * @addr: Address of the peer STA or ff:ff:ff:ff:ff:ff for
  *	broadcast/default keys
  * @key_idx: key index (0..3), usually 0 for unicast keys
- * @set_tx: Configure this key as the default Tx key (only used when
- *	driver does not support separate unicast/individual key
  * @seq: Sequence number/packet number, seq_len octets, the next
  *	packet number to be used for in replay protection; configured
  *	for Rx keys (in most cases, this is only used with broadcast
@@ -1831,9 +1828,8 @@  static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
  */
 int wpa_driver_wext_set_key(const char *ifname, void *priv, enum wpa_alg alg,
 			    const u8 *addr, int key_idx,
-			    int set_tx, const u8 *seq, size_t seq_len,
-			    const u8 *key, size_t key_len,
-			    enum key_flag key_flag)
+			    const u8 *seq, size_t seq_len, const u8 *key,
+			    size_t key_len, enum key_flag key_flag)
 {
 	struct wpa_driver_wext_data *drv = priv;
 	struct iwreq iwr;
@@ -1844,8 +1840,8 @@  int wpa_driver_wext_set_key(const char *ifname, void *priv, enum wpa_alg alg,
 		   __FUNCTION__, alg, key_idx, key_flag,
 		   (unsigned long) seq_len, (unsigned long) key_len);
 
-	ret = wpa_driver_wext_set_key_ext(drv, alg, addr, key_idx, set_tx,
-					  seq, seq_len, key, key_len, key_flag);
+	ret = wpa_driver_wext_set_key_ext(drv, alg, addr, key_idx, seq,
+					  seq_len, key, key_len, key_flag);
 	if (ret == 0)
 		return 0;
 
diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h
index 66a01ce1c..55ebe7502 100644
--- a/src/drivers/driver_wext.h
+++ b/src/drivers/driver_wext.h
@@ -54,9 +54,8 @@  int wpa_driver_wext_set_freq(void *priv, int freq);
 int wpa_driver_wext_set_mode(void *priv, int mode);
 int wpa_driver_wext_set_key(const char *ifname, void *priv, enum wpa_alg alg,
 			    const u8 *addr, int key_idx,
-			    int set_tx, const u8 *seq, size_t seq_len,
-			    const u8 *key, size_t key_len,
-			    enum key_flag key_flag);
+			    const u8 *seq, size_t seq_len, const u8 *key,
+			    size_t key_len, enum key_flag key_flag);
 int wpa_driver_wext_scan(void *priv, struct wpa_driver_scan_params *params);
 struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv);
 
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 7b47e3ac5..e481302b4 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -178,7 +178,7 @@  static u8 * wpa_add_ie(u8 *pos, const u8 *ie, size_t ie_len)
 static int wpa_tdls_del_key(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 {
 	if (wpa_sm_set_key(sm, WPA_ALG_NONE, peer->addr,
-			   0, 0, NULL, 0, NULL, 0, KEY_FLAG_PAIRWISE) < 0) {
+			   0, NULL, 0, NULL, 0, KEY_FLAG_PAIRWISE) < 0) {
 		wpa_printf(MSG_WARNING, "TDLS: Failed to delete TPK-TK from "
 			   "the driver");
 		return -1;
@@ -227,7 +227,7 @@  static int wpa_tdls_set_key(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 
 	wpa_printf(MSG_DEBUG, "TDLS: Configure pairwise key for peer " MACSTR,
 		   MAC2STR(peer->addr));
-	if (wpa_sm_set_key(sm, alg, peer->addr, 0, 1, rsc, sizeof(rsc),
+	if (wpa_sm_set_key(sm, alg, peer->addr, 0, rsc, sizeof(rsc),
 			   peer->tpk.tk, key_len,
 			   KEY_FLAG_PAIRWISE_RX_TX) < 0) {
 		wpa_printf(MSG_WARNING, "TDLS: Failed to set TPK to the "
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index e42e55785..9c76cc34d 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -849,7 +849,7 @@  static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 		wpa_hexdump(MSG_DEBUG, "WPA: RSC", key_rsc, rsclen);
 	}
 
-	if (wpa_sm_set_key(sm, alg, sm->bssid, 0, 1, key_rsc, rsclen,
+	if (wpa_sm_set_key(sm, alg, sm->bssid, 0, key_rsc, rsclen,
 			   sm->ptk.tk, keylen,
 			   KEY_FLAG_PAIRWISE | key_flag) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
@@ -943,7 +943,7 @@  static int wpa_supplicant_install_gtk(struct wpa_sm *sm,
 	}
 	if (sm->pairwise_cipher == WPA_CIPHER_NONE) {
 		if (wpa_sm_set_key(sm, gd->alg, NULL,
-				   gd->keyidx, 1, key_rsc, gd->key_rsc_len,
+				   gd->keyidx, key_rsc, gd->key_rsc_len,
 				   _gtk, gd->gtk_len,
 				   KEY_FLAG_GROUP_RX_TX_DEFAULT) < 0) {
 			wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
@@ -953,7 +953,7 @@  static int wpa_supplicant_install_gtk(struct wpa_sm *sm,
 			return -1;
 		}
 	} else if (wpa_sm_set_key(sm, gd->alg, broadcast_ether_addr,
-				  gd->keyidx, gd->tx, key_rsc, gd->key_rsc_len,
+				  gd->keyidx, key_rsc, gd->key_rsc_len,
 				  _gtk, gd->gtk_len, KEY_FLAG_GROUP_RX) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
 			"WPA: Failed to set GTK to "
@@ -1107,7 +1107,7 @@  static int wpa_supplicant_install_igtk(struct wpa_sm *sm,
 	}
 	if (wpa_sm_set_key(sm, wpa_cipher_to_alg(sm->mgmt_group_cipher),
 			   broadcast_ether_addr,
-			   keyidx, 0, igtk->pn, sizeof(igtk->pn),
+			   keyidx, igtk->pn, sizeof(igtk->pn),
 			   igtk->igtk, len, KEY_FLAG_GROUP_RX) < 0) {
 		if (keyidx == 0x0400 || keyidx == 0x0500) {
 			/* Assume the AP has broken PMF implementation since it
@@ -4589,7 +4589,7 @@  int fils_process_assoc_resp(struct wpa_sm *sm, const u8 *resp, size_t len)
 	rsclen = wpa_cipher_rsc_len(sm->pairwise_cipher);
 	wpa_hexdump_key(MSG_DEBUG, "FILS: Set TK to driver",
 			sm->ptk.tk, keylen);
-	if (wpa_sm_set_key(sm, alg, sm->bssid, 0, 1, null_rsc, rsclen,
+	if (wpa_sm_set_key(sm, alg, sm->bssid, 0, null_rsc, rsclen,
 			   sm->ptk.tk, keylen, KEY_FLAG_PAIRWISE_RX_TX) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
 			"FILS: Failed to set PTK to the driver (alg=%d keylen=%d bssid="
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index b0272097b..3909a995d 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -29,7 +29,7 @@  struct wpa_sm_ctx {
 	void (*deauthenticate)(void *ctx, u16 reason_code);
 	void (*reconnect)(void *ctx);
 	int (*set_key)(void *ctx, enum wpa_alg alg,
-		       const u8 *addr, int key_idx, int set_tx,
+		       const u8 *addr, int key_idx,
 		       const u8 *seq, size_t seq_len,
 		       const u8 *key, size_t key_len, enum key_flag key_flag);
 	void * (*get_network_ctx)(void *ctx);
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index 8a8c545d3..fa3c5afe4 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -422,7 +422,7 @@  static int wpa_ft_install_ptk(struct wpa_sm *sm, const u8 *bssid)
 	alg = wpa_cipher_to_alg(sm->pairwise_cipher);
 	keylen = wpa_cipher_key_len(sm->pairwise_cipher);
 
-	if (wpa_sm_set_key(sm, alg, bssid, 0, 1, null_rsc, sizeof(null_rsc),
+	if (wpa_sm_set_key(sm, alg, bssid, 0, null_rsc, sizeof(null_rsc),
 			   (u8 *) sm->ptk.tk, keylen,
 			   KEY_FLAG_PAIRWISE_RX_TX) < 0) {
 		wpa_printf(MSG_WARNING, "FT: Failed to set PTK to the driver");
@@ -773,7 +773,7 @@  static int wpa_ft_process_gtk_subelem(struct wpa_sm *sm, const u8 *gtk_elem,
 		os_memcpy(gtk + 16, gtk + 24, 8);
 		os_memcpy(gtk + 24, tmp, 8);
 	}
-	if (wpa_sm_set_key(sm, alg, broadcast_ether_addr, keyidx, 0,
+	if (wpa_sm_set_key(sm, alg, broadcast_ether_addr, keyidx,
 			   gtk_elem + 3, rsc_len, gtk, keylen,
 			   KEY_FLAG_GROUP_RX) < 0) {
 		wpa_printf(MSG_WARNING, "WPA: Failed to set GTK to the "
@@ -841,7 +841,7 @@  static int wpa_ft_process_igtk_subelem(struct wpa_sm *sm, const u8 *igtk_elem,
 	wpa_hexdump_key(MSG_DEBUG, "FT: IGTK from Reassoc Resp", igtk,
 			igtk_len);
 	if (wpa_sm_set_key(sm, wpa_cipher_to_alg(sm->mgmt_group_cipher),
-			   broadcast_ether_addr, keyidx, 0,
+			   broadcast_ether_addr, keyidx,
 			   igtk_elem + 2, 6, igtk, igtk_len,
 			   KEY_FLAG_GROUP_RX) < 0) {
 		wpa_printf(MSG_WARNING, "WPA: Failed to set IGTK to the "
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index 634d19bfb..ca3c0a4be 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -203,13 +203,13 @@  static inline void wpa_sm_reconnect(struct wpa_sm *sm)
 }
 
 static inline int wpa_sm_set_key(struct wpa_sm *sm, enum wpa_alg alg,
-				 const u8 *addr, int key_idx, int set_tx,
+				 const u8 *addr, int key_idx,
 				 const u8 *seq, size_t seq_len,
 				 const u8 *key, size_t key_len,
 				 enum key_flag key_flag)
 {
 	WPA_ASSERT(sm->ctx->set_key);
-	return sm->ctx->set_key(sm->ctx->ctx, alg, addr, key_idx, set_tx,
+	return sm->ctx->set_key(sm->ctx->ctx, alg, addr, key_idx,
 				seq, seq_len, key, key_len, key_flag);
 }
 
diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index c138fe571..1cf236337 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -874,7 +874,7 @@  def test_ap_wpa2_delayed_m1_m3_zero_tk(dev, apdev):
     if "OK" not in hapd.request("RESEND_M3 " + addr):
         raise Exception("RESEND_M3 failed")
 
-    if "OK" not in hapd.request("SET_KEY 3 %s %d %d %s %s %d" % (addr, 0, 1, 6*"00", 16*"00", 44)):
+    if "OK" not in hapd.request("SET_KEY 3 %s %d %s %s %d" % (addr, 0, 6*"00", 16*"00", 44)):
         raise Exception("SET_KEY failed")
     time.sleep(0.1)
     hwsim_utils.test_connectivity(dev[0], hapd, timeout=1, broadcast=False,
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 65dcb90f1..4e7b455b2 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5345,20 +5345,20 @@  static void wpa_supplicant_ctrl_iface_drop_sa(struct wpa_supplicant *wpa_s)
 {
 	wpa_printf(MSG_DEBUG, "Dropping SA without deauthentication");
 	/* MLME-DELETEKEYS.request */
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 0, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 0, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 1, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 1, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 2, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 2, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 3, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 3, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 4, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 4, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 5, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, 5, NULL, 0, NULL,
 			0, KEY_FLAG_GROUP);
 
-	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, wpa_s->bssid, 0, 0, NULL, 0, NULL,
+	wpa_drv_set_key(wpa_s, WPA_ALG_NONE, wpa_s->bssid, 0, NULL, 0, NULL,
 			0, KEY_FLAG_PAIRWISE);
 	/* MLME-SETPROTECTION.request(None) */
 	wpa_drv_mlme_setprotection(wpa_s, wpa_s->bssid,
@@ -9356,14 +9356,14 @@  static int wpas_ctrl_reset_pn(struct wpa_supplicant *wpa_s)
 	/* First, use a zero key to avoid any possible duplicate key avoidance
 	 * in the driver. */
 	if (wpa_drv_set_key(wpa_s, wpa_s->last_tk_alg, wpa_s->last_tk_addr,
-			    wpa_s->last_tk_key_idx, 1, zero, 6,
+			    wpa_s->last_tk_key_idx, zero, 6,
 			    zero, wpa_s->last_tk_len,
 			    KEY_FLAG_PAIRWISE_RX_TX) < 0)
 		return -1;
 
 	/* Set the previously configured key to reset its TSC/RSC */
 	return wpa_drv_set_key(wpa_s, wpa_s->last_tk_alg, wpa_s->last_tk_addr,
-			       wpa_s->last_tk_key_idx, 1, zero, 6,
+			       wpa_s->last_tk_key_idx, zero, 6,
 			       wpa_s->last_tk, wpa_s->last_tk_len,
 			       KEY_FLAG_PAIRWISE_RX_TX);
 }
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 11146d34a..85d0f4c7a 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -145,8 +145,7 @@  static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
 
 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
 				  enum wpa_alg alg, const u8 *addr,
-				  int key_idx, int set_tx,
-				  const u8 *seq, size_t seq_len,
+				  int key_idx, const u8 *seq, size_t seq_len,
 				  const u8 *key, size_t key_len,
 				  enum key_flag key_flag)
 {
@@ -158,9 +157,8 @@  static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
 	}
 	if (wpa_s->driver->set_key) {
 		return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
-					      alg, addr, key_idx, set_tx,
-					      seq, seq_len, key, key_len,
-					      key_flag);
+					      alg, addr, key_idx, seq, seq_len,
+					      key, key_len, key_flag);
 	}
 	return -1;
 }
diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c
index 68d063bbc..bdbda0261 100644
--- a/wpa_supplicant/ibss_rsn.c
+++ b/wpa_supplicant/ibss_rsn.c
@@ -138,15 +138,15 @@  static void ibss_check_rsn_completed(struct ibss_rsn_peer *peer)
 
 
 static int supp_set_key(void *ctx, enum wpa_alg alg,
-			const u8 *addr, int key_idx, int set_tx,
+			const u8 *addr, int key_idx,
 			const u8 *seq, size_t seq_len,
 			const u8 *key, size_t key_len, enum key_flag key_flag)
 {
 	struct ibss_rsn_peer *peer = ctx;
 
 	wpa_printf(MSG_DEBUG, "SUPP: %s(alg=%d addr=" MACSTR " key_idx=%d "
-		   "set_tx=%d)",
-		   __func__, alg, MAC2STR(addr), key_idx, set_tx);
+		   "key_flag=%d)",
+		   __func__, alg, MAC2STR(addr), key_idx, key_flag);
 	wpa_hexdump(MSG_DEBUG, "SUPP: set_key - seq", seq, seq_len);
 	wpa_hexdump_key(MSG_DEBUG, "SUPP: set_key - key", key, key_len);
 
@@ -167,7 +167,7 @@  static int supp_set_key(void *ctx, enum wpa_alg alg,
 	if (is_broadcast_ether_addr(addr))
 		addr = peer->addr;
 	return wpa_drv_set_key(peer->ibss_rsn->wpa_s, alg, addr, key_idx,
-			       set_tx, seq, seq_len, key, key_len, key_flag);
+			       seq, seq_len, key, key_len, key_flag);
 }
 
 
@@ -343,7 +343,7 @@  static int auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg,
 	}
 
 	return wpa_drv_set_key(ibss_rsn->wpa_s, alg, addr, idx,
-			       1, seq, 6, key, key_len, key_flag);
+			       seq, 6, key, key_len, key_flag);
 }
 
 
@@ -855,7 +855,7 @@  static void ibss_rsn_handle_auth_1_of_2(struct ibss_rsn *ibss_rsn,
 		 * still have a pairwise key configured. */
 		wpa_printf(MSG_DEBUG, "RSN: Clear pairwise key for peer "
 			   MACSTR, MAC2STR(addr));
-		wpa_drv_set_key(ibss_rsn->wpa_s, WPA_ALG_NONE, addr, 0, 0,
+		wpa_drv_set_key(ibss_rsn->wpa_s, WPA_ALG_NONE, addr, 0,
 				NULL, 0, NULL, 0, KEY_FLAG_PAIRWISE);
 	}
 
diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index 31dd1d3c6..3d6d811d6 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -876,7 +876,7 @@  static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
 	if (conf->security & MESH_CONF_SEC_AMPE) {
 		wpa_hexdump_key(MSG_DEBUG, "mesh: MTK", sta->mtk, sta->mtk_len);
 		wpa_drv_set_key(wpa_s, wpa_cipher_to_alg(conf->pairwise_cipher),
-				sta->addr, 0, 0, seq, sizeof(seq),
+				sta->addr, 0, seq, sizeof(seq),
 				sta->mtk, sta->mtk_len,
 				KEY_FLAG_PAIRWISE_RX_TX);
 
@@ -885,7 +885,7 @@  static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
 		wpa_hexdump_key(MSG_DEBUG, "mesh: RX MGTK",
 				sta->mgtk, sta->mgtk_len);
 		wpa_drv_set_key(wpa_s, wpa_cipher_to_alg(conf->group_cipher),
-				sta->addr, sta->mgtk_key_id, 0,
+				sta->addr, sta->mgtk_key_id,
 				sta->mgtk_rsc, sizeof(sta->mgtk_rsc),
 				sta->mgtk, sta->mgtk_len,
 				KEY_FLAG_GROUP_RX);
@@ -898,7 +898,7 @@  static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
 			wpa_drv_set_key(
 				wpa_s,
 				wpa_cipher_to_alg(conf->mgmt_group_cipher),
-				sta->addr, sta->igtk_key_id, 0,
+				sta->addr, sta->igtk_key_id,
 				sta->igtk_rsc, sizeof(sta->igtk_rsc),
 				sta->igtk, sta->igtk_len,
 				KEY_FLAG_GROUP_RX);
diff --git a/wpa_supplicant/mesh_rsn.c b/wpa_supplicant/mesh_rsn.c
index f19bfbfc6..94ec5ec86 100644
--- a/wpa_supplicant/mesh_rsn.c
+++ b/wpa_supplicant/mesh_rsn.c
@@ -119,7 +119,7 @@  static int auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg,
 	wpa_hexdump_key(MSG_DEBUG, "AUTH: set_key - key", key, key_len);
 
 	return wpa_drv_set_key(mesh_rsn->wpa_s, alg, addr, idx,
-			       1, seq, 6, key, key_len, key_flag);
+			       seq, 6, key, key_len, key_flag);
 }
 
 
@@ -196,8 +196,8 @@  static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr,
 				rsn->igtk, rsn->igtk_len);
 		wpa_drv_set_key(rsn->wpa_s,
 				wpa_cipher_to_alg(rsn->mgmt_group_cipher), NULL,
-				rsn->igtk_key_id, 1,
-				seq, sizeof(seq), rsn->igtk, rsn->igtk_len,
+				rsn->igtk_key_id, seq, sizeof(seq),
+				rsn->igtk, rsn->igtk_len,
 				KEY_FLAG_GROUP_TX_DEFAULT);
 	}
 
@@ -205,7 +205,7 @@  static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr,
 	wpa_hexdump_key(MSG_DEBUG, "mesh: Own TX MGTK",
 			rsn->mgtk, rsn->mgtk_len);
 	wpa_drv_set_key(rsn->wpa_s, wpa_cipher_to_alg(rsn->group_cipher), NULL,
-			rsn->mgtk_key_id, 1, seq, sizeof(seq),
+			rsn->mgtk_key_id, seq, sizeof(seq),
 			rsn->mgtk, rsn->mgtk_len, KEY_FLAG_GROUP_TX_DEFAULT);
 
 	return 0;
diff --git a/wpa_supplicant/preauth_test.c b/wpa_supplicant/preauth_test.c
index 3f2da34e5..b0cc977e8 100644
--- a/wpa_supplicant/preauth_test.c
+++ b/wpa_supplicant/preauth_test.c
@@ -125,7 +125,7 @@  static int wpa_supplicant_get_bssid(void *wpa_s, u8 *bssid)
 
 
 static int wpa_supplicant_set_key(void *wpa_s, enum wpa_alg alg,
-				  const u8 *addr, int key_idx, int set_tx,
+				  const u8 *addr, int key_idx,
 				  const u8 *seq, size_t seq_len,
 				  const u8 *key, size_t key_len)
 {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 4f0861c99..f5a49194f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -141,7 +141,7 @@  int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 
 		set = 1;
 		wpa_drv_set_key(wpa_s, WPA_ALG_WEP, NULL,
-				i, i == ssid->wep_tx_keyidx, NULL, 0,
+				i, NULL, 0,
 				ssid->wep_key[i], ssid->wep_key_len[i],
 				i == ssid->wep_tx_keyidx ?
 				     KEY_FLAG_GROUP_RX_TX_DEFAULT :
@@ -203,7 +203,7 @@  int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
 	/* TODO: should actually remember the previously used seq#, both for TX
 	 * and RX from each STA.. */
 
-	ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, 1, seq, 6, key, keylen,
+	ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, seq, 6, key, keylen,
 			      KEY_FLAG_GROUP_RX_TX_DEFAULT);
 	os_memset(key, 0, sizeof(key));
 	return ret;
@@ -737,12 +737,12 @@  void wpa_clear_keys(struct wpa_supplicant *wpa_s, const u8 *addr)
 	for (i = 0; i < max; i++) {
 		if (wpa_s->keys_cleared & BIT(i))
 			continue;
-		wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, i, 0, NULL, 0,
+		wpa_drv_set_key(wpa_s, WPA_ALG_NONE, NULL, i, NULL, 0,
 				NULL, 0, KEY_FLAG_GROUP);
 	}
 	if (!(wpa_s->keys_cleared & BIT(0)) && addr &&
 	    !is_zero_ether_addr(addr)) {
-		wpa_drv_set_key(wpa_s, WPA_ALG_NONE, addr, 0, 0, NULL, 0, NULL,
+		wpa_drv_set_key(wpa_s, WPA_ALG_NONE, addr, 0, NULL, 0, NULL,
 				0, KEY_FLAG_PAIRWISE);
 		/* MLME-SETPROTECTION.request(None) */
 		wpa_drv_mlme_setprotection(
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 5bf2c2e4f..ced1e3ea3 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -242,7 +242,7 @@  static int wpa_eapol_set_wep_key(void *ctx, int unicast, int keyidx,
 	}
 	return wpa_drv_set_key(wpa_s, WPA_ALG_WEP,
 			       unicast ? wpa_s->bssid : NULL,
-			       keyidx, unicast, NULL, 0, key, keylen,
+			       keyidx, NULL, 0, key, keylen,
 			       unicast ? KEY_FLAG_PAIRWISE_RX_TX :
 					 KEY_FLAG_GROUP_RX_TX_DEFAULT);
 }
@@ -342,7 +342,7 @@  static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
 	wpa_hexdump_key(MSG_DEBUG, "RSN: Configure PMK for driver-based 4-way "
 			"handshake", pmk, pmk_len);
 
-	if (wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, 0, NULL, 0, pmk,
+	if (wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, NULL, 0, pmk,
 			    pmk_len, KEY_FLAG_PMK)) {
 		wpa_printf(MSG_DEBUG, "Failed to set PMK to the driver");
 	}
@@ -498,7 +498,7 @@  static int wpa_supplicant_get_bssid(void *ctx, u8 *bssid)
 
 
 static int wpa_supplicant_set_key(void *_wpa_s, enum wpa_alg alg,
-				  const u8 *addr, int key_idx, int set_tx,
+				  const u8 *addr, int key_idx,
 				  const u8 *seq, size_t seq_len,
 				  const u8 *key, size_t key_len,
 				  enum key_flag key_flag)
@@ -525,7 +525,7 @@  static int wpa_supplicant_set_key(void *_wpa_s, enum wpa_alg alg,
 		wpa_s->last_tk_len = key_len;
 	}
 #endif /* CONFIG_TESTING_OPTIONS */
-	return wpa_drv_set_key(wpa_s, alg, addr, key_idx, set_tx, seq, seq_len,
+	return wpa_drv_set_key(wpa_s, alg, addr, key_idx, seq, seq_len,
 			       key, key_len, key_flag);
 }
 
@@ -1178,7 +1178,7 @@  static int wpa_supplicant_key_mgmt_set_pmk(void *ctx, const u8 *pmk,
 
 	if (wpa_s->conf->key_mgmt_offload &&
 	    (wpa_s->drv_flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD))
-		return wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, 0,
+		return wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0,
 				       NULL, 0, pmk, pmk_len, KEY_FLAG_PMK);
 	else
 		return 0;