#include "includes.h"
#include "common.h"
#include "crypto/aes_wrap.h"
#include "crypto/crypto.h"
#include "common/ieee802_11_defs.h"
#include "eapol_supp/eapol_supp_sm.h"
#include "wpa.h"
#include "eloop.h"
#include "preauth.h"
#include "pmksa_cache.h"
#include "wpa_i.h"
#include "wpa_ie.h"
Go to the source code of this file.
Classes | |
struct | wpa_gtk_data |
Functions | |
static int | ieee80211w_set_keys (struct wpa_sm *sm, struct wpa_eapol_ie_parse *ie) |
static int | wpa_derive_ptk (struct wpa_sm *sm, const unsigned char *src_addr, const struct wpa_eapol_key *key, struct wpa_ptk *ptk) |
static void | wpa_eapol_key_dump (const struct wpa_eapol_key *key) |
void | wpa_eapol_key_send (struct wpa_sm *sm, const u8 *kck, int ver, const u8 *dest, u16 proto, u8 *msg, size_t msg_len, u8 *key_mic) |
static void | wpa_report_ie_mismatch (struct wpa_sm *sm, const char *reason, const u8 *src_addr, const u8 *wpa_ie, size_t wpa_ie_len, const u8 *rsn_ie, size_t rsn_ie_len) |
void | wpa_sm_aborted_cached (struct wpa_sm *sm) |
void | wpa_sm_deinit (struct wpa_sm *sm) |
void | wpa_sm_drop_sa (struct wpa_sm *sm) |
unsigned int | wpa_sm_get_param (struct wpa_sm *sm, enum wpa_sm_conf_params param) |
int | wpa_sm_get_status (struct wpa_sm *sm, char *buf, size_t buflen, int verbose) |
int | wpa_sm_has_ptk (struct wpa_sm *sm) |
struct wpa_sm * | wpa_sm_init (struct wpa_sm_ctx *ctx) |
void | wpa_sm_key_request (struct wpa_sm *sm, int error, int pairwise) |
void | wpa_sm_notify_assoc (struct wpa_sm *sm, const u8 *bssid) |
void | wpa_sm_notify_disassoc (struct wpa_sm *sm) |
int | wpa_sm_parse_own_wpa_ie (struct wpa_sm *sm, struct wpa_ie_data *data) |
int | wpa_sm_pmksa_cache_list (struct wpa_sm *sm, char *buf, size_t len) |
static void | wpa_sm_pmksa_free_cb (struct rsn_pmksa_cache_entry *entry, void *ctx, int replace) |
static void | wpa_sm_rekey_ptk (void *eloop_ctx, void *timeout_ctx) |
int | wpa_sm_rx_eapol (struct wpa_sm *sm, const u8 *src_addr, const u8 *buf, size_t len) |
int | wpa_sm_set_ap_rsn_ie (struct wpa_sm *sm, const u8 *ie, size_t len) |
int | wpa_sm_set_ap_wpa_ie (struct wpa_sm *sm, const u8 *ie, size_t len) |
int | wpa_sm_set_assoc_wpa_ie (struct wpa_sm *sm, const u8 *ie, size_t len) |
int | wpa_sm_set_assoc_wpa_ie_default (struct wpa_sm *sm, u8 *wpa_ie, size_t *wpa_ie_len) |
void | wpa_sm_set_config (struct wpa_sm *sm, struct rsn_supp_config *config) |
void | wpa_sm_set_eapol (struct wpa_sm *sm, struct eapol_sm *eapol) |
void | wpa_sm_set_fast_reauth (struct wpa_sm *sm, int fast_reauth) |
void | wpa_sm_set_ifname (struct wpa_sm *sm, const char *ifname, const char *bridge_ifname) |
void | wpa_sm_set_own_addr (struct wpa_sm *sm, const u8 *addr) |
int | wpa_sm_set_param (struct wpa_sm *sm, enum wpa_sm_conf_params param, unsigned int value) |
void | wpa_sm_set_pmk (struct wpa_sm *sm, const u8 *pmk, size_t pmk_len) |
void | wpa_sm_set_pmk_from_pmksa (struct wpa_sm *sm) |
void | wpa_sm_set_scard_ctx (struct wpa_sm *sm, void *scard_ctx) |
static void | wpa_sm_start_preauth (void *eloop_ctx, void *timeout_ctx) |
static int | wpa_supplicant_check_group_cipher (int group_cipher, int keylen, int maxkeylen, int *key_rsc_len, enum wpa_alg *alg) |
static int | wpa_supplicant_decrypt_key_data (struct wpa_sm *sm, struct wpa_eapol_key *key, u16 ver) |
static int | wpa_supplicant_get_pmk (struct wpa_sm *sm, const unsigned char *src_addr, const u8 *pmkid) |
static int | wpa_supplicant_gtk_tx_bit_workaround (const struct wpa_sm *sm, int tx) |
static int | wpa_supplicant_install_gtk (struct wpa_sm *sm, const struct wpa_gtk_data *gd, const u8 *key_rsc) |
static int | wpa_supplicant_install_ptk (struct wpa_sm *sm, const struct wpa_eapol_key *key) |
static void | wpa_supplicant_key_neg_complete (struct wpa_sm *sm, const u8 *addr, int secure) |
static int | wpa_supplicant_pairwise_gtk (struct wpa_sm *sm, const struct wpa_eapol_key *key, const u8 *gtk, size_t gtk_len, int key_info) |
static void | wpa_supplicant_process_1_of_2 (struct wpa_sm *sm, const unsigned char *src_addr, const struct wpa_eapol_key *key, int extra_len, u16 ver) |
static int | wpa_supplicant_process_1_of_2_rsn (struct wpa_sm *sm, const u8 *keydata, size_t keydatalen, u16 key_info, struct wpa_gtk_data *gd) |
static int | wpa_supplicant_process_1_of_2_wpa (struct wpa_sm *sm, const struct wpa_eapol_key *key, size_t keydatalen, int key_info, size_t extra_len, u16 ver, struct wpa_gtk_data *gd) |
static void | wpa_supplicant_process_1_of_4 (struct wpa_sm *sm, const unsigned char *src_addr, const struct wpa_eapol_key *key, u16 ver) |
static void | wpa_supplicant_process_3_of_4 (struct wpa_sm *sm, const struct wpa_eapol_key *key, u16 ver) |
static int | wpa_supplicant_send_2_of_2 (struct wpa_sm *sm, const struct wpa_eapol_key *key, int ver, u16 key_info) |
int | wpa_supplicant_send_2_of_4 (struct wpa_sm *sm, const unsigned char *dst, const struct wpa_eapol_key *key, int ver, const u8 *nonce, const u8 *wpa_ie, size_t wpa_ie_len, struct wpa_ptk *ptk) |
int | wpa_supplicant_send_4_of_4 (struct wpa_sm *sm, const unsigned char *dst, const struct wpa_eapol_key *key, u16 ver, u16 key_info, const u8 *kde, size_t kde_len, struct wpa_ptk *ptk) |
static int | wpa_supplicant_validate_ie (struct wpa_sm *sm, const unsigned char *src_addr, struct wpa_eapol_ie_parse *ie) |
static int | wpa_supplicant_verify_eapol_key_mic (struct wpa_sm *sm, struct wpa_eapol_key *key, u16 ver, const u8 *buf, size_t len) |
static int ieee80211w_set_keys | ( | struct wpa_sm * | sm, | |
struct wpa_eapol_ie_parse * | ie | |||
) | [static] |
static int wpa_derive_ptk | ( | struct wpa_sm * | sm, | |
const unsigned char * | src_addr, | |||
const struct wpa_eapol_key * | key, | |||
struct wpa_ptk * | ptk | |||
) | [static] |
static void wpa_eapol_key_dump | ( | const struct wpa_eapol_key * | key | ) | [static] |
void wpa_eapol_key_send | ( | struct wpa_sm * | sm, | |
const u8 * | kck, | |||
int | ver, | |||
const u8 * | dest, | |||
u16 | proto, | |||
u8 * | msg, | |||
size_t | msg_len, | |||
u8 * | key_mic | |||
) |
wpa_eapol_key_send - Send WPA/RSN EAPOL-Key message : Pointer to WPA state machine data from wpa_sm_init() : Key Confirmation Key (KCK, part of PTK) : Version field from Key Info : Destination address for the frame : Ethertype (usually ETH_P_EAPOL) : EAPOL-Key message : Length of message : Pointer to the buffer to which the EAPOL-Key MIC is written
void wpa_sm_aborted_cached | ( | struct wpa_sm * | sm | ) |
wpa_sm_aborted_cached - Notify WPA that PMKSA caching was aborted : Pointer to WPA state machine data from wpa_sm_init()
void wpa_sm_deinit | ( | struct wpa_sm * | sm | ) |
wpa_sm_deinit - Deinitialize WPA state machine : Pointer to WPA state machine data from wpa_sm_init()
unsigned int wpa_sm_get_param | ( | struct wpa_sm * | sm, | |
enum wpa_sm_conf_params | param | |||
) |
wpa_sm_get_param - Get WPA state machine parameters : Pointer to WPA state machine data from wpa_sm_init()
Parameter field Returns: Parameter value |
int wpa_sm_get_status | ( | struct wpa_sm * | sm, | |
char * | buf, | |||
size_t | buflen, | |||
int | verbose | |||
) |
wpa_sm_get_status - Get WPA state machine : Pointer to WPA state machine data from wpa_sm_init() : Buffer for status information : Maximum buffer length : Whether to include verbose status information Returns: Number of bytes written to buf.
Query WPA state machine for status information. This function fills in a text area with current status information. If the buffer (buf) is not large enough, status information will be truncated to fit the buffer.
struct wpa_sm* wpa_sm_init | ( | struct wpa_sm_ctx * | ctx | ) | [read] |
wpa_sm_init - Initialize WPA state machine : Context pointer for callbacks; this needs to be an allocated buffer Returns: Pointer to the allocated WPA state machine data
This function is used to allocate a new WPA state machine and the returned value is passed to all WPA state machine calls.
void wpa_sm_key_request | ( | struct wpa_sm * | sm, | |
int | error, | |||
int | pairwise | |||
) |
wpa_sm_key_request - Send EAPOL-Key Request : Pointer to WPA state machine data from wpa_sm_init() : Indicate whether this is an Michael MIC error report : 1 = error report for pairwise packet, 0 = for group packet
Send an EAPOL-Key Request to the current authenticator. This function is used to request rekeying and it is usually called when a local Michael MIC failure is detected.
wpa_sm_notify_assoc - Notify WPA state machine about association : Pointer to WPA state machine data from wpa_sm_init() : The BSSID of the new association
This function is called to let WPA state machine know that the connection was established.
void wpa_sm_notify_disassoc | ( | struct wpa_sm * | sm | ) |
wpa_sm_notify_disassoc - Notify WPA state machine about disassociation : Pointer to WPA state machine data from wpa_sm_init()
This function is called to let WPA state machine know that the connection was lost. This will abort any existing pre-authentication session.
int wpa_sm_parse_own_wpa_ie | ( | struct wpa_sm * | sm, | |
struct wpa_ie_data * | data | |||
) |
wpa_sm_parse_own_wpa_ie - Parse own WPA/RSN IE : Pointer to WPA state machine data from wpa_sm_init() : Pointer to data area for parsing results Returns: 0 on success, -1 if IE is not known, or -2 on parsing failure
Parse the contents of the own WPA or RSN IE from (Re)AssocReq and write the parsed data into data.
int wpa_sm_pmksa_cache_list | ( | struct wpa_sm * | sm, | |
char * | buf, | |||
size_t | len | |||
) |
static void wpa_sm_pmksa_free_cb | ( | struct rsn_pmksa_cache_entry * | entry, | |
void * | ctx, | |||
int | replace | |||
) | [static] |
static void wpa_sm_rekey_ptk | ( | void * | eloop_ctx, | |
void * | timeout_ctx | |||
) | [static] |
wpa_sm_rx_eapol - Process received WPA EAPOL frames : Pointer to WPA state machine data from wpa_sm_init() : Source MAC address of the EAPOL packet : Pointer to the beginning of the EAPOL data (EAPOL header) : Length of the EAPOL frame Returns: 1 = WPA EAPOL-Key processed, 0 = not a WPA EAPOL-Key, -1 failure
This function is called for each received EAPOL frame. Other than EAPOL-Key frames can be skipped if filtering is done elsewhere. wpa_sm_rx_eapol() is only processing WPA and WPA2 EAPOL-Key frames.
The received EAPOL-Key packets are validated and valid packets are replied to. In addition, key material (PTK, GTK) is configured at the end of a successful key handshake.
wpa_sm_set_ap_rsn_ie - Set AP RSN IE from Beacon/ProbeResp : Pointer to WPA state machine data from wpa_sm_init() : Pointer to IE data (starting from id) : IE length Returns: 0 on success, -1 on failure
Inform WPA state machine about the RSN IE used in Beacon / Probe Response frame.
wpa_sm_set_ap_wpa_ie - Set AP WPA IE from Beacon/ProbeResp : Pointer to WPA state machine data from wpa_sm_init() : Pointer to IE data (starting from id) : IE length Returns: 0 on success, -1 on failure
Inform WPA state machine about the WPA IE used in Beacon / Probe Response frame.
wpa_sm_set_assoc_wpa_ie - Set own WPA/RSN IE from (Re)AssocReq : Pointer to WPA state machine data from wpa_sm_init() : Pointer to IE data (starting from id) : IE length Returns: 0 on success, -1 on failure
Inform WPA state machine about the WPA/RSN IE used in (Re)Association Request frame. The IE will be used to override the default value generated with wpa_sm_set_assoc_wpa_ie_default().
wpa_sm_set_assoc_wpa_ie_default - Generate own WPA/RSN IE from configuration : Pointer to WPA state machine data from wpa_sm_init() : Pointer to buffer for WPA/RSN IE : Pointer to the length of the wpa_ie buffer Returns: 0 on success, -1 on failure
void wpa_sm_set_config | ( | struct wpa_sm * | sm, | |
struct rsn_supp_config * | config | |||
) |
wpa_sm_set_config - Notification of current configration change : Pointer to WPA state machine data from wpa_sm_init() : Pointer to current network configuration
Notify WPA state machine that configuration has changed. config will be stored as a backpointer to network configuration. This can be NULL to clear the stored pointed.
wpa_sm_set_eapol - Set EAPOL state machine pointer : Pointer to WPA state machine data from wpa_sm_init() : Pointer to EAPOL state machine allocated with eapol_sm_init()
void wpa_sm_set_fast_reauth | ( | struct wpa_sm * | sm, | |
int | fast_reauth | |||
) |
wpa_sm_set_fast_reauth - Set fast reauthentication (EAP) enabled/disabled : Pointer to WPA state machine data from wpa_sm_init() : Whether fast reauthentication (EAP) is allowed
void wpa_sm_set_ifname | ( | struct wpa_sm * | sm, | |
const char * | ifname, | |||
const char * | bridge_ifname | |||
) |
wpa_sm_set_ifname - Set network interface name : Pointer to WPA state machine data from wpa_sm_init() : Interface name : Optional bridge interface name (for pre-auth)
wpa_sm_set_own_addr - Set own MAC address : Pointer to WPA state machine data from wpa_sm_init() : Own MAC address
int wpa_sm_set_param | ( | struct wpa_sm * | sm, | |
enum wpa_sm_conf_params | param, | |||
unsigned int | value | |||
) |
wpa_sm_set_param - Set WPA state machine parameters : Pointer to WPA state machine data from wpa_sm_init()
Parameter field : Parameter value Returns: 0 on success, -1 on failure |
wpa_sm_set_pmk - Set PMK : Pointer to WPA state machine data from wpa_sm_init() : The new PMK : The length of the new PMK in bytes
Configure the PMK for WPA state machine.
void wpa_sm_set_pmk_from_pmksa | ( | struct wpa_sm * | sm | ) |
wpa_sm_set_pmk_from_pmksa - Set PMK based on the current PMKSA : Pointer to WPA state machine data from wpa_sm_init()
Take the PMK from the current PMKSA into use. If no PMKSA is active, the PMK will be cleared.
void wpa_sm_set_scard_ctx | ( | struct wpa_sm * | sm, | |
void * | scard_ctx | |||
) |
wpa_sm_set_scard_ctx - Set context pointer for smartcard callbacks : Pointer to WPA state machine data from wpa_sm_init() : Context pointer for smartcard related callback functions
static void wpa_sm_start_preauth | ( | void * | eloop_ctx, | |
void * | timeout_ctx | |||
) | [static] |
static int wpa_supplicant_check_group_cipher | ( | int | group_cipher, | |
int | keylen, | |||
int | maxkeylen, | |||
int * | key_rsc_len, | |||
enum wpa_alg * | alg | |||
) | [static] |
static int wpa_supplicant_decrypt_key_data | ( | struct wpa_sm * | sm, | |
struct wpa_eapol_key * | key, | |||
u16 | ver | |||
) | [static] |
static int wpa_supplicant_gtk_tx_bit_workaround | ( | const struct wpa_sm * | sm, | |
int | tx | |||
) | [static] |
static int wpa_supplicant_install_gtk | ( | struct wpa_sm * | sm, | |
const struct wpa_gtk_data * | gd, | |||
const u8 * | key_rsc | |||
) | [static] |
static int wpa_supplicant_install_ptk | ( | struct wpa_sm * | sm, | |
const struct wpa_eapol_key * | key | |||
) | [static] |
static int wpa_supplicant_pairwise_gtk | ( | struct wpa_sm * | sm, | |
const struct wpa_eapol_key * | key, | |||
const u8 * | gtk, | |||
size_t | gtk_len, | |||
int | key_info | |||
) | [static] |
static void wpa_supplicant_process_1_of_2 | ( | struct wpa_sm * | sm, | |
const unsigned char * | src_addr, | |||
const struct wpa_eapol_key * | key, | |||
int | extra_len, | |||
u16 | ver | |||
) | [static] |
static int wpa_supplicant_process_1_of_2_rsn | ( | struct wpa_sm * | sm, | |
const u8 * | keydata, | |||
size_t | keydatalen, | |||
u16 | key_info, | |||
struct wpa_gtk_data * | gd | |||
) | [static] |
static int wpa_supplicant_process_1_of_2_wpa | ( | struct wpa_sm * | sm, | |
const struct wpa_eapol_key * | key, | |||
size_t | keydatalen, | |||
int | key_info, | |||
size_t | extra_len, | |||
u16 | ver, | |||
struct wpa_gtk_data * | gd | |||
) | [static] |
static void wpa_supplicant_process_1_of_4 | ( | struct wpa_sm * | sm, | |
const unsigned char * | src_addr, | |||
const struct wpa_eapol_key * | key, | |||
u16 | ver | |||
) | [static] |
static void wpa_supplicant_process_3_of_4 | ( | struct wpa_sm * | sm, | |
const struct wpa_eapol_key * | key, | |||
u16 | ver | |||
) | [static] |
static int wpa_supplicant_send_2_of_2 | ( | struct wpa_sm * | sm, | |
const struct wpa_eapol_key * | key, | |||
int | ver, | |||
u16 | key_info | |||
) | [static] |
int wpa_supplicant_send_2_of_4 | ( | struct wpa_sm * | sm, | |
const unsigned char * | dst, | |||
const struct wpa_eapol_key * | key, | |||
int | ver, | |||
const u8 * | nonce, | |||
const u8 * | wpa_ie, | |||
size_t | wpa_ie_len, | |||
struct wpa_ptk * | ptk | |||
) |
wpa_supplicant_send_2_of_4 - Send message 2 of WPA/RSN 4-Way Handshake : Pointer to WPA state machine data from wpa_sm_init() : Destination address for the frame : Pointer to the EAPOL-Key frame header : Version bits from EAPOL-Key Key Info : Nonce value for the EAPOL-Key frame : WPA/RSN IE : Length of the WPA/RSN IE : PTK to use for keyed hash and encryption Returns: 0 on success, -1 on failure
int wpa_supplicant_send_4_of_4 | ( | struct wpa_sm * | sm, | |
const unsigned char * | dst, | |||
const struct wpa_eapol_key * | key, | |||
u16 | ver, | |||
u16 | key_info, | |||
const u8 * | kde, | |||
size_t | kde_len, | |||
struct wpa_ptk * | ptk | |||
) |
wpa_supplicant_send_4_of_4 - Send message 4 of WPA/RSN 4-Way Handshake : Pointer to WPA state machine data from wpa_sm_init() : Destination address for the frame : Pointer to the EAPOL-Key frame header : Version bits from EAPOL-Key Key Info : Key Info : KDEs to include the EAPOL-Key frame : Length of KDEs : PTK to use for keyed hash and encryption Returns: 0 on success, -1 on failure
static int wpa_supplicant_validate_ie | ( | struct wpa_sm * | sm, | |
const unsigned char * | src_addr, | |||
struct wpa_eapol_ie_parse * | ie | |||
) | [static] |