History

wifi: cfg80211: add LTF keyseed support for secure ranging

Currently there is no way to install an LTF key seed that can be used in non-trigger-based (NTB) and trigger-based (TB) FTM ranging to protect NDP frames. Without this, drivers cannot enable PHY-layer security for peer measurement sessions, leaving ranging measurements vulnerable to eavesdropping and manipulation. Introduce NL80211_KEY_LTF_SEED attribute and the dedicated extended feature flag NL80211_EXT_FEATURE_SET_KEY_LTF_SEED to allow drivers to advertise and install LTF key seeds via nl80211. The key seed must be configured beforehand to ensure the peer measurement session is secure. The driver must advertise both NL80211_EXT_FEATURE_SECURE_LTF and NL80211_EXT_FEATURE_SET_KEY_LTF_SEED for the key seed installation to be permitted. The LTF key seed is pairwise key material and must only be used with pairwise key type. Reject attempts to use it with other key types.

Peddolla Harshavardhan Reddy committed 6 months ago

Commit 4bb6e581 parent 410aa475 files · +47 −0Browse files

Unified · Split

5 files
  1. include/linux/ieee80211.h +1 −0
  2. include/net/cfg80211.h +4 −0
  3. include/uapi/linux/nl80211.h +18 −0
  4. net/wireless/nl80211.c +9 −0
  5. net/wireless/util.c +15 −0
