]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PASN: Add interface to handle PASN request from the driver
authorVinay Gannevaram <quic_vganneva@quicinc.com>
Tue, 26 Jul 2022 06:46:45 +0000 (12:16 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 2 Sep 2022 12:27:50 +0000 (15:27 +0300)
This brings in the function declarations and data structures that are
required for handling PASN request from the driver, sending secure
ranging context and PASN response to the driver.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/drivers/driver.h
src/drivers/driver_common.c

index 7daedfe2dd100cee1c45c64cf9af51f0524aec9f..20cbda862d289d92f06a860705ab7a3ff926a665 100644 (file)
@@ -2621,6 +2621,90 @@ struct external_auth {
        const u8 *pmkid;
 };
 
+#define WPAS_MAX_PASN_PEERS 10
+
+enum pasn_status {
+       PASN_STATUS_SUCCESS = 0,
+       PASN_STATUS_FAILURE = 1,
+};
+
+/**
+ * struct pasn_peer - PASN peer parameters
+ *
+ * Used to process the PASN authentication event from the driver to
+ * userspace and to send a response back.
+ * @own_addr: Own MAC address specified by the driver to use for PASN
+ *     handshake.
+ * @peer_addr: MAC address of the peer with which PASN authentication is to be
+ *     performed.
+ * @network_id: Unique id for the network.
+ *     This identifier is used as a unique identifier for each network
+ *     block when using the control interface. Each network is allocated an
+ *     id when it is being created, either when reading the configuration
+ *     file or when a new network is added through the control interface.
+ * @akmp: Authentication key management protocol type supported.
+ * @cipher: Cipher suite.
+ * @group: Finite cyclic group. Default group used is 19 (ECC).
+ * @ltf_keyseed_required: Indicates whether LTF keyseed generation is required
+ * @status: PASN response status, %PASN_STATUS_SUCCESS for successful
+ *     authentication, use %PASN_STATUS_FAILURE if PASN authentication
+ *     fails or if wpa_supplicant fails to set the security ranging context to
+ *     the driver
+ */
+struct pasn_peer {
+       u8 own_addr[ETH_ALEN];
+       u8 peer_addr[ETH_ALEN];
+       int network_id;
+       int akmp;
+       int cipher;
+       int group;
+       bool ltf_keyseed_required;
+       enum pasn_status status;
+};
+
+/**
+ * struct pasn_auth - PASN authentication trigger parameters
+ *
+ * These are used across the PASN authentication event from the driver to
+ * userspace and to send a response to it.
+ * @action: Action type. Only significant for the event interface.
+ * @num_peers: The number of peers for which the PASN handshake is requested
+ *     for.
+ * @peer: Holds the peer details.
+ */
+struct pasn_auth {
+       enum {
+               PASN_ACTION_AUTH,
+               PASN_ACTION_DELETE_SECURE_RANGING_CONTEXT,
+       } action;
+       unsigned int num_peers;
+       struct pasn_peer peer[WPAS_MAX_PASN_PEERS];
+};
+
+/**
+ * struct secure_ranging_params - Parameters required to set secure ranging
+ *     context for a peer.
+ *
+ * @action: Add or delete a security context to the driver.
+ * @own_addr: Own MAC address used during key derivation.
+ * @peer_addr: Address of the peer device.
+ * @cipher: Cipher suite.
+ * @tk_len: Length of temporal key.
+ * @tk: Temporal key buffer.
+ * @ltf_keyseed_len: Length of LTF keyseed.
+ * @ltf_keyeed: LTF keyseed buffer.
+ */
+struct secure_ranging_params {
+       u32 action;
+       const u8 *own_addr;
+       const u8 *peer_addr;
+       u32 cipher;
+       u8 tk_len;
+       const u8 *tk;
+       u8 ltf_keyseed_len;
+       const u8 *ltf_keyseed;
+};
+
 /* enum nested_attr - Used to specify if subcommand uses nested attributes */
 enum nested_attr {
        NESTED_ATTR_NOT_USED = 0,
@@ -4689,6 +4773,26 @@ struct wpa_driver_ops {
         */
        int (*dpp_listen)(void *priv, bool enable);
 
+       /**
+        * set_secure_ranging_ctx - Add or delete secure ranging parameters of
+        * the specified peer to the driver.
+        * @priv: Private driver interface data
+        * @params: Secure ranging parameters
+        * Returns: 0 on success, -1 on failure
+        *
+        */
+       int (*set_secure_ranging_ctx)(void *priv,
+                                     struct secure_ranging_params *params);
+
+       /**
+        * send_pasn_resp - Send PASN response for a set of peers to the
+        * driver.
+        * @priv: Private driver interface data
+        * @params: Parameters holding peers and respective status.
+        * Returns: 0 on success, -1 on failure
+        */
+       int (*send_pasn_resp)(void *priv, struct pasn_auth *params);
+
 #ifdef CONFIG_TESTING_OPTIONS
        int (*register_frame)(void *priv, u16 type,
                              const u8 *match, size_t match_len,
@@ -5282,6 +5386,12 @@ enum wpa_event_type {
         * EVENT_CCA_NOTIFY - Notification that CCA has completed
         */
        EVENT_CCA_NOTIFY,
+
+       /**
+        * EVENT_PASN_AUTH - This event is used by the driver that requests
+        * PASN authentication and secure ranging context for multiple peers.
+        */
+       EVENT_PASN_AUTH,
 };
 
 
@@ -6182,6 +6292,12 @@ union wpa_event_data {
        struct bss_color_collision {
                u64 bitmap;
        } bss_color_collision;
+
+       /**
+        * struct pasn_auth - Data for EVENT_PASN_AUTH
+        */
+       struct pasn_auth pasn_auth;
+
 };
 
 /**
index 84e6a9ebdc8407ce59fdc07493074c8fa4ef473a..93b35a6d31255f59389f42fa109999afb171af1e 100644 (file)
@@ -95,6 +95,7 @@ const char * event_to_string(enum wpa_event_type event)
        E2S(CCA_STARTED_NOTIFY);
        E2S(CCA_ABORTED_NOTIFY);
        E2S(CCA_NOTIFY);
+       E2S(PASN_AUTH);
        }
 
        return "UNKNOWN";