Classes | Defines | Functions | Variables
wpa_common.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rsn_error_kde
struct  rsn_ie_hdr
struct  wpa_eapol_key
struct  wpa_ie_data
struct  wpa_ie_hdr
struct  wpa_ptk

Defines

#define FT_R0KH_ID_MAX_LEN   48
#define FT_R1KH_ID_LEN   6
#define MOBILITY_DOMAIN_ID_LEN   2
#define PMK_LEN   32
#define PMKID_LEN   16
#define RSN_AUTH_KEY_MGMT_802_1X_SHA256   RSN_SELECTOR(0x00, 0x0f, 0xac, 5)
#define RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X   RSN_SELECTOR(0x00, 0x0f, 0xac, 2)
#define RSN_AUTH_KEY_MGMT_PSK_SHA256   RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
#define RSN_AUTH_KEY_MGMT_UNSPEC_802_1X   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
#define RSN_CIPHER_SUITE_CCMP   RSN_SELECTOR(0x00, 0x0f, 0xac, 4)
#define RSN_CIPHER_SUITE_NONE   RSN_SELECTOR(0x00, 0x0f, 0xac, 0)
#define RSN_CIPHER_SUITE_TKIP   RSN_SELECTOR(0x00, 0x0f, 0xac, 2)
#define RSN_CIPHER_SUITE_WEP104   RSN_SELECTOR(0x00, 0x0f, 0xac, 5)
#define RSN_CIPHER_SUITE_WEP40   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
#define RSN_KEY_DATA_GROUPKEY   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
#define RSN_KEY_DATA_MAC_ADDR   RSN_SELECTOR(0x00, 0x0f, 0xac, 3)
#define RSN_KEY_DATA_PMKID   RSN_SELECTOR(0x00, 0x0f, 0xac, 4)
#define RSN_NUM_REPLAY_COUNTERS_1   0
#define RSN_NUM_REPLAY_COUNTERS_16   3
#define RSN_NUM_REPLAY_COUNTERS_2   1
#define RSN_NUM_REPLAY_COUNTERS_4   2
#define RSN_SELECTOR(a, b, c, d)
#define RSN_SELECTOR_GET(a)   WPA_GET_BE32((const u8 *) (a))
#define RSN_SELECTOR_LEN   4
#define RSN_SELECTOR_PUT(a, val)   WPA_PUT_BE32((u8 *) (a), (val))
#define RSN_VERSION   1
#define WPA_AUTH_KEY_MGMT_NONE   RSN_SELECTOR(0x00, 0x50, 0xf2, 0)
#define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X   RSN_SELECTOR(0x00, 0x50, 0xf2, 2)
#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)
#define WPA_CAPABILITY_MFPC   BIT(7)
#define WPA_CAPABILITY_MFPR   BIT(6)
#define WPA_CAPABILITY_NO_PAIRWISE   BIT(1)
#define WPA_CAPABILITY_PEERKEY_ENABLED   BIT(9)
#define WPA_CAPABILITY_PREAUTH   BIT(0)
#define WPA_CIPHER_SUITE_CCMP   RSN_SELECTOR(0x00, 0x50, 0xf2, 4)
#define WPA_CIPHER_SUITE_NONE   RSN_SELECTOR(0x00, 0x50, 0xf2, 0)
#define WPA_CIPHER_SUITE_TKIP   RSN_SELECTOR(0x00, 0x50, 0xf2, 2)
#define WPA_CIPHER_SUITE_WEP104   RSN_SELECTOR(0x00, 0x50, 0xf2, 5)
#define WPA_CIPHER_SUITE_WEP40   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)
#define WPA_GMK_LEN   32
#define WPA_GTK_MAX_LEN   32
#define WPA_KEY_INFO_ACK   BIT(7)
#define WPA_KEY_INFO_ENCR_KEY_DATA   BIT(12) /* IEEE 802.11i/RSN only */
#define WPA_KEY_INFO_ERROR   BIT(10)
#define WPA_KEY_INFO_INSTALL   BIT(6) /* pairwise */
#define WPA_KEY_INFO_KEY_INDEX_MASK   (BIT(4) | BIT(5))
#define WPA_KEY_INFO_KEY_INDEX_SHIFT   4
#define WPA_KEY_INFO_KEY_TYPE   BIT(3) /* 1 = Pairwise, 0 = Group key */
#define WPA_KEY_INFO_MIC   BIT(8)
#define WPA_KEY_INFO_REQUEST   BIT(11)
#define WPA_KEY_INFO_SECURE   BIT(9)
#define WPA_KEY_INFO_SMK_MESSAGE   BIT(13)
#define WPA_KEY_INFO_TXRX   BIT(6) /* group */
#define WPA_KEY_INFO_TYPE_AES_128_CMAC   3
#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4   BIT(0)
#define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES   BIT(1)
#define WPA_KEY_INFO_TYPE_MASK   ((u16) (BIT(0) | BIT(1) | BIT(2)))
#define WPA_KEY_RSC_LEN   8
#define WPA_MAX_SSID_LEN   32
#define WPA_NONCE_LEN   32
#define WPA_OUI_TYPE   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)
#define WPA_PMK_NAME_LEN   16
#define WPA_REPLAY_COUNTER_LEN   8
#define WPA_SELECTOR_LEN   4
#define WPA_VERSION   1

