#include "wfx.h"
 #include "hwio.h"
 #include "traces.h"
-#include "secure_link.h"
 #include "hif_rx.h"
 #include "hif_api_cmd.h"
 
        _trace_piggyback(piggyback, false);
 
        hif = (struct hif_msg *)skb->data;
-       WARN(hif->encrypted & 0x1, "unsupported encryption type");
-       if (hif->encrypted == 0x2) {
-               if (WARN(read_len < sizeof(struct hif_sl_msg), "corrupted read"))
-                       goto err;
-               computed_len = le16_to_cpu(((struct hif_sl_msg *)hif)->len);
-               computed_len = round_up(computed_len - sizeof(u16), 16);
-               computed_len += sizeof(struct hif_sl_msg);
-               computed_len += sizeof(struct hif_sl_tag);
-       } else {
-               if (WARN(read_len < sizeof(struct hif_msg), "corrupted read"))
-                       goto err;
-               computed_len = le16_to_cpu(hif->len);
-               computed_len = round_up(computed_len, 2);
-       }
+       WARN(hif->encrypted & 0x3, "encryption is unsupported");
+       if (WARN(read_len < sizeof(struct hif_msg), "corrupted read"))
+               goto err;
+       computed_len = le16_to_cpu(hif->len);
+       computed_len = round_up(computed_len, 2);
        if (computed_len != read_len) {
                dev_err(wdev->dev, "inconsistent message length: %zu != %zu\n",
                        computed_len, read_len);
                               hif, read_len, true);
                goto err;
        }
-       if (hif->encrypted == 0x2) {
-               if (wfx_sl_decode(wdev, (struct hif_sl_msg *)hif)) {
-                       dev_kfree_skb(skb);
-                       // If frame was a confirmation, expect trouble in next
-                       // exchange. However, it is harmless to fail to decode
-                       // an indication frame, so try to continue. Anyway,
-                       // piggyback is probably correct.
-                       return piggyback;
-               }
-       }
 
        if (!(hif->id & HIF_ID_IS_INDICATION)) {
                (*is_cnf)++;
        hif->seqnum = wdev->hif.tx_seqnum;
        wdev->hif.tx_seqnum = (wdev->hif.tx_seqnum + 1) % (HIF_COUNTER_MAX + 1);
 
-       if (wfx_is_secure_command(wdev, hif->id)) {
-               len = round_up(len - sizeof(hif->len), 16) + sizeof(hif->len) +
-                       sizeof(struct hif_sl_msg_hdr) +
-                       sizeof(struct hif_sl_tag);
-               // AES support encryption in-place. However, mac80211 access to
-               // 802.11 header after frame was sent (to get MAC addresses).
-               // So, keep origin buffer clear.
-               data = kmalloc(len, GFP_KERNEL);
-               if (!data)
-                       goto end;
-               is_encrypted = true;
-               ret = wfx_sl_encode(wdev, hif, data);
-               if (ret)
-                       goto end;
-       } else {
-               data = hif;
-       }
+       data = hif;
        WARN(len > wdev->hw_caps.size_inp_ch_buf,
             "%s: request exceed WFx capability: %zu > %d\n", __func__,
             len, wdev->hw_caps.size_inp_ch_buf);
 
        SEC_LINK_ENFORCED    = 0x3
 };
 
