preauth.c File Reference

WPA Supplicant - RSN pre-authentication and PMKSA caching. More...

#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <string.h>
#include <time.h>
#include "common.h"
#include "sha1.h"
#include "wpa.h"
#include "driver.h"
#include "eloop.h"
#include "wpa_supplicant.h"
#include "config.h"
#include "l2_packet.h"
#include "eapol_sm.h"
#include "preauth.h"
#include "wpa_i.h"

Include dependency graph for preauth.c:

Go to the source code of this file.

Defines

#define PMKID_CANDIDATE_PRIO_SCAN   1000

Functions

rsn_pmksa_cachepmksa_cache_add (struct wpa_sm *sm, const u8 *pmk, size_t pmk_len, const u8 *aa, const u8 *spa, struct wpa_ssid *ssid)
 Add a PMKSA cache entry.
void pmksa_cache_free (struct wpa_sm *sm)
 Free all entries in PMKSA cache.
rsn_pmksa_cachepmksa_cache_get (struct wpa_sm *sm, const u8 *aa, const u8 *pmkid)
 Fetch a PMKSA cache entry.
void pmksa_cache_notify_reconfig (struct wpa_sm *sm)
 Reconfiguration notification for PMKSA cache.
rsn_pmksa_cachepmksa_cache_get_current (struct wpa_sm *sm)
 Get the current used PMKSA entry.
void pmksa_cache_clear_current (struct wpa_sm *sm)
 Clear the current PMKSA entry selection.
int pmksa_cache_set_current (struct wpa_sm *sm, const u8 *pmkid, const u8 *bssid, struct wpa_ssid *ssid, int try_opportunistic)
 Set the current PMKSA entry selection.
int pmksa_cache_list (struct wpa_sm *sm, char *buf, size_t len)
 Dump text list of entries in PMKSA cache.
void pmksa_candidate_free (struct wpa_sm *sm)
 Free all entries in PMKSA candidate list.
int rsn_preauth_init (struct wpa_sm *sm, const u8 *dst, struct wpa_ssid *config)
 Start new RSN pre-authentication.
void rsn_preauth_deinit (struct wpa_sm *sm)
 Abort RSN pre-authentication.
void rsn_preauth_candidate_process (struct wpa_sm *sm)
 Process PMKSA candidates.
void pmksa_candidate_add (struct wpa_sm *sm, const u8 *bssid, int prio, int preauth)
 Add a new PMKSA candidate.
void rsn_preauth_scan_results (struct wpa_sm *sm, struct wpa_scan_result *results, int count)
 Process scan results to find PMKSA candidates.
int rsn_preauth_get_status (struct wpa_sm *sm, char *buf, size_t buflen, int verbose)
 Get pre-authentication status.
int rsn_preauth_in_progress (struct wpa_sm *sm)
 Verify whether pre-authentication is in progress.


Detailed Description

WPA Supplicant - RSN pre-authentication and PMKSA caching.

Copyright
Copyright (c) 2003-2006, Jouni Malinen <[email protected]>
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 preauth.c.


Function Documentation

struct rsn_pmksa_cache* pmksa_cache_add struct wpa_sm sm,
const u8 *  pmk,
size_t  pmk_len,
const u8 *  aa,
const u8 *  spa,
struct wpa_ssid ssid
 

Add a PMKSA cache entry.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
pmk The new pairwise master key
pmk_len PMK length in bytes, usually PMK_LEN (32)
aa Authenticator address
spa Supplicant address
ssid The network configuration for which this PMK is being added
Returns:
Pointer to the added PMKSA cache entry or NULL on error
This function create a PMKSA entry for a new PMK and adds it to the PMKSA cache. If an old entry is already in the cache for the same Authenticator, this entry will be replaced with the new entry. PMKID will be calculated based on the PMK and the driver interface is notified of the new PMKID.

Definition at line 177 of file preauth.c.

Here is the call graph for this function:

void pmksa_cache_clear_current struct wpa_sm sm  ) 
 

Clear the current PMKSA entry selection.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()

Definition at line 404 of file preauth.c.

void pmksa_cache_free struct wpa_sm sm  ) 
 

Free all entries in PMKSA cache.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()

Definition at line 271 of file preauth.c.

struct rsn_pmksa_cache* pmksa_cache_get struct wpa_sm sm,
const u8 *  aa,
const u8 *  pmkid
 

Fetch a PMKSA cache entry.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
aa Authenticator address or NULL to match any
pmkid PMKID or NULL to match any
Returns:
Pointer to PMKSA cache entry or NULL if no match was found

Definition at line 298 of file preauth.c.

