b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 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 \ref 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 | \ref wpa_supplicant.c |
| 35 | Program initialization, main control loop |
| 36 | |
| 37 | \ref wpa_supplicant/main.c |
| 38 | main() for UNIX-like operating systems and MinGW (Windows); this |
| 39 | uses command line arguments to configure wpa_supplicant |
| 40 | |
| 41 | \ref events.c |
| 42 | Driver event processing; \ref wpa_supplicant_event() and related functions |
| 43 | |
| 44 | \ref 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 | \ref eloop.c and \ref eloop.h |
| 55 | Event loop (select() loop with registerable timeouts, socket read |
| 56 | callbacks, and signal callbacks) |
| 57 | |
| 58 | \ref common.c and \ref common.h |
| 59 | Common helper functions |
| 60 | |
| 61 | \ref defs.h |
| 62 | Definitions shared by multiple files |
| 63 | |
| 64 | \ref l2_packet.h, \ref l2_packet_linux.c, and \ref l2_packet_pcap.c |
| 65 | Layer 2 (link) access wrapper (includes Linux packet socket |
| 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. \ref l2_packet_linux.c uses Linux |
| 70 | packet sockets and \ref l2_packet_pcap.c has a more portable version using |
| 71 | libpcap and libdnet. |
| 72 | |
| 73 | \ref pcsc_funcs.c and \ref pcsc_funcs.h |
| 74 | Wrapper for PC/SC lite SIM and smart card readers |
| 75 | |
| 76 | \ref 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 | \ref version.h |
| 82 | Version number definitions |
| 83 | |
| 84 | |
| 85 | \section crypto_func Cryptographic functions |
| 86 | |
| 87 | \ref md5.c and \ref md5.h |
| 88 | MD5 (replaced with a crypto library if TLS support is included) |
| 89 | HMAC-MD5 (keyed checksum for message authenticity validation) |
| 90 | |
| 91 | \ref rc4.c and \ref rc4.h |
| 92 | RC4 (broadcast/default key encryption) |
| 93 | |
| 94 | \ref sha1.c and \ref sha1.h |
| 95 | SHA-1 (replaced with a crypto library if TLS support is included) |
| 96 | HMAC-SHA-1 (keyed checksum for message authenticity validation) |
| 97 | PRF-SHA-1 (pseudorandom (key/nonce generation) function) |
| 98 | PBKDF2-SHA-1 (ASCII passphrase to shared secret) |
| 99 | T-PRF (for EAP-FAST) |
| 100 | TLS-PRF (RFC 2246) |
| 101 | |
| 102 | \ref sha256.c and \ref sha256.h |
| 103 | SHA-256 (replaced with a crypto library if TLS support is included) |
| 104 | |
| 105 | \ref aes-wrap.c, \ref aes_wrap.h, \ref aes.c |
| 106 | AES (replaced with a crypto library if TLS support is included), |
| 107 | AES Key Wrap Algorithm with 128-bit KEK, RFC3394 (broadcast/default |
| 108 | key encryption), |
| 109 | One-Key CBC MAC (OMAC1) hash with AES-128, |
| 110 | AES-128 CTR mode encryption, |
| 111 | AES-128 EAX mode encryption/decryption, |
| 112 | AES-128 CBC |
| 113 | |
| 114 | \ref crypto.h |
| 115 | Definition of crypto library wrapper |
| 116 | |
| 117 | \ref crypto_openssl.c |
| 118 | Wrapper functions for libcrypto (OpenSSL) |
| 119 | |
| 120 | \ref crypto_internal.c |
| 121 | Wrapper functions for internal crypto implementation |
| 122 | |
| 123 | \ref crypto_gnutls.c |
| 124 | Wrapper functions for libgcrypt (used by GnuTLS) |
| 125 | |
| 126 | \ref ms_funcs.c and \ref ms_funcs.h |
| 127 | Helper functions for MSCHAPV2 and LEAP |
| 128 | |
| 129 | \ref tls.h |
| 130 | Definition of TLS library wrapper |
| 131 | |
| 132 | \ref tls_none.c |
| 133 | Stub implementation of TLS library wrapper for cases where TLS |
| 134 | functionality is not included. |
| 135 | |
| 136 | \ref tls_openssl.c |
| 137 | TLS library wrapper for openssl |
| 138 | |
| 139 | \ref tls_internal.c |
| 140 | TLS library for internal TLS implementation |
| 141 | |
| 142 | \ref tls_gnutls.c |
| 143 | TLS library wrapper for GnuTLS |
| 144 | |
| 145 | |
| 146 | \section tls_func TLS library |
| 147 | |
| 148 | \ref asn1.c and \ref asn1.h |
| 149 | ASN.1 DER parsing |
| 150 | |
| 151 | \ref bignum.c and \ref bignum.h |
| 152 | Big number math |
| 153 | |
| 154 | \ref rsa.c and \ref rsa.h |
| 155 | RSA |
| 156 | |
| 157 | \ref x509v3.c and \ref x509v3.h |
| 158 | X.509v3 certificate parsing and processing |
| 159 | |
| 160 | \ref tlsv1_client.c, \ref tlsv1_client.h |
| 161 | TLSv1 client (RFC 2246) |
| 162 | |
| 163 | \ref tlsv1_client_i.h |
| 164 | Internal structures for TLSv1 client |
| 165 | |
| 166 | \ref tlsv1_client_read.c |
| 167 | TLSv1 client: read handshake messages |
| 168 | |
| 169 | \ref tlsv1_client_write.c |
| 170 | TLSv1 client: write handshake messages |
| 171 | |
| 172 | \ref tlsv1_common.c and \ref tlsv1_common.h |
| 173 | Common TLSv1 routines and definitions |
| 174 | |
| 175 | \ref tlsv1_cred.c and \ref tlsv1_cred.h |
| 176 | TLSv1 credentials |
| 177 | |
| 178 | \ref tlsv1_record.c and \ref tlsv1_record.h |
| 179 | TLSv1 record protocol |
| 180 | |
| 181 | |
| 182 | \section configuration Configuration |
| 183 | |
| 184 | \ref config_ssid.h |
| 185 | Definition of per network configuration items |
| 186 | |
| 187 | \ref config.h |
| 188 | Definition of the wpa_supplicant configuration |
| 189 | |
| 190 | \ref config.c |
| 191 | Configuration parser and common functions |
| 192 | |
| 193 | \ref wpa_supplicant/config_file.c |
| 194 | Configuration backend for text files (e.g., wpa_supplicant.conf) |
| 195 | |
| 196 | \ref config_winreg.c |
| 197 | Configuration backend for Windows registry |
| 198 | |
| 199 | |
| 200 | \section ctrl_iface Control interface |
| 201 | |
| 202 | wpa_supplicant has a \ref ctrl_iface_page "control interface" |
| 203 | that can be used to get status |
| 204 | information and manage operations from external programs. An example |
| 205 | command line interface (wpa_cli) and GUI (wpa_gui) for this interface |
| 206 | are included in the wpa_supplicant distribution. |
| 207 | |
| 208 | \ref wpa_supplicant/ctrl_iface.c and \ref wpa_supplicant/ctrl_iface.h |
| 209 | wpa_supplicant-side of the control interface |
| 210 | |
| 211 | \ref ctrl_iface_unix.c |
| 212 | UNIX domain sockets -based control interface backend |
| 213 | |
| 214 | \ref ctrl_iface_udp.c |
| 215 | UDP sockets -based control interface backend |
| 216 | |
| 217 | \ref ctrl_iface_named_pipe.c |
| 218 | Windows named pipes -based control interface backend |
| 219 | |
| 220 | \ref wpa_ctrl.c and \ref wpa_ctrl.h |
| 221 | Library functions for external programs to provide access to the |
| 222 | wpa_supplicant control interface |
| 223 | |
| 224 | \ref wpa_cli.c |
| 225 | Example program for using wpa_supplicant control interface |
| 226 | |
| 227 | |
| 228 | \section wpa_code WPA supplicant |
| 229 | |
| 230 | \ref wpa.c and \ref wpa.h |
| 231 | WPA state machine and 4-Way/Group Key Handshake processing |
| 232 | |
| 233 | \ref preauth.c and \ref preauth.h |
| 234 | PMKSA caching and pre-authentication (RSN/WPA2) |
| 235 | |
| 236 | \ref wpa_i.h |
| 237 | Internal definitions for WPA code; not to be included to other modules. |
| 238 | |
| 239 | \section eap_peer EAP peer |
| 240 | |
| 241 | \ref eap_peer_module "EAP peer implementation" is a separate module that |
| 242 | can be used by other programs than just wpa_supplicant. |
| 243 | |
| 244 | \ref eap.c and \ref eap.h |
| 245 | EAP state machine and method interface |
| 246 | |
| 247 | \ref eap_defs.h |
| 248 | Common EAP definitions |
| 249 | |
| 250 | \ref eap_i.h |
| 251 | Internal definitions for EAP state machine and EAP methods; not to be |
| 252 | included in other modules |
| 253 | |
| 254 | \ref eap_sim_common.c and \ref eap_sim_common.h |
| 255 | Common code for EAP-SIM and EAP-AKA |
| 256 | |
| 257 | \ref eap_tls_common.c and \ref eap_tls_common.h |
| 258 | Common code for EAP-PEAP, EAP-TTLS, and EAP-FAST |
| 259 | |
| 260 | \ref eap_ttls.c and \ref eap_ttls.h |
| 261 | EAP-TTLS |
| 262 | |
| 263 | \ref eap_pax.c, \ref eap_pax_common.h, \ref eap_pax_common.c |
| 264 | EAP-PAX |
| 265 | |
| 266 | \ref eap_psk.c, \ref eap_psk_common.h, \ref eap_psk_common.c |
| 267 | EAP-PSK (note: this is not needed for WPA-PSK) |
| 268 | |
| 269 | \ref eap_sake.c, \ref eap_sake_common.h, \ref eap_sake_common.c |
| 270 | EAP-SAKE |
| 271 | |
| 272 | \ref eap_gpsk.c, \ref eap_gpsk_common.h, \ref eap_gpsk_common.c |
| 273 | EAP-GPSK |
| 274 | |
| 275 | \ref eap_aka.c, \ref eap_fast.c, \ref eap_gtc.c, \ref eap_leap.c, |
| 276 | \ref eap_md5.c, \ref eap_mschapv2.c, \ref eap_otp.c, \ref eap_peap.c, |
| 277 | \ref eap_sim.c, \ref eap_tls.c |
| 278 | Other EAP method implementations |
| 279 | |
| 280 | |
| 281 | \section eapol_supp EAPOL supplicant |
| 282 | |
| 283 | \ref eapol_supp_sm.c and \ref eapol_supp_sm.h |
| 284 | EAPOL supplicant state machine and IEEE 802.1X processing |
| 285 | |
| 286 | |
| 287 | \section win_port Windows port |
| 288 | |
| 289 | \ref ndis_events.c |
| 290 | Code for receiving NdisMIndicateStatus() events and delivering them to |
| 291 | wpa_supplicant \ref driver_ndis.c in more easier to use form |
| 292 | |
| 293 | \ref win_if_list.c |
| 294 | External program for listing current network interface |
| 295 | |
| 296 | |
| 297 | \section test_programs Test programs |
| 298 | |
| 299 | \ref radius_client.c and \ref radius_client.h |
| 300 | RADIUS authentication client implementation for eapol_test |
| 301 | |
| 302 | \ref radius.c and \ref radius.h |
| 303 | RADIUS message processing for eapol_test |
| 304 | |
| 305 | \ref eapol_test.c |
| 306 | Standalone EAP testing tool with integrated RADIUS authentication |
| 307 | client |
| 308 | |
| 309 | \ref preauth_test.c |
| 310 | Standalone RSN pre-authentication tool |
| 311 | |
| 312 | \ref wpa_passphrase.c |
| 313 | WPA ASCII passphrase to PSK conversion |
| 314 | |
| 315 | */ |