-enum hif_sl_encryption_type {
-       NO_ENCRYPTION = 0,
-       TX_ENCRYPTION = 1,
-       RX_ENCRYPTION = 2,
-       HP_ENCRYPTION = 3
-};
-
-struct hif_sl_msg_hdr {
-       u32    seqnum:30;
-       u32    encrypted:2;
-} __packed;
-
-struct hif_sl_msg {
-       struct hif_sl_msg_hdr hdr;
-       __le16 len;
-       u8     payload[];
-} __packed;
-
-#define AES_CCM_TAG_SIZE          16
-
-struct hif_sl_tag {
-       u8     tag[16];
-} __packed;
-
-enum hif_sl_mac_key_dest {
-       SL_MAC_KEY_DEST_OTP = 0x78,
-       SL_MAC_KEY_DEST_RAM = 0x87
-};
-
-#define API_KEY_VALUE_SIZE        32
-
-struct hif_req_set_sl_mac_key {
-       u8     otp_or_ram;
-       u8     key_value[API_KEY_VALUE_SIZE];
-} __packed;
-
-struct hif_cnf_set_sl_mac_key {
-       __le32 status;
-} __packed;
-
-enum hif_sl_session_key_alg {
-       HIF_SL_CURVE25519 = 0x01,
-       HIF_SL_KDF        = 0x02
-};
-
-#define API_HOST_PUB_KEY_SIZE     32
-#define API_HOST_PUB_KEY_MAC_SIZE 64
-
-struct hif_req_sl_exchange_pub_keys {
-       u8     algorithm:2;
-       u8     reserved1:6;
-       u8     reserved2[3];
-       u8     host_pub_key[API_HOST_PUB_KEY_SIZE];
-       u8     host_pub_key_mac[API_HOST_PUB_KEY_MAC_SIZE];
-} __packed;
-
-struct hif_cnf_sl_exchange_pub_keys {
-       __le32 status;
-} __packed;
-
-#define API_NCP_PUB_KEY_SIZE      32
-#define API_NCP_PUB_KEY_MAC_SIZE  64
-
-struct hif_ind_sl_exchange_pub_keys {
-       __le32 status;
-       u8     ncp_pub_key[API_NCP_PUB_KEY_SIZE];
-       u8     ncp_pub_key_mac[API_NCP_PUB_KEY_MAC_SIZE];
-} __packed;
-
-struct hif_req_sl_configure {
-       u8     encr_bmp[32];
-       u8     disable_session_key_protection:1;
-       u8     reserved1:7;
-       u8     reserved2[3];
-} __packed;
-
-struct hif_cnf_sl_configure {
-       __le32 status;
-} __packed;
-
 #endif
 
 #include "bh.h"
 #include "sta.h"
 #include "data_rx.h"
-#include "secure_link.h"
 #include "hif_api_cmd.h"
 
 static int hif_generic_confirm(struct wfx_dev *wdev,
        } else {
                wdev->hif_cmd.buf_send = NULL;
                mutex_unlock(&wdev->hif_cmd.lock);
-               if (cmd != HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS)
-                       mutex_unlock(&wdev->hif_cmd.key_renew_lock);
        }
        return status;
 }
        return 0;
 }
 
-static int hif_keys_indication(struct wfx_dev *wdev,
-                              const struct hif_msg *hif, const void *buf)
-{
-       const struct hif_ind_sl_exchange_pub_keys *body = buf;
-       u8 pubkey[API_NCP_PUB_KEY_SIZE];
-
-       // SL_PUB_KEY_EXCHANGE_STATUS_SUCCESS is used by legacy secure link
-       if (body->status && body->status != HIF_STATUS_SLK_NEGO_SUCCESS)
-               dev_warn(wdev->dev, "secure link negotiation error\n");
-       memcpy(pubkey, body->ncp_pub_key, sizeof(pubkey));
-       memreverse(pubkey, sizeof(pubkey));
-       wfx_sl_check_pubkey(wdev, pubkey, body->ncp_pub_key_mac);
-       return 0;
-}
-
 static int hif_receive_indication(struct wfx_dev *wdev,
                                  const struct hif_msg *hif,
                                  const void *buf, struct sk_buff *skb)
        { HIF_IND_ID_SET_PM_MODE_CMPL,     hif_pm_mode_complete_indication },
        { HIF_IND_ID_SCAN_CMPL,            hif_scan_complete_indication },
        { HIF_IND_ID_SUSPEND_RESUME_TX,    hif_suspend_resume_indication },
-       { HIF_IND_ID_SL_EXCHANGE_PUB_KEYS, hif_keys_indication },
        { HIF_IND_ID_EVENT,                hif_event_indication },
        { HIF_IND_ID_GENERIC,              hif_generic_indication },
        { HIF_IND_ID_ERROR,                hif_error_indication },
 
        init_completion(&hif_cmd->ready);
        init_completion(&hif_cmd->done);
        mutex_init(&hif_cmd->lock);
