$search
00001 /* 00002 * WPA Supplicant - PeerKey for Direct Link Setup (DLS) 00003 * Copyright (c) 2006-2008, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef PEERKEY_H 00016 #define PEERKEY_H 00017 00018 #define PEERKEY_MAX_IE_LEN 80 00019 struct wpa_peerkey { 00020 struct wpa_peerkey *next; 00021 int initiator; /* whether this end was initator for SMK handshake */ 00022 u8 addr[ETH_ALEN]; /* other end MAC address */ 00023 u8 inonce[WPA_NONCE_LEN]; /* Initiator Nonce */ 00024 u8 pnonce[WPA_NONCE_LEN]; /* Peer Nonce */ 00025 u8 rsnie_i[PEERKEY_MAX_IE_LEN]; /* Initiator RSN IE */ 00026 size_t rsnie_i_len; 00027 u8 rsnie_p[PEERKEY_MAX_IE_LEN]; /* Peer RSN IE */ 00028 size_t rsnie_p_len; 00029 u8 smk[PMK_LEN]; 00030 int smk_complete; 00031 u8 smkid[PMKID_LEN]; 00032 u32 lifetime; 00033 os_time_t expiration; 00034 int cipher; /* Selected cipher (WPA_CIPHER_*) */ 00035 u8 replay_counter[WPA_REPLAY_COUNTER_LEN]; 00036 int replay_counter_set; 00037 int use_sha256; /* whether AKMP indicate SHA256-based derivations */ 00038 00039 struct wpa_ptk stk, tstk; 00040 int stk_set, tstk_set; 00041 }; 00042 00043 00044 #ifdef CONFIG_PEERKEY 00045 00046 int peerkey_verify_eapol_key_mic(struct wpa_sm *sm, 00047 struct wpa_peerkey *peerkey, 00048 struct wpa_eapol_key *key, u16 ver, 00049 const u8 *buf, size_t len); 00050 void peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey, 00051 struct wpa_eapol_key *key, u16 key_info, u16 ver); 00052 void peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr, 00053 struct wpa_eapol_key *key, size_t extra_len, 00054 u16 key_info, u16 ver); 00055 void peerkey_deinit(struct wpa_sm *sm); 00056 00057 #else /* CONFIG_PEERKEY */ 00058 00059 static inline int 00060 peerkey_verify_eapol_key_mic(struct wpa_sm *sm, 00061 struct wpa_peerkey *peerkey, 00062 struct wpa_eapol_key *key, u16 ver, 00063 const u8 *buf, size_t len) 00064 { 00065 return -1; 00066 } 00067 00068 static inline void 00069 peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey, 00070 struct wpa_eapol_key *key, u16 key_info, u16 ver) 00071 { 00072 } 00073 00074 static inline void 00075 peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr, 00076 struct wpa_eapol_key *key, size_t extra_len, 00077 u16 key_info, u16 ver) 00078 { 00079 } 00080 00081 static inline void peerkey_deinit(struct wpa_sm *sm) 00082 { 00083 } 00084 00085 #endif /* CONFIG_PEERKEY */ 00086 00087 #endif /* PEERKEY_H */