hostapd
peerkey.h
1 /*
2  * WPA Supplicant - PeerKey for Direct Link Setup (DLS)
3  * Copyright (c) 2006-2015, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef PEERKEY_H
10 #define PEERKEY_H
11 
12 #define PEERKEY_MAX_IE_LEN 80
13 struct wpa_peerkey {
14  struct wpa_peerkey *next;
15  int initiator; /* whether this end was initator for SMK handshake */
16  u8 addr[ETH_ALEN]; /* other end MAC address */
17  u8 inonce[WPA_NONCE_LEN]; /* Initiator Nonce */
18  u8 pnonce[WPA_NONCE_LEN]; /* Peer Nonce */
19  u8 rsnie_i[PEERKEY_MAX_IE_LEN]; /* Initiator RSN IE */
20  size_t rsnie_i_len;
21  u8 rsnie_p[PEERKEY_MAX_IE_LEN]; /* Peer RSN IE */
22  size_t rsnie_p_len;
23  u8 smk[PMK_LEN];
24  int smk_complete;
25  u8 smkid[PMKID_LEN];
26  u32 lifetime;
27  int cipher; /* Selected cipher (WPA_CIPHER_*) */
28  u8 replay_counter[WPA_REPLAY_COUNTER_LEN];
29  int replay_counter_set;
30  int akmp;
31 
32  struct wpa_ptk stk, tstk;
33  int stk_set, tstk_set;
34 };
35 
36 
37 #ifdef CONFIG_PEERKEY
38 
39 int peerkey_verify_eapol_key_mic(struct wpa_sm *sm,
40  struct wpa_peerkey *peerkey,
41  struct wpa_eapol_key *key, u16 ver,
42  const u8 *buf, size_t len);
43 void peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey,
44  struct wpa_eapol_key *key, u16 key_info, u16 ver,
45  const u8 *key_data, size_t key_data_len);
46 void peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr,
47  struct wpa_eapol_key *key, const u8 *key_data,
48  size_t key_data_len, u16 key_info, u16 ver);
49 void peerkey_deinit(struct wpa_sm *sm);
50 
51 #else /* CONFIG_PEERKEY */
52 
53 static inline int
54 peerkey_verify_eapol_key_mic(struct wpa_sm *sm,
55  struct wpa_peerkey *peerkey,
56  struct wpa_eapol_key *key, u16 ver,
57  const u8 *buf, size_t len)
58 {
59  return -1;
60 }
61 
62 static inline void
63 peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey,
64  struct wpa_eapol_key *key, u16 key_info, u16 ver,
65  const u8 *key_data, size_t key_data_len)
66 {
67 }
68 
69 static inline void
70 peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr,
71  struct wpa_eapol_key *key, const u8 *key_data,
72  size_t key_data_len, u16 key_info, u16 ver)
73 {
74 }
75 
76 static inline void peerkey_deinit(struct wpa_sm *sm)
77 {
78 }
79 
80 #endif /* CONFIG_PEERKEY */
81 
82 #endif /* PEERKEY_H */
Definition: wpa_common.h:176
struct wpa_ptk - WPA Pairwise Transient Key IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy ...
Definition: wpa_common.h:201
Definition: peerkey.h:13
struct wpa_sm - Internal WPA state machine data
Definition: wpa_i.h:21