-       mutex_init(&hif_cmd->key_renew_lock);
 }
 
 static void wfx_fill_header(struct hif_msg *hif, int if_id,
        if (wdev->chip_frozen)
                return -ETIMEDOUT;
 
-       if (cmd != HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS)
-               mutex_lock(&wdev->hif_cmd.key_renew_lock);
-
        mutex_lock(&wdev->hif_cmd.lock);
        WARN(wdev->hif_cmd.buf_send, "data locking error");
 
                         "WSM request %s%s%s (%#.2x) on vif %d returned status %d\n",
                         get_hif_name(cmd), mib_sep, mib_name, cmd, vif, ret);
 
-       if (cmd != HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS)
-               mutex_unlock(&wdev->hif_cmd.key_renew_lock);
        return ret;
 }
 
        else
                control_reg_write(wdev, 0);
        mutex_unlock(&wdev->hif_cmd.lock);
-       mutex_unlock(&wdev->hif_cmd.key_renew_lock);
        kfree(hif);
        return ret;
 }
        kfree(hif);
        return ret;
 }
-
-int hif_sl_send_pub_keys(struct wfx_dev *wdev,
-                        const u8 *pubkey, const u8 *pubkey_hmac)
-{
-       int ret;
-       struct hif_msg *hif;
-       struct hif_req_sl_exchange_pub_keys *body = wfx_alloc_hif(sizeof(*body),
-                                                                 &hif);
-
-       if (!hif)
-               return -ENOMEM;
-       body->algorithm = HIF_SL_CURVE25519;
-       memcpy(body->host_pub_key, pubkey, sizeof(body->host_pub_key));
-       memcpy(body->host_pub_key_mac, pubkey_hmac,
-              sizeof(body->host_pub_key_mac));
-       wfx_fill_header(hif, -1, HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS,
-                       sizeof(*body));
-       ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
-       kfree(hif);
-       // Compatibility with legacy secure link
-       if (ret == le32_to_cpu(HIF_STATUS_SLK_NEGO_SUCCESS))
-               ret = 0;
-       return ret;
-}
-
-int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap)
-{
-       int ret;
-       struct hif_msg *hif;
-       struct hif_req_sl_configure *body = wfx_alloc_hif(sizeof(*body), &hif);
-
-       if (!hif)
-               return -ENOMEM;
-       memcpy(body->encr_bmp, bitmap, sizeof(body->encr_bmp));
-       wfx_fill_header(hif, -1, HIF_REQ_ID_SL_CONFIGURE, sizeof(*body));
-       ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
-       kfree(hif);
-       return ret;
-}
-
-int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination)
-{
-       int ret;
-       struct hif_msg *hif;
-       struct hif_req_set_sl_mac_key *body = wfx_alloc_hif(sizeof(*body),
-                                                           &hif);
-
-       if (!hif)
-               return -ENOMEM;
-       memcpy(body->key_value, slk_key, sizeof(body->key_value));
-       body->otp_or_ram = destination;
-       wfx_fill_header(hif, -1, HIF_REQ_ID_SET_SL_MAC_KEY, sizeof(*body));
-       ret = wfx_cmd_send(wdev, hif, NULL, 0, false);
-       kfree(hif);
-       // Compatibility with legacy secure link
-       if (ret == le32_to_cpu(HIF_STATUS_SLK_SET_KEY_SUCCESS))
-               ret = 0;
-       return ret;
-}
 
 
 struct wfx_hif_cmd {
        struct mutex      lock;
-       struct mutex      key_renew_lock;
        struct completion ready;
        struct completion done;
        bool              async;
 int hif_map_link(struct wfx_vif *wvif,
                 bool unmap, u8 *mac_addr, int sta_id, bool mfp);
 int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len);
