Coverage Report

Created: 2026-11-30 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hostap/wpa_supplicant/wpas_idp_pasn.h
Line
Count
Source
1
/*
2
 * wpa_supplicant - NAN IDP PASN authentication context
3
 * Copyright (c) Qualcomm Technologies, Inc.
4
 *
5
 * This software may be distributed under the terms of the BSD license.
6
 * See README for more details.
7
 */
8
9
#ifndef WPAS_IDP_PASN_H
10
#define WPAS_IDP_PASN_H
11
12
struct wpa_supplicant;
13
struct wpas_idp_session;
14
struct pasn_data;
15
struct ieee80211_mgmt;
16
17
#ifdef CONFIG_PASN
18
19
/**
20
 * enum idp_pasn_state - IDP PASN handshake state
21
 */
22
enum idp_pasn_state {
23
  IDP_PASN_IDLE,
24
  IDP_PASN_M1_SENT,
25
  IDP_PASN_M2_SENT,
26
  IDP_PASN_COMPLETED,
27
  IDP_PASN_FAILED,
28
};
29
30
31
/**
32
 * struct idp_pasn_context - IDP PASN handshake context
33
 *
34
 * Tracks a single IDP PASN handshake. The PASN core maintains the cryptographic
35
 * state; this structure stores only the IDP-specific information needed for
36
 * attribute generation and session matching.
37
 */
38
struct idp_pasn_context {
39
  struct wpa_supplicant *wpa_s;
40
  struct wpas_idp_session *session;
41
42
  /* Core PASN data, owns all crypto state */
43
  struct pasn_data *pasn;
44
45
  u8 peer_addr[ETH_ALEN];
46
47
  /* Role in the handshake */
48
  bool is_initiator;
49
50
  enum idp_pasn_state state;
51
52
  /* IDP attributes carried in the Authentication frames */
53
  struct wpabuf *idp_req_attrs;
54
  struct wpabuf *idp_resp_attrs;
55
56
  /* PMKID from PASN M1, kept by the responder to copy into PASN M2 */
57
  u8 m1_pmkid[PMKID_LEN];
58
  bool m1_pmkid_valid;
59
};
60
61
struct idp_pasn_context * wpas_idp_pasn_init(struct wpa_supplicant *wpa_s,
62
               struct wpas_idp_session *session,
63
               const u8 *peer_addr,
64
               bool is_initiator);
65
void wpas_idp_pasn_deinit(struct idp_pasn_context *ctx);
66
67
bool wpas_idp_pasn_is_idp_auth_frame(const u8 *frame_body,
68
             size_t frame_body_len);
69
bool wpas_idp_pasn_has_session_for_peer(struct wpa_supplicant *wpa_s,
70
          const u8 *peer_addr);
71
int wpas_idp_pasn_auth_start(struct wpa_supplicant *wpa_s,
72
           const u8 *peer_addr, int freq);
73
int wpas_idp_pasn_resume_m1(struct wpa_supplicant *wpa_s,
74
          struct wpas_idp_session *session,
75
          const struct wpabuf *m1_frame, int freq);
76
int wpas_idp_pasn_send_reject(struct wpa_supplicant *wpa_s,
77
            const u8 *peer_addr, struct wpabuf *m1_frame);
78
int wpas_idp_pasn_auth_rx(struct wpa_supplicant *wpa_s,
79
        const struct ieee80211_mgmt *mgmt, size_t len,
80
        int freq);
81
int wpas_idp_pasn_auth_tx_status(struct wpa_supplicant *wpa_s,
82
         const u8 *data, size_t data_len, int acked);
83
84
#else /* CONFIG_PASN */
85
86
static inline void wpas_idp_pasn_deinit(struct idp_pasn_context *ctx)
87
0
{
88
0
}
89
90
#endif /* CONFIG_PASN */
91
92
#endif /* WPAS_IDP_PASN_H */