eap.doxygen 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. \page eap_peer_module EAP peer implementation
  3. Extensible Authentication Protocol (EAP) is an authentication framework
  4. defined in RFC 3748. wpa_supplicant uses a separate code module for EAP
  5. peer implementation. This module was designed to use only a minimal set
  6. of direct function calls (mainly, to debug/event functions) in order for
  7. it to be usable in other programs. The design of the EAP
  8. implementation is based loosely on RFC 4137. The state machine is
  9. defined in this RFC and so is the interface between the peer state
  10. machine and methods. As such, this RFC provides useful information for
  11. understanding the EAP peer implementation in wpa_supplicant.
  12. Some of the terminology used in EAP state machine is referring to
  13. EAPOL (IEEE 802.1X), but there is no strict requirement on the lower
  14. layer being IEEE 802.1X if EAP module is built for other programs than
  15. wpa_supplicant. These terms should be understood to refer to the
  16. lower layer as defined in RFC 4137.
  17. \section adding_eap_methods Adding EAP methods
  18. Each EAP method is implemented as a separate module, usually as one C
  19. file named eap_<name of the method>.c, e.g., \ref eap_md5.c. All EAP
  20. methods use the same interface between the peer state machine and
  21. method specific functions. This allows new EAP methods to be added
  22. without modifying the core EAP state machine implementation.
  23. New EAP methods need to be registered by adding them into the build
  24. (Makefile) and the EAP method registration list in the
  25. \ref eap_peer_register_methods() function of \ref eap_methods.c. Each EAP
  26. method should use a build-time configuration option, e.g., EAP_TLS, in
  27. order to make it possible to select which of the methods are included
  28. in the build.
  29. EAP methods must implement the interface defined in \ref eap_i.h. struct
  30. \ref eap_method defines the needed function pointers that each EAP method
  31. must provide. In addition, the EAP type and name are registered using
  32. this structure. This interface is based on section 4.4 of RFC 4137.
  33. It is recommended that the EAP methods would use generic helper
  34. functions, \ref eap_msg_alloc() and \ref eap_hdr_validate() when processing
  35. messages. This allows code sharing and can avoid missing some of the
  36. needed validation steps for received packets. In addition, these
  37. functions make it easier to change between expanded and legacy EAP
  38. header, if needed.
  39. When adding an EAP method that uses a vendor specific EAP type
  40. (Expanded Type as defined in RFC 3748, Chapter 5.7), the new method
  41. must be registered by passing vendor id instead of EAP_VENDOR_IETF to
  42. \ref eap_peer_method_alloc(). These methods must not try to emulate
  43. expanded types by registering a legacy EAP method for type 254. See
  44. \ref eap_vendor_test.c for an example of an EAP method implementation that
  45. is implemented as an expanded type.
  46. \section used_eap_library Using EAP implementation as a library
  47. The Git repository has an eap_example directory that contains an
  48. example showing how EAP peer and server code from wpa_supplicant and
  49. hostapd can be used as a library. The example program initializes both
  50. an EAP server and an EAP peer entities and then runs through an
  51. EAP-PEAP/MSCHAPv2 authentication.
  52. \ref eap_example_peer.c shows the initialization and glue code needed to
  53. control the EAP peer implementation. \ref eap_example_server.c does the
  54. same for EAP server. \ref eap_example.c is an example that ties in both the
  55. EAP server and client parts to allow an EAP authentication to be
  56. shown.
  57. In this example, the EAP messages are passed between the server and
  58. the peer are passed by direct function calls within the same process.
  59. In practice, server and peer functionalities would likely reside in
  60. separate devices and the EAP messages would be transmitted between the
  61. devices based on an external protocol. For example, in IEEE 802.11
  62. uses IEEE 802.1X EAPOL state machines to control the transmission of
  63. EAP messages and WiMax supports optional PMK EAP authentication
  64. mechanism that transmits EAP messages as defined in IEEE 802.16e.
  65. The EAP library links in number of helper functions from \ref src/utils and
  66. \ref src/crypto directories. Most of these are suitable as-is, but it may
  67. be desirable to replace the debug output code in \ref src/utils/wpa_debug.c
  68. by dropping this file from the library and re-implementing the
  69. functions there in a way that better fits in with the main
  70. application.
  71. */