#include <gpxe/net80211.h>
#include <gpxe/sha1.h>
#include <gpxe/wpa.h>
#include <errno.h>
Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | wpa_psk_init (struct net80211_device *dev) |
| Initialise WPA-PSK state. | |
| static int | wpa_psk_start (struct net80211_device *dev) |
| Start WPA-PSK authentication. | |
| static int | wpa_psk_step (struct net80211_device *dev) |
| Step WPA-PSK authentication. | |
| static int | wpa_psk_no_change_key (struct net80211_device *dev __unused) |
| Do-nothing function; you can't change a WPA key post-authentication. | |
| static void | wpa_psk_stop (struct net80211_device *dev) |
| Disable handling of received WPA authentication frames. | |
Variables | |
| struct net80211_handshaker wpa_psk_handshaker | __net80211_handshaker |
| WPA-PSK security handshaker. | |
Definition in file wpa_psk.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int wpa_psk_init | ( | struct net80211_device * | dev | ) | [static] |
Initialise WPA-PSK state.
| dev | 802.11 device |
| rc | Return status code |
Definition at line 37 of file wpa_psk.c.
References net80211_device::rsn_ie, and wpa_make_rsn_ie().
00038 { 00039 return wpa_make_rsn_ie ( dev, &dev->rsn_ie ); 00040 }
| static int wpa_psk_start | ( | struct net80211_device * | dev | ) | [static] |
Start WPA-PSK authentication.
| dev | 802.11 device |
| rc | Return status code |
Definition at line 48 of file wpa_psk.c.
References DBGC, DBGC_HD, EACCES, net80211_device::essid, fetch_string_setting(), net80211_device::handshaker, net80211_deauthenticate(), net80211_device::netdev, netdev_settings(), pbkdf2_sha1(), net80211_handshaker::priv, strlen(), u8, WPA_PMK_LEN, and wpa_start().
00049 { 00050 char passphrase[64+1]; 00051 u8 pmk[WPA_PMK_LEN]; 00052 int len; 00053 struct wpa_common_ctx *ctx = dev->handshaker->priv; 00054 00055 len = fetch_string_setting ( netdev_settings ( dev->netdev ), 00056 &net80211_key_setting, passphrase, 00057 64 + 1 ); 00058 00059 if ( len <= 0 ) { 00060 DBGC ( ctx, "WPA-PSK %p: no passphrase provided!\n", ctx ); 00061 net80211_deauthenticate ( dev, -EACCES ); 00062 return -EACCES; 00063 } 00064 00065 pbkdf2_sha1 ( passphrase, len, dev->essid, strlen ( dev->essid ), 00066 4096, pmk, WPA_PMK_LEN ); 00067 00068 DBGC ( ctx, "WPA-PSK %p: derived PMK from passphrase `%s':\n", ctx, 00069 passphrase ); 00070 DBGC_HD ( ctx, pmk, WPA_PMK_LEN ); 00071 00072 return wpa_start ( dev, ctx, pmk, WPA_PMK_LEN ); 00073 }
| static int wpa_psk_step | ( | struct net80211_device * | dev | ) | [static] |
Step WPA-PSK authentication.
| dev | 802.11 device |
| rc | Return status code |
Definition at line 81 of file wpa_psk.c.
References EACCES, net80211_device::handshaker, net80211_handshaker::priv, wpa_common_ctx::state, WPA_FAILURE, and WPA_SUCCESS.
00082 { 00083 struct wpa_common_ctx *ctx = dev->handshaker->priv; 00084 00085 switch ( ctx->state ) { 00086 case WPA_SUCCESS: 00087 return 1; 00088 case WPA_FAILURE: 00089 return -EACCES; 00090 default: 00091 return 0; 00092 } 00093 }
| static int wpa_psk_no_change_key | ( | struct net80211_device *dev | __unused | ) | [static] |
| static void wpa_psk_stop | ( | struct net80211_device * | dev | ) | [static] |
Disable handling of received WPA authentication frames.
| dev | 802.11 device |
Definition at line 111 of file wpa_psk.c.
References wpa_stop().
00112 { 00113 wpa_stop ( dev ); 00114 }
| struct net80211_handshaker wpa_psk_handshaker __net80211_handshaker |
Initial value:
{
.protocol = NET80211_SECPROT_PSK,
.init = wpa_psk_init,
.start = wpa_psk_start,
.step = wpa_psk_step,
.change_key = wpa_psk_no_change_key,
.stop = wpa_psk_stop,
.priv_len = sizeof ( struct wpa_common_ctx ),
}
1.5.7.1