struct rsn_pmksa_cache* pmksa_cache_get_current struct wpa_sm sm  ) 
 

Get the current used PMKSA entry.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
Returns:
Pointer to the current PMKSA cache entry or NULL if not available

Definition at line 391 of file preauth.c.

int pmksa_cache_list struct wpa_sm sm,
char *  buf,
size_t  len
 

Dump text list of entries in PMKSA cache.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
buf Buffer for the list
len Length of the buffer
Returns:
number of bytes written to buffer
This function is used to generate a text format representation of the current PMKSA cache contents for the ctrl_iface PMKSA command.

Definition at line 453 of file preauth.c.

void pmksa_cache_notify_reconfig struct wpa_sm sm  ) 
 

Reconfiguration notification for PMKSA cache.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
Clear references to old data structures when wpa_supplicant is reconfigured.

Definition at line 320 of file preauth.c.

int pmksa_cache_set_current struct wpa_sm sm,
const u8 *  pmkid,
const u8 *  bssid,
struct wpa_ssid ssid,
int  try_opportunistic
 

Set the current PMKSA entry selection.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
pmkid PMKID for selecting PMKSA or NULL if not used
bssid BSSID for PMKSA or NULL if not used
ssid The network configuration for the current network
try_opportunistic Whether to allow opportunistic PMKSA caching
Returns:
0 if PMKSA was found or -1 if no matching entry was found

Definition at line 422 of file preauth.c.

Here is the call graph for this function:

void pmksa_candidate_add struct wpa_sm sm,
const u8 *  bssid,
int  prio,
int  preauth
 

Add a new PMKSA candidate.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
bssid BSSID (authenticator address) of the candidate
prio Priority (the smaller number, the higher priority)
preauth Whether the candidate AP advertises support for pre-authentication
This function is used to add PMKSA candidates for RSN pre-authentication. It is called from scan result processing and from driver events for PMKSA candidates, i.e., EVENT_PMKID_CANDIDATE events to wpa_supplicant_event().

Definition at line 787 of file preauth.c.

Here is the call graph for this function:

void pmksa_candidate_free struct wpa_sm sm  ) 
 

Free all entries in PMKSA candidate list.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()

Definition at line 487 of file preauth.c.

void rsn_preauth_candidate_process struct wpa_sm sm  ) 
 

Process PMKSA candidates.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
Go through the PMKSA candidates and start pre-authentication if a candidate without an existing PMKSA cache entry is found. Processed candidates will be removed from the list.

Definition at line 723 of file preauth.c.

Here is the call graph for this function:

void rsn_preauth_deinit struct wpa_sm sm  ) 
 

Abort RSN pre-authentication.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
This function aborts the current RSN pre-authentication (if one is started) and frees resources allocated for it.

Definition at line 699 of file preauth.c.

Here is the call graph for this function:

int rsn_preauth_get_status struct wpa_sm sm,
char *  buf,
size_t  buflen,
int  verbose
 

Get pre-authentication status.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
buf Buffer for status information
buflen Maximum buffer length
verbose Whether to include verbose status information
Returns:
Number of bytes written to buf.
Query WPA2 pre-authentication 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.

Definition at line 924 of file preauth.c.

Here is the call graph for this function:

int rsn_preauth_in_progress struct wpa_sm sm  ) 
 

Verify whether pre-authentication is in progress.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()

Definition at line 948 of file preauth.c.

int rsn_preauth_init struct wpa_sm sm,
const u8 *  dst,
struct wpa_ssid config
 

Start new RSN pre-authentication.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
dst Authenticator address (BSSID) with which to preauthenticate
config Current network configuration
Returns:
0 on success, -1 on another pre-authentication is in progress, -2 on layer 2 packet initialization failure, -3 on EAPOL state machine initialization failure, -4 on memory allocation failure
This function request an RSN pre-authentication with a given destination address. This is usually called for PMKSA candidates found from scan results or from driver reports. In addition, ctrl_iface PREAUTH command can trigger pre-authentication.

Definition at line 620 of file preauth.c.

Here is the call graph for this function:

void rsn_preauth_scan_results struct wpa_sm sm,
struct wpa_scan_result results,
int  count
 

Process scan results to find PMKSA candidates.

Parameters:
sm Pointer to WPA state machine data from wpa_sm_init()
results Scan results
count Number of BSSes in scan results
This functions goes through the scan results and adds all suitable APs (Authenticators) into PMKSA candidate list.

Definition at line 863 of file preauth.c.

Here is the call graph for this function:


Generated on Sat May 6 21:18:26 2006 for wpa_supplicant by  doxygen 1.4.2