include/linux/ieee80211.h+1−0
@@ -2236,6 +2236,7 @@ struct ieee80211_multiple_bssid_configuration { · 2235 unmodified lines
22362236 #define WLAN_AKM_SUITE_WFA_DPP SUITE(WLAN_OUI_WFA, 2)
22372237
22382238 #define WLAN_MAX_KEY_LEN 32
2239+#define WLAN_MAX_SECURE_LTF_KEYSEED_LEN 48
22392240
22402241 #define WLAN_PMK_NAME_LEN 16
22412242 #define WLAN_PMKID_LEN 16
include/net/cfg80211.h+4−0
@@ -830,6 +830,8 @@ struct vif_params { · 829 unmodified lines
830830 * @seq_len: length of @seq.
831831 * @vlan_id: vlan_id for VLAN group key (if nonzero)
832832 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
833+ * @ltf_keyseed: LTF key seed material
834+ * @ltf_keyseed_len: length of LTF key seed material
833835 */
834836 struct key_params {
835837 const u8 *key;
@@ -839,6 +841,8 @@ struct key_params { · 3 unmodified lines
839841 u16 vlan_id;
840842 u32 cipher;
841843 enum nl80211_key_mode mode;
844+ const u8 *ltf_keyseed;
845+ size_t ltf_keyseed_len;
842846 };
843847
844848 /**
include/uapi/linux/nl80211.h+18−0
@@ -5814,6 +5814,18 @@ enum nl80211_key_default_types { · 5813 unmodified lines
58145814 * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
58155815 * Defaults to @NL80211_KEY_RX_TX.
58165816 * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key
5817+ * @NL80211_KEY_LTF_SEED: LTF key seed is used by the driver to generate
5818+ * secure LTF keys used in case of peer measurement request with FTM
5819+ * request type as either %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED
5820+ * or %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED. Secure LTF key seeds
5821+ * will help enable PHY security in peer measurement session.
5822+ * The LTF key seed is installed along with the TK (Temporal Key) using
5823+ * %NL80211_CMD_NEW_KEY. The TK is configured using the
5824+ * %NL80211_ATTR_KEY_DATA attribute, while the LTF key seed is configured
5825+ * using this attribute. Both keys must be configured before initiation
5826+ * of peer measurement to ensure peer measurement session is secure.
5827+ * Only valid if %NL80211_EXT_FEATURE_SET_KEY_LTF_SEED is set. This
5828+ * attribute is restricted to pairwise keys (%NL80211_KEYTYPE_PAIRWISE).
58175829 *
58185830 * @__NL80211_KEY_AFTER_LAST: internal
58195831 * @NL80211_KEY_MAX: highest key attribute
@@ -5830,6 +5842,7 @@ enum nl80211_key_attributes { · 10 unmodified lines
58305842 NL80211_KEY_DEFAULT_TYPES,
58315843 NL80211_KEY_MODE,
58325844 NL80211_KEY_DEFAULT_BEACON,
5845+ NL80211_KEY_LTF_SEED,
58335846
58345847 /* keep last */
58355848 __NL80211_KEY_AFTER_LAST,
@@ -7059,6 +7072,10 @@ enum nl80211_feature_flags { · 1223 unmodified lines
70597072 * forward frames with a matching MAC address to userspace during
70607073 * the off-channel period.
70617074 *
7075+ * @NL80211_EXT_FEATURE_SET_KEY_LTF_SEED: Driver supports installing the
7076+ * LTF key seed via %NL80211_KEY_LTF_SEED. The seed is used to generate
7077+ * secure LTF keys for secure LTF measurement sessions.
7078+ *
70627079 * @NUM_NL80211_EXT_FEATURES: number of extended features.
70637080 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
70647081 */
@@ -7139,6 +7156,7 @@ enum nl80211_ext_feature_index { · 74 unmodified lines
71397156 NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION,
71407157 NL80211_EXT_FEATURE_IEEE8021X_AUTH,
71417158 NL80211_EXT_FEATURE_ROC_ADDR_FILTER,
7159+ NL80211_EXT_FEATURE_SET_KEY_LTF_SEED,
71427160
71437161 /* add new features before the definition below */
71447162 NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c+9−0
@@ -1103,6 +1103,10 @@ static const struct nla_policy nl80211_key_policy[NL80211_KEY_MAX + 1] = { · 1102 unmodified lines
11031103 [NL80211_KEY_TYPE] = NLA_POLICY_MAX(NLA_U32, NUM_NL80211_KEYTYPES - 1),
11041104 [NL80211_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED },
11051105 [NL80211_KEY_MODE] = NLA_POLICY_RANGE(NLA_U8, 0, NL80211_KEY_SET_TX),
1106+ [NL80211_KEY_LTF_SEED] = {
1107+ .type = NLA_BINARY,
1108+ .len = WLAN_MAX_SECURE_LTF_KEYSEED_LEN,
1109+ },
11061110 };
11071111
11081112 /* policy for the key default flags */
@@ -1634,6 +1638,11 @@ static int nl80211_parse_key_new(struct genl_info *info, struct nlattr *key, · 525 unmodified lines
16341638 if (tb[NL80211_KEY_MODE])
16351639 k->p.mode = nla_get_u8(tb[NL80211_KEY_MODE]);
16361640
1641+ if (tb[NL80211_KEY_LTF_SEED]) {
1642+ k->p.ltf_keyseed = nla_data(tb[NL80211_KEY_LTF_SEED]);
1643+ k->p.ltf_keyseed_len = nla_len(tb[NL80211_KEY_LTF_SEED]);
1644+ }
1645+
16371646 return 0;
16381647 }
16391648
net/wireless/util.c+15−0
@@ -434,6 +434,21 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, · 433 unmodified lines
434434 if (!cfg80211_supported_cipher_suite(&rdev->wiphy, params->cipher))
435435 return -EINVAL;
436436
437+ if (params->ltf_keyseed) {
438+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
439+ NL80211_EXT_FEATURE_SECURE_LTF) ||
440+ !wiphy_ext_feature_isset(&rdev->wiphy,
441+ NL80211_EXT_FEATURE_SET_KEY_LTF_SEED))
442+ return -EOPNOTSUPP;
443+
444+ /*
445+ * LTF key seed is pairwise key material and must only be
446+ * used with a pairwise key
447+ */
448+ if (!pairwise)
449+ return -EINVAL;
450+ }
451+
437452 return 0;
438453 }
439454