2 \page code_structure Structure of the source code
4 [ \ref wpa_supplicant_core "wpa_supplicant core functionality" |
5 \ref generic_helper_func "Generic helper functions" |
6 \ref crypto_func "Cryptographic functions" |
7 \ref tls_func "TLS library" |
8 \ref configuration "Configuration" |
9 \ref ctrl_iface "Control interface" |
10 \ref wpa_code "WPA supplicant" |
11 \ref eap_peer "EAP peer" |
12 \ref eapol_supp "EAPOL supplicant" |
13 \ref win_port "Windows port" |
14 \ref test_programs "Test programs" ]
16 %wpa_supplicant implementation is divided into number of independent
17 modules. Core code includes functionality for controlling the network
18 selection, association, and configuration. Independent modules include
19 WPA code (key handshake, PMKSA caching, pre-authentication), EAPOL
20 state machine, and EAP state machine and methods. In addition, there
21 are number of separate files for generic helper functions.
23 Both WPA and EAPOL/EAP state machines can be used separately in other
24 programs than %wpa_supplicant. As an example, the included test
25 programs eapol_test and preauth_test are using these modules.
27 \ref driver_wrapper "Driver interface API" is defined in driver.h and
28 all hardware/driver dependent functionality is implemented in
32 \section wpa_supplicant_core wpa_supplicant core functionality
35 Program initialization, main control loop
38 main() for UNIX-like operating systems and MinGW (Windows); this
39 uses command line arguments to configure wpa_supplicant
42 Driver event processing; wpa_supplicant_event() and related functions
45 Internal definitions for %wpa_supplicant core; should not be
46 included into independent modules
49 \section generic_helper_func Generic helper functions
51 %wpa_supplicant uses generic helper functions some of which are shared
52 with with hostapd. The following C files are currently used:
55 Event loop (select() loop with registerable timeouts, socket read
56 callbacks, and signal callbacks)
59 Common helper functions
62 Definitions shared by multiple files
64 l2_packet.h, l2_packet_linux.c, and l2_packet_pcap.c
65 Layer 2 (link) access wrapper (includes native Linux implementation
66 and wrappers for libdnet/libpcap). A new l2_packet implementation
67 may need to be added when porting to new operating systems that are
68 not supported by libdnet/libpcap. Makefile can be used to select which
69 l2_packet implementation is included. l2_packet_linux.c uses Linux
70 packet sockets and l2_packet_pcap.c has a more portable version using
73 pcsc_funcs.c and pcsc_funcs.h
74 Wrapper for PC/SC lite SIM and smart card readers
77 Private version of netlink definitions from Linux kernel header files;
78 this could be replaced with C library header file once suitable
79 version becomes commonly available
82 Version number definitions
85 Private version of Linux wireless extensions definitions from kernel
86 header files; this could be replaced with C library header file once
87 suitable version becomes commonly available
90 \section crypto_func Cryptographic functions
93 MD5 (replaced with a crypto library if TLS support is included)
94 HMAC-MD5 (keyed checksum for message authenticity validation)
97 RC4 (broadcast/default key encryption)
100 SHA-1 (replaced with a crypto library if TLS support is included)
101 HMAC-SHA-1 (keyed checksum for message authenticity validation)
102 PRF-SHA-1 (pseudorandom (key/nonce generation) function)
103 PBKDF2-SHA-1 (ASCII passphrase to shared secret)
107 sha256.c and sha256.h
108 SHA-256 (replaced with a crypto library if TLS support is included)
110 aes_wrap.c, aes_wrap.h, aes.c
111 AES (replaced with a crypto library if TLS support is included),
112 AES Key Wrap Algorithm with 128-bit KEK, RFC3394 (broadcast/default
114 One-Key CBC MAC (OMAC1) hash with AES-128,
115 AES-128 CTR mode encryption,
116 AES-128 EAX mode encryption/decryption,
120 Definition of crypto library wrapper
123 Wrapper functions for libcrypto (OpenSSL)
126 Wrapper functions for internal crypto implementation
129 Wrapper functions for libgcrypt (used by GnuTLS)
131 ms_funcs.c and ms_funcs.h
132 Helper functions for MSCHAPV2 and LEAP
135 Definition of TLS library wrapper
138 Dummy implementation of TLS library wrapper for cases where TLS
139 functionality is not included.
142 TLS library wrapper for openssl
145 TLS library for internal TLS implementation
148 TLS library wrapper for GnuTLS
151 \section crypto_func Cryptographic functions
156 bignum.c and bignum.h
162 x509v3.c and x509v3.h
163 X.509v3 certificate parsing and processing
165 tlsv1_client.c, tlsv1_client.h
166 TLSv1 client (RFC 2246)
169 Internal structures for TLSv1 client
172 TLSv1 client: read handshake messages
175 TLSv1 client: write handshake messages
177 tlsv1_common.c and tlsv1_common.h
178 Common TLSv1 routines and definitions
180 tlsv1_cred.c and tlsv1_cred.h
183 tlsv1_record.c and tlsv1_record.h
184 TLSv1 record protocol
187 \section configuration Configuration
190 Definition of per network configuration items
193 Definition of the %wpa_supplicant configuration
196 Configuration parser and common functions
199 Configuration backend for text files (e.g., wpa_supplicant.conf)
202 Configuration backend for Windows registry
205 \section ctrl_iface Control interface
207 %wpa_supplicant has a \ref ctrl_iface_page "control interface"
208 that can be used to get status
209 information and manage operations from external programs. An example
210 command line interface (wpa_cli) and GUI (wpa_gui) for this interface
211 are included in the %wpa_supplicant distribution.
213 ctrl_iface.c and ctrl_iface.h
214 %wpa_supplicant-side of the control interface
217 UNIX domain sockets -based control interface backend
220 UDP sockets -based control interface backend
222 ctrl_iface_named_pipe.c
223 Windows named pipes -based control interface backend
225 wpa_ctrl.c and wpa_ctrl.h
226 Library functions for external programs to provide access to the
227 %wpa_supplicant control interface
230 Example program for using %wpa_supplicant control interface
233 \section wpa_code WPA supplicant
236 WPA state machine and 4-Way/Group Key Handshake processing
238 preauth.c and preauth.h
239 PMKSA caching and pre-authentication (RSN/WPA2)
242 Internal definitions for WPA code; not to be included to other modules.
244 \section eap_peer EAP peer
246 \ref eap_module "EAP peer implementation" is a separate module that
247 can be used by other programs than just %wpa_supplicant.
250 EAP state machine and method interface
253 Common EAP definitions
256 Internal definitions for EAP state machine and EAP methods; not to be
257 included in other modules
259 eap_sim_common.c and eap_sim_common.h
260 Common code for EAP-SIM and EAP-AKA
262 eap_tls_common.c and eap_tls_common.h
263 Common code for EAP-PEAP, EAP-TTLS, and EAP-FAST
265 eap_tlv.c and eap_tlv.h
266 EAP-TLV code for EAP-PEAP and EAP-FAST
268 eap_ttls.c and eap_ttls.h
271 eap_pax.c, eap_pax_common.h, eap_pax_common.c
274 eap_psk.c, eap_psk_common.h, eap_psk_common.c
275 EAP-PSK (note: this is not needed for WPA-PSK)
277 eap_sake.c, eap_sake_common.h, eap_sake_common.c
280 eap_gpsk.c, eap_gpsk_common.h, eap_gpsk_common.c
283 eap_aka.c, eap_fast.c, eap_gtc.c, eap_leap.c, eap_md5.c, eap_mschapv2.c,
284 eap_otp.c, eap_peap.c, eap_sim.c, eap_tls.c
285 Other EAP method implementations
288 \section eapol_supp EAPOL supplicant
290 eapol_supp_sm.c and eapol_supp_sm.h
291 EAPOL supplicant state machine and IEEE 802.1X processing
294 \section win_port Windows port
297 Code for receiving NdisMIndicateStatus() events and delivering them to
298 %wpa_supplicant driver_ndis.c in more easier to use form
301 External program for listing current network interface
304 \section test_programs Test programs
306 radius_client.c and radius_client.h
307 RADIUS authentication client implementation for eapol_test
309 radius.c and radius.h
310 RADIUS message processing for eapol_test
313 Standalone EAP testing tool with integrated RADIUS authentication
317 Standalone RSN pre-authentication tool
320 WPA ASCII passphrase to PSK conversion