Functions

void rsn_pmkid (const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa, u8 *pmkid, int use_sha256)
const char * wpa_cipher_txt (int cipher)
int wpa_compare_rsn_ie (int ft_initial_assoc, const u8 *ie1, size_t ie1len, const u8 *ie2, size_t ie2len)
int wpa_eapol_key_mic (const u8 *key, int ver, const u8 *buf, size_t len, u8 *mic)
int wpa_insert_pmkid (u8 *ies, size_t ies_len, const u8 *pmkid)
const char * wpa_key_mgmt_txt (int key_mgmt, int proto)
int wpa_parse_wpa_ie_rsn (const u8 *rsn_ie, size_t rsn_ie_len, struct wpa_ie_data *data)
void wpa_pmk_to_ptk (const u8 *pmk, size_t pmk_len, const char *label, const u8 *addr1, const u8 *addr2, const u8 *nonce1, const u8 *nonce2, u8 *ptk, size_t ptk_len, int use_sha256)

Variables

struct wpa_eapol_key STRUCT_PACKED

Define Documentation

#define FT_R0KH_ID_MAX_LEN   48

Definition at line 123 of file wpa_common.h.

#define FT_R1KH_ID_LEN   6

Definition at line 124 of file wpa_common.h.

#define MOBILITY_DOMAIN_ID_LEN   2

Definition at line 122 of file wpa_common.h.

#define PMK_LEN   32

Definition at line 22 of file wpa_common.h.

#define PMKID_LEN   16

Definition at line 21 of file wpa_common.h.

#define RSN_AUTH_KEY_MGMT_802_1X_SHA256   RSN_SELECTOR(0x00, 0x0f, 0xac, 5)

Definition at line 57 of file wpa_common.h.

#define RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X   RSN_SELECTOR(0x00, 0x0f, 0xac, 2)

Definition at line 52 of file wpa_common.h.

#define RSN_AUTH_KEY_MGMT_PSK_SHA256   RSN_SELECTOR(0x00, 0x0f, 0xac, 6)

Definition at line 58 of file wpa_common.h.

#define RSN_AUTH_KEY_MGMT_UNSPEC_802_1X   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)

Definition at line 51 of file wpa_common.h.

#define RSN_CIPHER_SUITE_CCMP   RSN_SELECTOR(0x00, 0x0f, 0xac, 4)

Definition at line 66 of file wpa_common.h.

#define RSN_CIPHER_SUITE_NONE   RSN_SELECTOR(0x00, 0x0f, 0xac, 0)

Definition at line 60 of file wpa_common.h.

#define RSN_CIPHER_SUITE_TKIP   RSN_SELECTOR(0x00, 0x0f, 0xac, 2)

Definition at line 62 of file wpa_common.h.

#define RSN_CIPHER_SUITE_WEP104   RSN_SELECTOR(0x00, 0x0f, 0xac, 5)

Definition at line 67 of file wpa_common.h.

#define RSN_CIPHER_SUITE_WEP40   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)

Definition at line 61 of file wpa_common.h.

#define RSN_KEY_DATA_GROUPKEY   RSN_SELECTOR(0x00, 0x0f, 0xac, 1)

Definition at line 75 of file wpa_common.h.

#define RSN_KEY_DATA_MAC_ADDR   RSN_SELECTOR(0x00, 0x0f, 0xac, 3)

Definition at line 79 of file wpa_common.h.

#define RSN_KEY_DATA_PMKID   RSN_SELECTOR(0x00, 0x0f, 0xac, 4)

Definition at line 80 of file wpa_common.h.

#define RSN_NUM_REPLAY_COUNTERS_1   0

Definition at line 96 of file wpa_common.h.

Definition at line 99 of file wpa_common.h.

#define RSN_NUM_REPLAY_COUNTERS_2   1

Definition at line 97 of file wpa_common.h.

#define RSN_NUM_REPLAY_COUNTERS_4   2

Definition at line 98 of file wpa_common.h.

#define RSN_SELECTOR (   a,
  b,
  c,
  d 
)
Value:
((((u32) (a)) << 24) | (((u32) (b)) << 16) | (((u32) (c)) << 8) | \
         (u32) (d))

