Blame SOURCES/macsec-0008-mka-Remove-channel-hacks-from-the-stack-and-the-macs.patch

41389a
From 6f551abdfca16021e7cd9d4ac891e3eb27010a90 Mon Sep 17 00:00:00 2001
41389a
Message-Id: <6f551abdfca16021e7cd9d4ac891e3eb27010a90.1488376601.git.dcaratti@redhat.com>
41389a
From: Sabrina Dubroca <sd@queasysnail.net>
41389a
Date: Fri, 21 Oct 2016 14:45:26 +0200
41389a
Subject: [PATCH] mka: Remove "channel" hacks from the stack and the macsec_qca
41389a
 driver
41389a
41389a
This is specific to the macsec_qca driver. The core implementation
41389a
shouldn't care about this, and only deal with the complete secure
41389a
channel, and pass this down to the driver.
41389a
41389a
Drivers that have such limitations should take care of these in their
41389a
->create functions and throw an error.
41389a
41389a
Since the core MKA no longer saves the channel number, the macsec_qca
41389a
driver must be able to recover it. Add a map (which is just an array
41389a
since it's quite short) to match SCIs to channel numbers, and lookup
41389a
functions that will be called in every place where functions would get
41389a
the channel from the core code. Getting an available channel should be
41389a
part of channel creation, instead of being a preparation step.
41389a
41389a
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
41389a
---
41389a
 src/drivers/driver.h            |  16 ----
41389a
 src/drivers/driver_macsec_qca.c | 174 +++++++++++++++++++++++++++++++++-------
41389a
 src/pae/ieee802_1x_kay.c        |  41 +++-------
41389a
 src/pae/ieee802_1x_kay.h        |   7 --
41389a
 src/pae/ieee802_1x_secy_ops.c   |  40 ---------
41389a
 src/pae/ieee802_1x_secy_ops.h   |   2 -
41389a
 wpa_supplicant/driver_i.h       |  18 -----
41389a
 wpa_supplicant/wpas_kay.c       |  14 ----
41389a
 8 files changed, 159 insertions(+), 153 deletions(-)
41389a
41389a
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
41389a
index aeb9694..54ae6b7 100644
41389a
--- a/src/drivers/driver.h
41389a
+++ b/src/drivers/driver.h
41389a
@@ -3390,14 +3390,6 @@ struct wpa_driver_ops {
41389a
 	int (*set_transmit_next_pn)(void *priv, struct transmit_sa *sa);
41389a
 
41389a
 	/**
41389a
-	 * get_available_receive_sc - get available receive channel
41389a
-	 * @priv: Private driver interface data
41389a
-	 * @channel: secure channel
41389a
-	 * Returns: 0 on success, -1 on failure (or if not supported)
41389a
-	 */
41389a
-	int (*get_available_receive_sc)(void *priv, u32 *channel);
41389a
-
41389a
-	/**
41389a
 	 * create_receive_sc - create secure channel for receiving
41389a
 	 * @priv: Private driver interface data
41389a
 	 * @sc: secure channel
41389a
@@ -3443,14 +3435,6 @@ struct wpa_driver_ops {
41389a
 	int (*disable_receive_sa)(void *priv, struct receive_sa *sa);
41389a
 
41389a
 	/**
41389a
-	 * get_available_transmit_sc - get available transmit channel
41389a
-	 * @priv: Private driver interface data
41389a
-	 * @channel: secure channel
41389a
-	 * Returns: 0 on success, -1 on failure (or if not supported)
41389a
-	 */
41389a
-	int (*get_available_transmit_sc)(void *priv, u32 *channel);
41389a
-
41389a
-	/**
41389a
 	 * create_transmit_sc - create secure connection for transmit
41389a
 	 * @priv: private driver interface data from init()
41389a
 	 * @sc: secure channel
41389a
diff --git a/src/drivers/driver_macsec_qca.c b/src/drivers/driver_macsec_qca.c
41389a
index 041bcf5..22d414c 100644
41389a
--- a/src/drivers/driver_macsec_qca.c
41389a
+++ b/src/drivers/driver_macsec_qca.c
41389a
@@ -56,6 +56,10 @@
41389a
 static const u8 pae_group_addr[ETH_ALEN] =
41389a
 { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 };
41389a
 
41389a
+struct channel_map {
41389a
+	struct ieee802_1x_mka_sci sci;
41389a
+};
41389a
+
41389a
 struct macsec_qca_data {
41389a
 	char ifname[IFNAMSIZ + 1];
41389a
 	u32 secy_id;
41389a
@@ -72,6 +76,9 @@ struct macsec_qca_data {
41389a
 	Boolean protect_frames;
41389a
 	Boolean replay_protect;
41389a
 	u32 replay_window;
41389a
+
41389a
+	struct channel_map receive_channel_map[MAXSC];
41389a
+	struct channel_map transmit_channel_map[MAXSC];
41389a
 };
41389a
 
41389a
 
41389a
@@ -526,6 +533,68 @@ static int macsec_qca_enable_controlled_port(void *priv, Boolean enabled)
41389a
 }
41389a
 
41389a
 
41389a
+static int macsec_qca_lookup_channel(struct channel_map *map,
41389a
+				     struct ieee802_1x_mka_sci *sci,
41389a
+				     u32 *channel)
41389a
+{
41389a
+	u32 i;
41389a
+
41389a
+	for (i = 0; i < MAXSC; i++) {
41389a
+		if (os_memcmp(&map[i].sci, sci,
41389a
+			      sizeof(struct ieee802_1x_mka_sci)) == 0) {
41389a
+			*channel = i;
41389a
+			return 0;
41389a
+		}
41389a
+	}
41389a
+
41389a
+	return -1;
41389a
+}
41389a
+
41389a
+
41389a
+static void macsec_qca_register_channel(struct channel_map *map,
41389a
+					struct ieee802_1x_mka_sci *sci,
41389a
+					u32 channel)
41389a
+{
41389a
+	os_memcpy(&map[channel].sci, sci, sizeof(struct ieee802_1x_mka_sci));
41389a
+}
41389a
+
41389a
+
41389a
+static int macsec_qca_lookup_receive_channel(struct macsec_qca_data *drv,
41389a
+					     struct receive_sc *sc,
41389a
+					     u32 *channel)
41389a
+{
41389a
+	return macsec_qca_lookup_channel(drv->receive_channel_map, &sc->sci,
41389a
+					 channel);
41389a
+}
41389a
+
41389a
+
41389a
+static void macsec_qca_register_receive_channel(struct macsec_qca_data *drv,
41389a
+						struct receive_sc *sc,
41389a
+						u32 channel)
41389a
+{
41389a
+	macsec_qca_register_channel(drv->receive_channel_map, &sc->sci,
41389a
+				    channel);
41389a
+}
41389a
+
41389a
+
41389a
+static int macsec_qca_lookup_transmit_channel(struct macsec_qca_data *drv,
41389a
+					      struct transmit_sc *sc,
41389a
+					      u32 *channel)
41389a
+{
41389a
+	return macsec_qca_lookup_channel(drv->transmit_channel_map, &sc->sci,
41389a
+					 channel);
41389a
+}
41389a
+
41389a
+
41389a
+static void macsec_qca_register_transmit_channel(struct macsec_qca_data *drv,
41389a
+						 struct transmit_sc *sc,
41389a
+						 u32 channel)
41389a
+{
41389a
+	macsec_qca_register_channel(drv->transmit_channel_map, &sc->sci,
41389a
+				    channel);
41389a
+}
41389a
+
41389a
+
41389a
 static int macsec_qca_get_receive_lowest_pn(void *priv, struct receive_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
@@ -533,7 +602,11 @@ static int macsec_qca_get_receive_lowest_pn(void *priv, struct receive_sa *sa)
41389a
 	u32 next_pn = 0;
41389a
 	bool enabled = FALSE;
41389a
 	u32 win;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	ret += nss_macsec_secy_rx_sa_next_pn_get(drv->secy_id, channel, sa->an,
41389a
 						 &next_pn);
41389a
@@ -557,7 +630,11 @@ static int macsec_qca_get_transmit_next_pn(void *priv, struct transmit_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
 	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	ret += nss_macsec_secy_tx_sa_next_pn_get(drv->secy_id, channel, sa->an,
41389a
 						 &sa->next_pn);
41389a
@@ -572,8 +649,11 @@ int macsec_qca_set_transmit_next_pn(void *priv, struct transmit_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
 	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	u32 channel;
41389a
 
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	ret += nss_macsec_secy_tx_sa_next_pn_set(drv->secy_id, channel, sa->an,
41389a
 						 sa->next_pn);
41389a
@@ -620,10 +700,14 @@ static int macsec_qca_create_receive_sc(void *priv, struct receive_sc *sc,
41389a
 	fal_rx_prc_lut_t entry;
41389a
 	fal_rx_sc_validate_frame_e vf;
41389a
 	enum validate_frames validate_frames = validation;
41389a
-	u32 channel = sc->channel;
41389a
+	u32 channel;
41389a
 	const u8 *sci_addr = sc->sci.addr;
41389a
 	u16 sci_port = be_to_host16(sc->sci.port);
41389a
 
41389a
+	ret = macsec_qca_get_available_receive_sc(priv, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
+
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel);
41389a
 
41389a
 	/* rx prc lut */
41389a
@@ -657,6 +741,8 @@ static int macsec_qca_create_receive_sc(void *priv, struct receive_sc *sc,
41389a
 							    channel,
41389a
 							    drv->replay_window);
41389a
 
41389a
+	macsec_qca_register_receive_channel(drv, sc, channel);
41389a
+
41389a
 	return ret;
41389a
 }
41389a
 
41389a
@@ -664,9 +750,13 @@ static int macsec_qca_create_receive_sc(void *priv, struct receive_sc *sc,
41389a
 static int macsec_qca_delete_receive_sc(void *priv, struct receive_sc *sc)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
+	int ret;
41389a
 	fal_rx_prc_lut_t entry;
41389a
-	u32 channel = sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_receive_channel(priv, sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel);
41389a
 
41389a
@@ -683,10 +773,14 @@ static int macsec_qca_delete_receive_sc(void *priv, struct receive_sc *sc)
41389a
 static int macsec_qca_create_receive_sa(void *priv, struct receive_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
+	int ret;
41389a
 	fal_rx_sak_t rx_sak;
41389a
 	int i = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s, channel=%d, an=%d, lpn=0x%x",
41389a
 		   __func__, channel, sa->an, sa->lowest_pn);
41389a
@@ -706,9 +800,12 @@ static int macsec_qca_create_receive_sa(void *priv, struct receive_sa *sa)
41389a
 static int macsec_qca_enable_receive_sa(void *priv, struct receive_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	int ret;
41389a
+	u32 channel;
41389a
 
41389a
+	ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel,
41389a
 		   sa->an);
41389a
@@ -723,8 +820,12 @@ static int macsec_qca_enable_receive_sa(void *priv, struct receive_sa *sa)
41389a
 static int macsec_qca_disable_receive_sa(void *priv, struct receive_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	int ret;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel,
41389a
 		   sa->an);
41389a
@@ -739,14 +840,12 @@ static int macsec_qca_disable_receive_sa(void *priv, struct receive_sa *sa)
41389a
 static int macsec_qca_get_available_transmit_sc(void *priv, u32 *channel)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
 	u32 sc_ch = 0;
41389a
 	bool in_use = FALSE;
41389a
 
41389a
 	for (sc_ch = 0; sc_ch < MAXSC; sc_ch++) {
41389a
-		ret = nss_macsec_secy_tx_sc_in_used_get(drv->secy_id, sc_ch,
41389a
-							&in_use);
41389a
-		if (ret)
41389a
+		if (nss_macsec_secy_tx_sc_in_used_get(drv->secy_id, sc_ch,
41389a
+						      &in_use))
41389a
 			continue;
41389a
 
41389a
 		if (!in_use) {
41389a
@@ -767,10 +866,14 @@ static int macsec_qca_create_transmit_sc(void *priv, struct transmit_sc *sc,
41389a
 					 unsigned int conf_offset)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
+	int ret;
41389a
 	fal_tx_class_lut_t entry;
41389a
 	u8 psci[ETH_ALEN + 2];
41389a
-	u32 channel = sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_get_available_transmit_sc(priv, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel);
41389a
 
41389a
@@ -793,6 +896,8 @@ static int macsec_qca_create_transmit_sc(void *priv, struct transmit_sc *sc,
41389a
 								channel,
41389a
 								conf_offset);
41389a
 
41389a
+	macsec_qca_register_transmit_channel(drv, sc, channel);
41389a
+
41389a
 	return ret;
41389a
 }
41389a
 
41389a
@@ -800,9 +905,13 @@ static int macsec_qca_create_transmit_sc(void *priv, struct transmit_sc *sc,
41389a
 static int macsec_qca_delete_transmit_sc(void *priv, struct transmit_sc *sc)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
+	int ret;
41389a
 	fal_tx_class_lut_t entry;
41389a
-	u32 channel = sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel);
41389a
 
41389a
@@ -819,11 +928,15 @@ static int macsec_qca_delete_transmit_sc(void *priv, struct transmit_sc *sc)
41389a
 static int macsec_qca_create_transmit_sa(void *priv, struct transmit_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
+	int ret;
41389a
 	u8 tci = 0;
41389a
 	fal_tx_sak_t tx_sak;
41389a
 	int i;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG,
41389a
 		   "%s: channel=%d, an=%d, next_pn=0x%x, confidentiality=%d",
41389a
@@ -858,9 +971,12 @@ static int macsec_qca_create_transmit_sa(void *priv, struct transmit_sa *sa)
41389a
 static int macsec_qca_enable_transmit_sa(void *priv, struct transmit_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	int ret;
41389a
+	u32 channel;
41389a
 
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel,
41389a
 		   sa->an);
41389a
@@ -875,8 +991,12 @@ static int macsec_qca_enable_transmit_sa(void *priv, struct transmit_sa *sa)
41389a
 static int macsec_qca_disable_transmit_sa(void *priv, struct transmit_sa *sa)
41389a
 {
41389a
 	struct macsec_qca_data *drv = priv;
41389a
-	int ret = 0;
41389a
-	u32 channel = sa->sc->channel;
41389a
+	int ret;
41389a
+	u32 channel;
41389a
+
41389a
+	ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel);
41389a
+	if (ret != 0)
41389a
+		return ret;
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel,
41389a
 		   sa->an);
41389a
@@ -907,13 +1027,11 @@ const struct wpa_driver_ops wpa_driver_macsec_qca_ops = {
41389a
 	.get_receive_lowest_pn = macsec_qca_get_receive_lowest_pn,
41389a
 	.get_transmit_next_pn = macsec_qca_get_transmit_next_pn,
41389a
 	.set_transmit_next_pn = macsec_qca_set_transmit_next_pn,
41389a
-	.get_available_receive_sc = macsec_qca_get_available_receive_sc,
41389a
 	.create_receive_sc = macsec_qca_create_receive_sc,
41389a
 	.delete_receive_sc = macsec_qca_delete_receive_sc,
41389a
 	.create_receive_sa = macsec_qca_create_receive_sa,
41389a
 	.enable_receive_sa = macsec_qca_enable_receive_sa,
41389a
 	.disable_receive_sa = macsec_qca_disable_receive_sa,
41389a
-	.get_available_transmit_sc = macsec_qca_get_available_transmit_sc,
41389a
 	.create_transmit_sc = macsec_qca_create_transmit_sc,
41389a
 	.delete_transmit_sc = macsec_qca_delete_transmit_sc,
41389a
 	.create_transmit_sa = macsec_qca_create_transmit_sa,
41389a
diff --git a/src/pae/ieee802_1x_kay.c b/src/pae/ieee802_1x_kay.c
41389a
index 52eeeff..38a8293 100644
41389a
--- a/src/pae/ieee802_1x_kay.c
41389a
+++ b/src/pae/ieee802_1x_kay.c
41389a
@@ -440,8 +440,8 @@ ieee802_1x_kay_init_receive_sa(struct receive_sc *psc, u8 an, u32 lowest_pn,
41389a
 
41389a
 	dl_list_add(&psc->sa_list, &psa->list);
41389a
 	wpa_printf(MSG_DEBUG,
41389a
-		   "KaY: Create receive SA(AN: %hhu lowest_pn: %u of SC(channel: %d)",
41389a
-		   an, lowest_pn, psc->channel);
41389a
+		   "KaY: Create receive SA(AN: %hhu lowest_pn: %u of SC",
41389a
+		   an, lowest_pn);
41389a
 
41389a
 	return psa;
41389a
 }
41389a
@@ -465,8 +465,7 @@ static void ieee802_1x_kay_deinit_receive_sa(struct receive_sa *psa)
41389a
  * ieee802_1x_kay_init_receive_sc -
41389a
  */
41389a
 static struct receive_sc *
41389a
-ieee802_1x_kay_init_receive_sc(const struct ieee802_1x_mka_sci *psci,
41389a
-			       int channel)
41389a
+ieee802_1x_kay_init_receive_sc(const struct ieee802_1x_mka_sci *psci)
41389a
 {
41389a
 	struct receive_sc *psc;
41389a
 
41389a
@@ -480,13 +479,12 @@ ieee802_1x_kay_init_receive_sc(const struct ieee802_1x_mka_sci *psci,
41389a
 	}
41389a
 
41389a
 	os_memcpy(&psc->sci, psci, sizeof(psc->sci));
41389a
-	psc->channel = channel;
41389a
 
41389a
 	os_get_time(&psc->created_time);
41389a
 	psc->receiving = FALSE;
41389a
 
41389a
 	dl_list_init(&psc->sa_list);
41389a
-	wpa_printf(MSG_DEBUG, "KaY: Create receive SC(channel: %d)", channel);
41389a
+	wpa_printf(MSG_DEBUG, "KaY: Create receive SC");
41389a
 	wpa_hexdump(MSG_DEBUG, "SCI: ", (u8 *)psci, sizeof(*psci));
41389a
 
41389a
 	return psc;
41389a
@@ -502,8 +500,7 @@ ieee802_1x_kay_deinit_receive_sc(
41389a
 {
41389a
 	struct receive_sa *psa, *pre_sa;
41389a
 
41389a
-	wpa_printf(MSG_DEBUG, "KaY: Delete receive SC(channel: %d)",
41389a
-		   psc->channel);
41389a
+	wpa_printf(MSG_DEBUG, "KaY: Delete receive SC");
41389a
 	dl_list_for_each_safe(psa, pre_sa, &psc->sa_list, struct receive_sa,
41389a
 			      list)  {
41389a
 		secy_disable_receive_sa(participant->kay, psa);
41389a
@@ -552,7 +549,6 @@ ieee802_1x_kay_create_live_peer(struct ieee802_1x_mka_participant *participant,
41389a
 {
41389a
 	struct ieee802_1x_kay_peer *peer;
41389a
 	struct receive_sc *rxsc;
41389a
-	u32 sc_ch = 0;
41389a
 
41389a
 	peer = ieee802_1x_kay_create_peer(mi, mn);
41389a
 	if (!peer)
41389a
@@ -561,9 +557,7 @@ ieee802_1x_kay_create_live_peer(struct ieee802_1x_mka_participant *participant,
41389a
 	os_memcpy(&peer->sci, &participant->current_peer_sci,
41389a
 		  sizeof(peer->sci));
41389a
 
41389a
-	secy_get_available_receive_sc(participant->kay, &sc_ch);
41389a
-
41389a
-	rxsc = ieee802_1x_kay_init_receive_sc(&peer->sci, sc_ch);
41389a
+	rxsc = ieee802_1x_kay_init_receive_sc(&peer->sci);
41389a
 	if (!rxsc) {
41389a
 		os_free(peer);
41389a
 		return NULL;
41389a
@@ -611,12 +605,10 @@ ieee802_1x_kay_move_live_peer(struct ieee802_1x_mka_participant *participant,
41389a
 {
41389a
 	struct ieee802_1x_kay_peer *peer;
41389a
 	struct receive_sc *rxsc;
41389a
-	u32 sc_ch = 0;
41389a
 
41389a
 	peer = ieee802_1x_kay_get_potential_peer(participant, mi);
41389a
 
41389a
-	rxsc = ieee802_1x_kay_init_receive_sc(&participant->current_peer_sci,
41389a
-					      sc_ch);
41389a
+	rxsc = ieee802_1x_kay_init_receive_sc(&participant->current_peer_sci);
41389a
 	if (!rxsc)
41389a
 		return NULL;
41389a
 
41389a
@@ -631,8 +623,6 @@ ieee802_1x_kay_move_live_peer(struct ieee802_1x_mka_participant *participant,
41389a
 	dl_list_del(&peer->list);
41389a
 	dl_list_add_tail(&participant->live_peers, &peer->list);
41389a
 
41389a
-	secy_get_available_receive_sc(participant->kay, &sc_ch);
41389a
-
41389a
 	dl_list_add(&participant->rxsc_list, &rxsc->list);
41389a
 	secy_create_receive_sc(participant->kay, rxsc);
41389a
 
41389a
@@ -2438,8 +2428,8 @@ ieee802_1x_kay_init_transmit_sa(struct transmit_sc *psc, u8 an, u32 next_PN,
41389a
 
41389a
 	dl_list_add(&psc->sa_list, &psa->list);
41389a
 	wpa_printf(MSG_DEBUG,
41389a
-		   "KaY: Create transmit SA(an: %hhu, next_PN: %u) of SC(channel: %d)",
41389a
-		   an, next_PN, psc->channel);
41389a
+		   "KaY: Create transmit SA(an: %hhu, next_PN: %u) of SC",
41389a
+		   an, next_PN);
41389a
 
41389a
 	return psa;
41389a
 }
41389a
@@ -2463,8 +2453,7 @@ static void ieee802_1x_kay_deinit_transmit_sa(struct transmit_sa *psa)
41389a
  * init_transmit_sc -
41389a
  */
41389a
 static struct transmit_sc *
41389a
-ieee802_1x_kay_init_transmit_sc(const struct ieee802_1x_mka_sci *sci,
41389a
-				int channel)
41389a
+ieee802_1x_kay_init_transmit_sc(const struct ieee802_1x_mka_sci *sci)
41389a
 {
41389a
 	struct transmit_sc *psc;
41389a
 
41389a
@@ -2474,7 +2463,6 @@ ieee802_1x_kay_init_transmit_sc(const struct ieee802_1x_mka_sci *sci,
41389a
 		return NULL;
41389a
 	}
41389a
 	os_memcpy(&psc->sci, sci, sizeof(psc->sci));
41389a
-	psc->channel = channel;
41389a
 
41389a
 	os_get_time(&psc->created_time);
41389a
 	psc->transmitting = FALSE;
41389a
@@ -2482,7 +2470,7 @@ ieee802_1x_kay_init_transmit_sc(const struct ieee802_1x_mka_sci *sci,
41389a
 	psc->enciphering_sa = FALSE;
41389a
 
41389a
 	dl_list_init(&psc->sa_list);
41389a
-	wpa_printf(MSG_DEBUG, "KaY: Create transmit SC(channel: %d)", channel);
41389a
+	wpa_printf(MSG_DEBUG, "KaY: Create transmit SC");
41389a
 	wpa_hexdump(MSG_DEBUG, "SCI: ", (u8 *)sci , sizeof(*sci));
41389a
 
41389a
 	return psc;
41389a
@@ -2498,8 +2486,7 @@ ieee802_1x_kay_deinit_transmit_sc(
41389a
 {
41389a
 	struct transmit_sa *psa, *tmp;
41389a
 
41389a
-	wpa_printf(MSG_DEBUG, "KaY: Delete transmit SC(channel: %d)",
41389a
-		   psc->channel);
41389a
+	wpa_printf(MSG_DEBUG, "KaY: Delete transmit SC");
41389a
 	dl_list_for_each_safe(psa, tmp, &psc->sa_list, struct transmit_sa,
41389a
 			      list) {
41389a
 		secy_disable_transmit_sa(participant->kay, psa);
41389a
@@ -3089,7 +3076,6 @@ ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
41389a
 
41389a
 	/* Initialize the SecY must be prio to CP, as CP will control SecY */
41389a
 	secy_init_macsec(kay);
41389a
-	secy_get_available_transmit_sc(kay, &kay->sc_ch);
41389a
 
41389a
 	wpa_printf(MSG_DEBUG, "KaY: secy init macsec done");
41389a
 
41389a
@@ -3250,8 +3236,7 @@ ieee802_1x_kay_create_mka(struct ieee802_1x_kay *kay, struct mka_key_name *ckn,
41389a
 	dl_list_init(&participant->sak_list);
41389a
 	participant->new_key = NULL;
41389a
 	dl_list_init(&participant->rxsc_list);
41389a
-	participant->txsc = ieee802_1x_kay_init_transmit_sc(&kay->actor_sci,
41389a
-							    kay->sc_ch);
41389a
+	participant->txsc = ieee802_1x_kay_init_transmit_sc(&kay->actor_sci);
41389a
 	secy_cp_control_protect_frames(kay, kay->macsec_protect);
41389a
 	secy_cp_control_replay(kay, kay->macsec_replay_protect,
41389a
 			       kay->macsec_replay_window);
41389a
diff --git a/src/pae/ieee802_1x_kay.h b/src/pae/ieee802_1x_kay.h
41389a
index bf6fbe5..c6fa387 100644
41389a
--- a/src/pae/ieee802_1x_kay.h
41389a
+++ b/src/pae/ieee802_1x_kay.h
41389a
@@ -80,8 +80,6 @@ struct transmit_sc {
41389a
 	u8 enciphering_sa; /* AN encipheringSA (read only) */
41389a
 
41389a
 	/* not defined data */
41389a
-	unsigned int channel;
41389a
-
41389a
 	struct dl_list list;
41389a
 	struct dl_list sa_list;
41389a
 };
41389a
@@ -109,8 +107,6 @@ struct receive_sc {
41389a
 
41389a
 	struct os_time created_time; /* Time createdTime */
41389a
 
41389a
-	unsigned int channel;
41389a
-
41389a
 	struct dl_list list;
41389a
 	struct dl_list sa_list;
41389a
 };
41389a
@@ -146,7 +142,6 @@ struct ieee802_1x_kay_ctx {
41389a
 	int (*get_receive_lowest_pn)(void *ctx, struct receive_sa *sa);
41389a
 	int (*get_transmit_next_pn)(void *ctx, struct transmit_sa *sa);
41389a
 	int (*set_transmit_next_pn)(void *ctx, struct transmit_sa *sa);
41389a
-	int (*get_available_receive_sc)(void *ctx, u32 *channel);
41389a
 	int (*create_receive_sc)(void *ctx, struct receive_sc *sc,
41389a
 				 enum validate_frames vf,
41389a
 				 enum confidentiality_offset co);
41389a
@@ -154,7 +149,6 @@ struct ieee802_1x_kay_ctx {
41389a
 	int (*create_receive_sa)(void *ctx, struct receive_sa *sa);
41389a
 	int (*enable_receive_sa)(void *ctx, struct receive_sa *sa);
41389a
 	int (*disable_receive_sa)(void *ctx, struct receive_sa *sa);
41389a
-	int (*get_available_transmit_sc)(void *ctx, u32 *channel);
41389a
 	int (*create_transmit_sc)(void *ctx, struct transmit_sc *sc,
41389a
 				  enum confidentiality_offset co);
41389a
 	int (*delete_transmit_sc)(void *ctx, struct transmit_sc *sc);
41389a
@@ -209,7 +203,6 @@ struct ieee802_1x_kay {
41389a
 
41389a
 	u8 mka_version;
41389a
 	u8 algo_agility[4];
41389a
-	u32 sc_ch;
41389a
 
41389a
 	u32 pn_exhaustion;
41389a
 	Boolean port_enable;
41389a
diff --git a/src/pae/ieee802_1x_secy_ops.c b/src/pae/ieee802_1x_secy_ops.c
41389a
index 32ee816..b57c670 100644
41389a
--- a/src/pae/ieee802_1x_secy_ops.c
41389a
+++ b/src/pae/ieee802_1x_secy_ops.c
41389a
@@ -196,26 +196,6 @@ int secy_set_transmit_next_pn(struct ieee802_1x_kay *kay,
41389a
 }
41389a
 
41389a
 
41389a
-int secy_get_available_receive_sc(struct ieee802_1x_kay *kay, u32 *channel)
41389a
-{
41389a
-	struct ieee802_1x_kay_ctx *ops;
41389a
-
41389a
-	if (!kay) {
41389a
-		wpa_printf(MSG_ERROR, "KaY: %s params invalid", __func__);
41389a
-		return -1;
41389a
-	}
41389a
-
41389a
-	ops = kay->ctx;
41389a
-	if (!ops || !ops->get_available_receive_sc) {
41389a
-		wpa_printf(MSG_ERROR,
41389a
-			   "KaY: secy get_available_receive_sc operation not supported");
41389a
-		return -1;
41389a
-	}
41389a
-
41389a
-	return ops->get_available_receive_sc(ops->ctx, channel);
41389a
-}
41389a
-
41389a
-
41389a
 int secy_create_receive_sc(struct ieee802_1x_kay *kay, struct receive_sc *rxsc)
41389a
 {
41389a
 	struct ieee802_1x_kay_ctx *ops;
41389a
@@ -320,26 +300,6 @@ int secy_disable_receive_sa(struct ieee802_1x_kay *kay, struct receive_sa *rxsa)
41389a
 }
41389a
 
41389a
 
41389a
-int secy_get_available_transmit_sc(struct ieee802_1x_kay *kay, u32 *channel)
41389a
-{
41389a
-	struct ieee802_1x_kay_ctx *ops;
41389a
-
41389a
-	if (!kay) {
41389a
-		wpa_printf(MSG_ERROR, "KaY: %s params invalid", __func__);
41389a
-		return -1;
41389a
-	}
41389a
-
41389a
-	ops = kay->ctx;
41389a
-	if (!ops || !ops->get_available_transmit_sc) {
41389a
-		wpa_printf(MSG_ERROR,
41389a
-			   "KaY: secy get_available_transmit_sc operation not supported");
41389a
-		return -1;
41389a
-	}
41389a
-
41389a
-	return ops->get_available_transmit_sc(ops->ctx, channel);
41389a
-}
41389a
-
41389a
-
41389a
 int secy_create_transmit_sc(struct ieee802_1x_kay *kay,
41389a
 			    struct transmit_sc *txsc)
41389a
 {
41389a
diff --git a/src/pae/ieee802_1x_secy_ops.h b/src/pae/ieee802_1x_secy_ops.h
41389a
index bfd5737..59f0baa 100644
41389a
--- a/src/pae/ieee802_1x_secy_ops.h
41389a
+++ b/src/pae/ieee802_1x_secy_ops.h
41389a
@@ -35,7 +35,6 @@ int secy_get_transmit_next_pn(struct ieee802_1x_kay *kay,
41389a
 			      struct transmit_sa *txsa);
41389a
 int secy_set_transmit_next_pn(struct ieee802_1x_kay *kay,
41389a
 			      struct transmit_sa *txsa);
41389a
-int secy_get_available_receive_sc(struct ieee802_1x_kay *kay, u32 *channel);
41389a
 int secy_create_receive_sc(struct ieee802_1x_kay *kay, struct receive_sc *rxsc);
41389a
 int secy_delete_receive_sc(struct ieee802_1x_kay *kay, struct receive_sc *rxsc);
41389a
 int secy_create_receive_sa(struct ieee802_1x_kay *kay, struct receive_sa *rxsa);
41389a
@@ -43,7 +42,6 @@ int secy_enable_receive_sa(struct ieee802_1x_kay *kay, struct receive_sa *rxsa);
41389a
 int secy_disable_receive_sa(struct ieee802_1x_kay *kay,
41389a
 			    struct receive_sa *rxsa);
41389a
 
41389a
-int secy_get_available_transmit_sc(struct ieee802_1x_kay *kay, u32 *channel);
41389a
 int secy_create_transmit_sc(struct ieee802_1x_kay *kay,
41389a
 			    struct transmit_sc *txsc);
41389a
 int secy_delete_transmit_sc(struct ieee802_1x_kay *kay,
41389a
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
41389a
index f8efddc..244e386 100644
41389a
--- a/wpa_supplicant/driver_i.h
41389a
+++ b/wpa_supplicant/driver_i.h
41389a
@@ -780,15 +780,6 @@ static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s,
41389a
 	return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, sa);
41389a
 }
41389a
 
41389a
-static inline int wpa_drv_get_available_receive_sc(struct wpa_supplicant *wpa_s,
41389a
-						   u32 *channel)
41389a
-{
41389a
-	if (!wpa_s->driver->get_available_receive_sc)
41389a
-		return -1;
41389a
-	return wpa_s->driver->get_available_receive_sc(wpa_s->drv_priv,
41389a
-						       channel);
41389a
-}
41389a
-
41389a
 static inline int
41389a
 wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, struct receive_sc *sc,
41389a
 			  unsigned int conf_offset, int validation)
41389a
@@ -832,15 +823,6 @@ static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s,
41389a
 }
41389a
 
41389a
 static inline int
41389a
-wpa_drv_get_available_transmit_sc(struct wpa_supplicant *wpa_s, u32 *channel)
41389a
-{
41389a
-	if (!wpa_s->driver->get_available_transmit_sc)
41389a
-		return -1;
41389a
-	return wpa_s->driver->get_available_transmit_sc(wpa_s->drv_priv,
41389a
-							channel);
41389a
-}
41389a
-
41389a
-static inline int
41389a
 wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, struct transmit_sc *sc,
41389a
 			   unsigned int conf_offset)
41389a
 {
41389a
diff --git a/wpa_supplicant/wpas_kay.c b/wpa_supplicant/wpas_kay.c
41389a
index 29b7b56..64364f7 100644
41389a
--- a/wpa_supplicant/wpas_kay.c
41389a
+++ b/wpa_supplicant/wpas_kay.c
41389a
@@ -86,12 +86,6 @@ static int wpas_set_transmit_next_pn(void *wpa_s, struct transmit_sa *sa)
41389a
 }
41389a
 
41389a
 
41389a
-static int wpas_get_available_receive_sc(void *wpa_s, u32 *channel)
41389a
-{
41389a
-	return wpa_drv_get_available_receive_sc(wpa_s, channel);
41389a
-}
41389a
-
41389a
-
41389a
 static unsigned int conf_offset_val(enum confidentiality_offset co)
41389a
 {
41389a
 	switch (co) {
41389a
@@ -138,12 +132,6 @@ static int wpas_disable_receive_sa(void *wpa_s, struct receive_sa *sa)
41389a
 }
41389a
 
41389a
 
41389a
-static int wpas_get_available_transmit_sc(void *wpa_s, u32 *channel)
41389a
-{
41389a
-	return wpa_drv_get_available_transmit_sc(wpa_s, channel);
41389a
-}
41389a
-
41389a
-
41389a
 static int
41389a
 wpas_create_transmit_sc(void *wpa_s, struct transmit_sc *sc,
41389a
 			enum confidentiality_offset co)
41389a
@@ -205,13 +193,11 @@ int ieee802_1x_alloc_kay_sm(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
41389a
 	kay_ctx->get_receive_lowest_pn = wpas_get_receive_lowest_pn;
41389a
 	kay_ctx->get_transmit_next_pn = wpas_get_transmit_next_pn;
41389a
 	kay_ctx->set_transmit_next_pn = wpas_set_transmit_next_pn;
41389a
-	kay_ctx->get_available_receive_sc = wpas_get_available_receive_sc;
41389a
 	kay_ctx->create_receive_sc = wpas_create_receive_sc;
41389a
 	kay_ctx->delete_receive_sc = wpas_delete_receive_sc;
41389a
 	kay_ctx->create_receive_sa = wpas_create_receive_sa;
41389a
 	kay_ctx->enable_receive_sa = wpas_enable_receive_sa;
41389a
 	kay_ctx->disable_receive_sa = wpas_disable_receive_sa;
41389a
-	kay_ctx->get_available_transmit_sc = wpas_get_available_transmit_sc;
41389a
 	kay_ctx->create_transmit_sc = wpas_create_transmit_sc;
41389a
 	kay_ctx->delete_transmit_sc = wpas_delete_transmit_sc;
41389a
 	kay_ctx->create_transmit_sa = wpas_create_transmit_sa;
41389a
-- 
41389a
2.7.4
41389a