WPA/RSN - Shared functions for supplicant and authenticator. More...
#include "includes.h"
#include "common.h"
#include "md5.h"
#include "sha1.h"
#include "sha256.h"
#include "aes_wrap.h"
#include "crypto.h"
#include "ieee802_11_defs.h"
#include "defs.h"
#include "wpa_common.h"
Go to the source code of this file.
Functions | |
int | wpa_eapol_key_mic (const u8 *key, int ver, const u8 *buf, size_t len, u8 *mic) |
Calculate EAPOL-Key MIC. | |
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) |
Calculate PTK from PMK, addresses, and nonces. | |
int | wpa_parse_wpa_ie_rsn (const u8 *rsn_ie, size_t rsn_ie_len, struct wpa_ie_data *data) |
Parse RSN IE. | |
void | rsn_pmkid (const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa, u8 *pmkid, int use_sha256) |
Calculate PMK identifier. | |
const char * | wpa_cipher_txt (int cipher) |
Convert cipher suite to a text string. | |
const char * | wpa_key_mgmt_txt (int key_mgmt, int proto) |
Convert key management suite to a text string. |
WPA/RSN - Shared functions for supplicant and authenticator.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
Definition in file wpa_common.c.
void rsn_pmkid | ( | const u8 * | pmk, | |
size_t | pmk_len, | |||
const u8 * | aa, | |||
const u8 * | spa, | |||
u8 * | pmkid, | |||
int | use_sha256 | |||
) |
Calculate PMK identifier.
pmk | Pairwise master key | |
pmk_len | Length of pmk in bytes | |
aa | Authenticator address | |
spa | Supplicant address | |
pmkid | Buffer for PMKID | |
use_sha256 | 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 594 of file wpa_common.c.
const char* wpa_cipher_txt | ( | int | cipher | ) |
Convert cipher suite to a text string.
cipher | Cipher suite (WPA_CIPHER_* enum) |
Definition at line 622 of file wpa_common.c.
int wpa_eapol_key_mic | ( | const u8 * | key, | |
int | ver, | |||
const u8 * | buf, | |||
size_t | len, | |||
u8 * | mic | |||
) |
Calculate EAPOL-Key MIC.
key | EAPOL-Key Key Confirmation Key (KCK) | |
ver | Key descriptor version (WPA_KEY_INFO_TYPE_*) | |
buf | Pointer to the beginning of the EAPOL header (version field) | |
len | Length of the EAPOL frame (from EAPOL header to the end of the frame) | |
mic | Pointer to the buffer to which the EAPOL-Key MIC is written |
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 48 of file wpa_common.c.
const char* wpa_key_mgmt_txt | ( | int | key_mgmt, | |
int | proto | |||
) |
Convert key management suite to a text string.
key_mgmt | Key management suite (WPA_KEY_MGMT_* enum) | |
proto | WPA/WPA2 version (WPA_PROTO_*) |
Definition at line 650 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 | |||
) |
Parse RSN IE.
rsn_ie | Buffer containing RSN IE | |
rsn_ie_len | RSN IE buffer length (including IE number and length octets) | |
data | Pointer to structure that will be filled in with parsed data |
Definition at line 247 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 | |||
) |
Calculate PTK from PMK, addresses, and nonces.
pmk | Pairwise master key | |
pmk_len | Length of PMK | |
label | Label to use in derivation | |
addr1 | AA or SA | |
addr2 | SA or AA | |
nonce1 | ANonce or SNonce | |
nonce2 | SNonce or ANonce | |
ptk | Buffer for pairwise transient key | |
ptk_len | Length of PTK | |
use_sha256 | 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 96 of file wpa_common.c.