Definition at line 34 of file wpa_common.h.

#define RSN_SELECTOR_GET (   a)    WPA_GET_BE32((const u8 *) (a))

Definition at line 94 of file wpa_common.h.

#define RSN_SELECTOR_LEN   4

Definition at line 31 of file wpa_common.h.

#define RSN_SELECTOR_PUT (   a,
  val 
)    WPA_PUT_BE32((u8 *) (a), (val))

Definition at line 93 of file wpa_common.h.

#define RSN_VERSION   1

Definition at line 32 of file wpa_common.h.

#define WPA_AUTH_KEY_MGMT_NONE   RSN_SELECTOR(0x00, 0x50, 0xf2, 0)

Definition at line 38 of file wpa_common.h.

#define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X   RSN_SELECTOR(0x00, 0x50, 0xf2, 2)

Definition at line 40 of file wpa_common.h.

#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)

Definition at line 39 of file wpa_common.h.

#define WPA_CAPABILITY_MFPC   BIT(7)

Definition at line 117 of file wpa_common.h.

#define WPA_CAPABILITY_MFPR   BIT(6)

Definition at line 116 of file wpa_common.h.

#define WPA_CAPABILITY_NO_PAIRWISE   BIT(1)

Definition at line 113 of file wpa_common.h.

#define WPA_CAPABILITY_PEERKEY_ENABLED   BIT(9)

Definition at line 118 of file wpa_common.h.

#define WPA_CAPABILITY_PREAUTH   BIT(0)

Definition at line 112 of file wpa_common.h.

#define WPA_CIPHER_SUITE_CCMP   RSN_SELECTOR(0x00, 0x50, 0xf2, 4)

Definition at line 47 of file wpa_common.h.

#define WPA_CIPHER_SUITE_NONE   RSN_SELECTOR(0x00, 0x50, 0xf2, 0)

Definition at line 41 of file wpa_common.h.

#define WPA_CIPHER_SUITE_TKIP   RSN_SELECTOR(0x00, 0x50, 0xf2, 2)

Definition at line 43 of file wpa_common.h.

#define WPA_CIPHER_SUITE_WEP104   RSN_SELECTOR(0x00, 0x50, 0xf2, 5)

Definition at line 48 of file wpa_common.h.

#define WPA_CIPHER_SUITE_WEP40   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)

Definition at line 42 of file wpa_common.h.

#define WPA_GMK_LEN   32

Definition at line 26 of file wpa_common.h.

#define WPA_GTK_MAX_LEN   32

Definition at line 27 of file wpa_common.h.

#define WPA_KEY_INFO_ACK   BIT(7)

Definition at line 139 of file wpa_common.h.

#define WPA_KEY_INFO_ENCR_KEY_DATA   BIT(12) /* IEEE 802.11i/RSN only */

Definition at line 144 of file wpa_common.h.

#define WPA_KEY_INFO_ERROR   BIT(10)

Definition at line 142 of file wpa_common.h.

#define WPA_KEY_INFO_INSTALL   BIT(6) /* pairwise */

Definition at line 137 of file wpa_common.h.

#define WPA_KEY_INFO_KEY_INDEX_MASK   (BIT(4) | BIT(5))

Definition at line 135 of file wpa_common.h.

Definition at line 136 of file wpa_common.h.

#define WPA_KEY_INFO_KEY_TYPE   BIT(3) /* 1 = Pairwise, 0 = Group key */

Definition at line 133 of file wpa_common.h.

#define WPA_KEY_INFO_MIC   BIT(8)

Definition at line 140 of file wpa_common.h.

#define WPA_KEY_INFO_REQUEST   BIT(11)

Definition at line 143 of file wpa_common.h.

#define WPA_KEY_INFO_SECURE   BIT(9)

Definition at line 141 of file wpa_common.h.

#define WPA_KEY_INFO_SMK_MESSAGE   BIT(13)

Definition at line 145 of file wpa_common.h.

#define WPA_KEY_INFO_TXRX   BIT(6) /* group */

Definition at line 138 of file wpa_common.h.

Definition at line 132 of file wpa_common.h.

#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4   BIT(0)

Definition at line 130 of file wpa_common.h.

#define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES   BIT(1)

Definition at line 131 of file wpa_common.h.

#define WPA_KEY_INFO_TYPE_MASK   ((u16) (BIT(0) | BIT(1) | BIT(2)))

Definition at line 129 of file wpa_common.h.

#define WPA_KEY_RSC_LEN   8

Definition at line 25 of file wpa_common.h.

#define WPA_MAX_SSID_LEN   32

Definition at line 18 of file wpa_common.h.

#define WPA_NONCE_LEN   32

Definition at line 24 of file wpa_common.h.

#define WPA_OUI_TYPE   RSN_SELECTOR(0x00, 0x50, 0xf2, 1)