-int hif_sl_set_mac_key(struct wfx_dev *wdev,
-                      const u8 *slk_key, int destination);
-int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap);
-int hif_sl_send_pub_keys(struct wfx_dev *wdev,
-                        const u8 *pubkey, const u8 *pubkey_hmac);
 
 #endif
 
 #include "scan.h"
 #include "debug.h"
 #include "data_tx.h"
-#include "secure_link.h"
 #include "hif_tx_mib.h"
 #include "hif_api_cmd.h"
 
        hw->queues = 4;
        hw->max_rates = 8;
        hw->max_rate_tries = 8;
-       hw->extra_tx_headroom = sizeof(struct hif_sl_msg_hdr) +
-                               sizeof(struct hif_msg)
+       hw->extra_tx_headroom = sizeof(struct hif_msg)
                                + sizeof(struct hif_req_tx)
                                + 4 /* alignment */ + 8 /* TKIP IV */;
        hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
                return ERR_CAST(wdev->pdata.gpio_wakeup);
        if (wdev->pdata.gpio_wakeup)
                gpiod_set_consumer_name(wdev->pdata.gpio_wakeup, "wfx wakeup");
-       wfx_sl_fill_pdata(dev, &wdev->pdata);
 
        mutex_init(&wdev->conf_mutex);
        mutex_init(&wdev->rx_stats_lock);
                goto err0;
        }
 
-       err = wfx_sl_init(wdev);
-       if (err && wdev->hw_caps.capabilities.link_mode == SEC_LINK_ENFORCED) {
+       if (wdev->hw_caps.capabilities.link_mode == SEC_LINK_ENFORCED) {
                dev_err(wdev->dev,
                        "chip require secure_link, but can't negotiate it\n");
                goto err0;
        hif_shutdown(wdev);
        wdev->hwbus_ops->irq_unsubscribe(wdev->hwbus_priv);
        wfx_bh_unregister(wdev);
-       wfx_sl_deinit(wdev);
 }
 
 static int __init wfx_core_init(void)
 
+++ /dev/null
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (c) 2019, Silicon Laboratories, Inc.
- */
-#ifndef WFX_SECURE_LINK_H
-#define WFX_SECURE_LINK_H
-
-#include <linux/of.h>
-
-#include "hif_api_general.h"
-
-struct wfx_dev;
-
-
-struct sl_context {
-};
-
-static inline bool wfx_is_secure_command(struct wfx_dev *wdev, int cmd_id)
-{
-       return false;
-}
-
-static inline int wfx_sl_decode(struct wfx_dev *wdev, struct hif_sl_msg *m)
-{
-       return -EIO;
-}
-
-static inline int wfx_sl_encode(struct wfx_dev *wdev,
-                               const struct hif_msg *input,
-                               struct hif_sl_msg *output)
-{
-       return -EIO;
-}
-
-static inline int wfx_sl_check_pubkey(struct wfx_dev *wdev,
-                                     const u8 *ncp_pubkey,
-                                     const u8 *ncp_pubmac)
-{
-       return -EIO;
-}
-
-static inline void wfx_sl_fill_pdata(struct device *dev,
-                                    struct wfx_platform_data *pdata)
-{
-       if (of_find_property(dev->of_node, "slk_key", NULL))
-               dev_err(dev, "secure link is not supported by this driver, ignoring provided key\n");
-}
-
-static inline int wfx_sl_init(struct wfx_dev *wdev)
-{
-       return -EIO;
-}
-
-static inline void wfx_sl_deinit(struct wfx_dev *wdev)
-{
-}
-
-
-#endif
 
 #include "data_tx.h"
 #include "main.h"
 #include "queue.h"
-#include "secure_link.h"
 #include "hif_tx.h"
 
 #define USEC_PER_TXOP 32 // see struct ieee80211_tx_queue_params
        struct completion       firmware_ready;
        struct hif_ind_startup  hw_caps;
        struct wfx_hif          hif;
-       struct sl_context       sl;
        struct delayed_work     cooling_timeout_work;
        bool                    poll_irq;
        bool                    chip_frozen;