Merge branch 'moonshot' of ssh://moonshot.suchdamage.org:822/srv/git/libeap into...
[libeap.git] / doc / code_structure.doxygen
1 /**
2 \page code_structure Structure of the source code
3
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" ]
15
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.
22
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.
26
27 \ref driver_wrapper "Driver interface API" is defined in driver.h and
28 all hardware/driver dependent functionality is implemented in
29 driver_*.c.
30
31
32 \section wpa_supplicant_core wpa_supplicant core functionality
33
34 wpa_supplicant.c
35         Program initialization, main control loop
36
37 main.c
38         main() for UNIX-like operating systems and MinGW (Windows); this
39         uses command line arguments to configure wpa_supplicant
40
41 events.c
42         Driver event processing; wpa_supplicant_event() and related functions
43
44 wpa_supplicant_i.h
45         Internal definitions for %wpa_supplicant core; should not be
46         included into independent modules
47
48
49 \section generic_helper_func Generic helper functions
50
51 %wpa_supplicant uses generic helper functions some of which are shared
52 with with hostapd. The following C files are currently used:
53
54 eloop.c and eloop.h
55         Event loop (select() loop with registerable timeouts, socket read
56         callbacks, and signal callbacks)
57
58 common.c and common.h
59         Common helper functions
60
61 defs.h
62         Definitions shared by multiple files
63
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
71         libpcap and libdnet.
72
73 pcsc_funcs.c and pcsc_funcs.h
74         Wrapper for PC/SC lite SIM and smart card readers
75
76 priv_netlink.h
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
80
81 version.h
82         Version number definitions
83
84 wireless_copy.h
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
88
89
90 \section crypto_func Cryptographic functions
91
92 md5.c and md5.h
93         MD5 (replaced with a crypto library if TLS support is included)
94         HMAC-MD5 (keyed checksum for message authenticity validation)
95
96 rc4.c and rc4.h
97         RC4 (broadcast/default key encryption)
98
99 sha1.c and sha1.h
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)
104         T-PRF (for EAP-FAST)
105         TLS-PRF (RFC 2246)
106
107 sha256.c and sha256.h
108         SHA-256 (replaced with a crypto library if TLS support is included)
109
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
113         key encryption),
114         One-Key CBC MAC (OMAC1) hash with AES-128,
115         AES-128 CTR mode encryption,
116         AES-128 EAX mode encryption/decryption,
117         AES-128 CBC
118
119 crypto.h
120         Definition of crypto library wrapper
121
122 crypto_openssl.c
123         Wrapper functions for libcrypto (OpenSSL)
124
125 crypto_internal.c
126         Wrapper functions for internal crypto implementation
127
128 crypto_gnutls.c
129         Wrapper functions for libgcrypt (used by GnuTLS)
130
131 ms_funcs.c and ms_funcs.h
132         Helper functions for MSCHAPV2 and LEAP
133
134 tls.h
135         Definition of TLS library wrapper
136
137 tls_none.c
138         Dummy implementation of TLS library wrapper for cases where TLS
139         functionality is not included.
140
141 tls_openssl.c
142         TLS library wrapper for openssl
143
144 tls_internal.c
145         TLS library for internal TLS implementation
146
147 tls_gnutls.c
148         TLS library wrapper for GnuTLS
149
150
151 \section tls_func TLS library
152
153 asn1.c and asn1.h
154         ASN.1 DER parsing
155
156 bignum.c and bignum.h
157         Big number math
158
159 rsa.c and rsa.h
160         RSA
161
162 x509v3.c and x509v3.h
163         X.509v3 certificate parsing and processing
164
165 tlsv1_client.c, tlsv1_client.h
166         TLSv1 client (RFC 2246)
167
168 tlsv1_client_i.h
169         Internal structures for TLSv1 client
170
171 tlsv1_client_read.c
172         TLSv1 client: read handshake messages
173
174 tlsv1_client_write.c
175         TLSv1 client: write handshake messages
176
177 tlsv1_common.c and tlsv1_common.h
178         Common TLSv1 routines and definitions
179
180 tlsv1_cred.c and tlsv1_cred.h
181         TLSv1 credentials
182
183 tlsv1_record.c and tlsv1_record.h
184         TLSv1 record protocol
185
186
187 \section configuration Configuration
188
189 config_ssid.h
190         Definition of per network configuration items
191
192 config.h
193         Definition of the %wpa_supplicant configuration
194
195 config.c
196         Configuration parser and common functions
197
198 config_file.c
199         Configuration backend for text files (e.g., wpa_supplicant.conf)
200
201 config_winreg.c
202         Configuration backend for Windows registry
203
204
205 \section ctrl_iface Control interface
206
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.
212
213 ctrl_iface.c and ctrl_iface.h
214         %wpa_supplicant-side of the control interface
215
216 ctrl_iface_unix.c
217         UNIX domain sockets -based control interface backend
218
219 ctrl_iface_udp.c
220         UDP sockets -based control interface backend
221
222 ctrl_iface_named_pipe.c
223         Windows named pipes -based control interface backend
224
225 wpa_ctrl.c and wpa_ctrl.h
226         Library functions for external programs to provide access to the
227         %wpa_supplicant control interface
228
229 wpa_cli.c
230         Example program for using %wpa_supplicant control interface
231
232
233 \section wpa_code WPA supplicant
234
235 wpa.c and wpa.h
236         WPA state machine and 4-Way/Group Key Handshake processing
237
238 preauth.c and preauth.h
239         PMKSA caching and pre-authentication (RSN/WPA2)
240
241 wpa_i.h
242         Internal definitions for WPA code; not to be included to other modules.
243
244 \section eap_peer EAP peer
245
246 \ref eap_peer_module "EAP peer implementation" is a separate module that
247 can be used by other programs than just %wpa_supplicant.
248
249 eap.c and eap.h
250         EAP state machine and method interface
251
252 eap_defs.h
253         Common EAP definitions
254
255 eap_i.h
256         Internal definitions for EAP state machine and EAP methods; not to be
257         included in other modules
258
259 eap_sim_common.c and eap_sim_common.h
260         Common code for EAP-SIM and EAP-AKA
261
262 eap_tls_common.c and eap_tls_common.h
263         Common code for EAP-PEAP, EAP-TTLS, and EAP-FAST
264
265 eap_tlv.c and eap_tlv.h
266         EAP-TLV code for EAP-PEAP and EAP-FAST
267
268 eap_ttls.c and eap_ttls.h
269         EAP-TTLS
270
271 eap_pax.c, eap_pax_common.h, eap_pax_common.c
272         EAP-PAX
273
274 eap_psk.c, eap_psk_common.h, eap_psk_common.c
275         EAP-PSK (note: this is not needed for WPA-PSK)
276
277 eap_sake.c, eap_sake_common.h, eap_sake_common.c
278         EAP-SAKE
279
280 eap_gpsk.c, eap_gpsk_common.h, eap_gpsk_common.c
281         EAP-GPSK
282
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
286
287
288 \section eapol_supp EAPOL supplicant
289
290 eapol_supp_sm.c and eapol_supp_sm.h
291         EAPOL supplicant state machine and IEEE 802.1X processing
292
293
294 \section win_port Windows port
295
296 ndis_events.c
297         Code for receiving NdisMIndicateStatus() events and delivering them to
298         %wpa_supplicant driver_ndis.c in more easier to use form
299
300 win_if_list.c
301         External program for listing current network interface
302
303
304 \section test_programs Test programs
305
306 radius_client.c and radius_client.h
307         RADIUS authentication client implementation for eapol_test
308
309 radius.c and radius.h
310         RADIUS message processing for eapol_test
311
312 eapol_test.c
313         Standalone EAP testing tool with integrated RADIUS authentication
314         client
315
316 preauth_test.c
317         Standalone RSN pre-authentication tool
318
319 wpa_passphrase.c
320         WPA ASCII passphrase to PSK conversion
321
322 */