Definition at line 91 of file wpa_common.h.

#define WPA_PMK_NAME_LEN   16

Definition at line 125 of file wpa_common.h.

#define WPA_REPLAY_COUNTER_LEN   8

Definition at line 23 of file wpa_common.h.

#define WPA_SELECTOR_LEN   4

Definition at line 29 of file wpa_common.h.

#define WPA_VERSION   1

Definition at line 30 of file wpa_common.h.


Function Documentation

void rsn_pmkid ( const u8 *  pmk,
size_t  pmk_len,
const u8 *  aa,
const u8 *  spa,
u8 *  pmkid,
int  use_sha256 
)

rsn_pmkid - Calculate PMK identifier : Pairwise master key : Length of pmk in bytes : Authenticator address : Supplicant address : Buffer for PMKID : Whether to use SHA256-based KDF

IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy PMKID = HMAC-SHA1-128(PMK, "PMK Name" || AA || SPA)

Definition at line 585 of file wpa_common.c.

const char* wpa_cipher_txt ( int  cipher)

wpa_cipher_txt - Convert cipher suite to a text string : Cipher suite (WPA_CIPHER_* enum) Returns: Pointer to a text string of the cipher suite name

Definition at line 612 of file wpa_common.c.

int wpa_compare_rsn_ie ( int  ft_initial_assoc,
const u8 *  ie1,
size_t  ie1len,
const u8 *  ie2,
size_t  ie2len 
)

Definition at line 674 of file wpa_common.c.

int wpa_eapol_key_mic ( const u8 *  key,
int  ver,
const u8 *  buf,
size_t  len,
u8 *  mic 
)

wpa_eapol_key_mic - Calculate EAPOL-Key MIC : EAPOL-Key Key Confirmation Key (KCK) : Key descriptor version (WPA_KEY_INFO_TYPE_*) : Pointer to the beginning of the EAPOL header (version field) : Length of the EAPOL frame (from EAPOL header to the end of the frame) : Pointer to the buffer to which the EAPOL-Key MIC is written Returns: 0 on success, -1 on failure

Calculate EAPOL-Key MIC for an EAPOL-Key packet. The EAPOL-Key MIC field has to be cleared (all zeroes) when calling this function.

Note: 'IEEE Std 802.11i-2004 - 8.5.2 EAPOL-Key frames' has an error in the description of the Key MIC calculation. It includes packet data from the beginning of the EAPOL-Key header, not EAPOL header. This incorrect change happened during final editing of the standard and the correct behavior is defined in the last draft (IEEE 802.11i/D10).

Definition at line 46 of file wpa_common.c.

int wpa_insert_pmkid ( u8 *  ies,
size_t  ies_len,
const u8 *  pmkid 
)
const char* wpa_key_mgmt_txt ( int  key_mgmt,
int  proto 
)

wpa_key_mgmt_txt - Convert key management suite to a text string : Key management suite (WPA_KEY_MGMT_* enum) : WPA/WPA2 version (WPA_PROTO_*) Returns: Pointer to a text string of the key management suite name

Definition at line 639 of file wpa_common.c.

int wpa_parse_wpa_ie_rsn ( const u8 *  rsn_ie,
size_t  rsn_ie_len,
struct wpa_ie_data data 
)

wpa_parse_wpa_ie_rsn - Parse RSN IE : Buffer containing RSN IE : RSN IE buffer length (including IE number and length octets) : Pointer to structure that will be filled in with parsed data Returns: 0 on success, <0 on failure

Definition at line 243 of file wpa_common.c.

void wpa_pmk_to_ptk ( const u8 *  pmk,
size_t  pmk_len,
const char *  label,
const u8 *  addr1,
const u8 *  addr2,
const u8 *  nonce1,
const u8 *  nonce2,
u8 *  ptk,
size_t  ptk_len,
int  use_sha256 
)

wpa_pmk_to_ptk - Calculate PTK from PMK, addresses, and nonces : Pairwise master key : Length of PMK : Label to use in derivation : AA or SA : SA or AA : ANonce or SNonce : SNonce or ANonce : Buffer for pairwise transient key : Length of PTK : Whether to use SHA256-based KDF

IEEE Std 802.11i-2004 - 8.5.1.2 Pairwise key hierarchy PTK = PRF-X(PMK, "Pairwise key expansion", Min(AA, SA) || Max(AA, SA) || Min(ANonce, SNonce) || Max(ANonce, SNonce))

STK = PRF-X(SMK, "Peer key expansion", Min(MAC_I, MAC_P) || Max(MAC_I, MAC_P) || Min(INonce, PNonce) || Max(INonce, PNonce))

Definition at line 93 of file wpa_common.c.


Variable Documentation



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:43