Go to the source code of this file.
Classes | |
struct | eap_ssl_data |
Defines | |
#define | EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80 |
#define | EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40 |
#define | EAP_TLS_FLAGS_START 0x20 |
#define | EAP_TLS_KEY_LEN 64 |
#define | EAP_TLS_VERSION_MASK 0x07 |
Functions | |
int | eap_peer_select_phase2_methods (struct eap_peer_config *config, const char *prefix, struct eap_method_type **types, size_t *num_types) |
struct wpabuf * | eap_peer_tls_build_ack (u8 id, EapType eap_type, int peap_version) |
int | eap_peer_tls_decrypt (struct eap_sm *sm, struct eap_ssl_data *data, const struct wpabuf *in_data, struct wpabuf **in_decrypted) |
u8 * | eap_peer_tls_derive_key (struct eap_sm *sm, struct eap_ssl_data *data, const char *label, size_t len) |
int | eap_peer_tls_encrypt (struct eap_sm *sm, struct eap_ssl_data *data, EapType eap_type, int peap_version, u8 id, const struct wpabuf *in_data, struct wpabuf **out_data) |
int | eap_peer_tls_phase2_nak (struct eap_method_type *types, size_t num_types, struct eap_hdr *hdr, struct wpabuf **resp) |
int | eap_peer_tls_process_helper (struct eap_sm *sm, struct eap_ssl_data *data, EapType eap_type, int peap_version, u8 id, const u8 *in_data, size_t in_len, struct wpabuf **out_data) |
const u8 * | eap_peer_tls_process_init (struct eap_sm *sm, struct eap_ssl_data *data, EapType eap_type, struct eap_method_ret *ret, const struct wpabuf *reqData, size_t *len, u8 *flags) |
int | eap_peer_tls_reauth_init (struct eap_sm *sm, struct eap_ssl_data *data) |
void | eap_peer_tls_reset_input (struct eap_ssl_data *data) |
void | eap_peer_tls_reset_output (struct eap_ssl_data *data) |
void | eap_peer_tls_ssl_deinit (struct eap_sm *sm, struct eap_ssl_data *data) |
int | eap_peer_tls_ssl_init (struct eap_sm *sm, struct eap_ssl_data *data, struct eap_peer_config *config) |
int | eap_peer_tls_status (struct eap_sm *sm, struct eap_ssl_data *data, char *buf, size_t buflen, int verbose) |
#define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80 |
Definition at line 81 of file eap_peer/eap_tls_common.h.
#define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40 |
Definition at line 82 of file eap_peer/eap_tls_common.h.
#define EAP_TLS_FLAGS_START 0x20 |
Definition at line 83 of file eap_peer/eap_tls_common.h.
#define EAP_TLS_KEY_LEN 64 |
Definition at line 87 of file eap_peer/eap_tls_common.h.
#define EAP_TLS_VERSION_MASK 0x07 |
Definition at line 84 of file eap_peer/eap_tls_common.h.
int eap_peer_select_phase2_methods | ( | struct eap_peer_config * | config, | |
const char * | prefix, | |||
struct eap_method_type ** | types, | |||
size_t * | num_types | |||
) |
eap_peer_select_phase2_methods - Select phase 2 EAP method : Pointer to the network configuration : 'phase2' configuration prefix, e.g., "auth=" : Buffer for returning allocated list of allowed EAP methods : Buffer for returning number of allocated EAP methods Returns: 0 on success, -1 on failure
This function is used to parse EAP method list and select allowed methods for Phase2 authentication.
Definition at line 913 of file eap_tls_common.c.
eap_peer_tls_build_ack - Build a TLS ACK frame : EAP identifier for the response : EAP type (EAP_TYPE_TLS, EAP_TYPE_PEAP, ...) : Version number for EAP-PEAP/TTLS Returns: Pointer to the allocated ACK frame or NULL on failure
Definition at line 658 of file eap_tls_common.c.
int eap_peer_tls_decrypt | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
const struct wpabuf * | in_data, | |||
struct wpabuf ** | in_decrypted | |||
) |
eap_peer_tls_decrypt - Decrypt received phase 2 TLS message : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : Message received from the server : Buffer for returning a pointer to the decrypted message Returns: 0 on success, 1 if more input data is needed, or -1 on failure
Definition at line 847 of file eap_tls_common.c.
u8* eap_peer_tls_derive_key | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
const char * | label, | |||
size_t | len | |||
) |
eap_peer_tls_derive_key - Derive a key based on TLS session data : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : Label string for deriving the keys, e.g., "client EAP encryption" : Length of the key material to generate (usually 64 for MSK) Returns: Pointer to allocated key on success or NULL on failure
This function uses TLS-PRF to generate pseudo-random data based on the TLS session data (client/server random and master key). Each key type may use a different label to bind the key usage into the generated material.
The caller is responsible for freeing the returned buffer.
Definition at line 264 of file eap_tls_common.c.
int eap_peer_tls_encrypt | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
EapType | eap_type, | |||
int | peap_version, | |||
u8 | id, | |||
const struct wpabuf * | in_data, | |||
struct wpabuf ** | out_data | |||
) |
eap_peer_tls_encrypt - Encrypt phase 2 TLS message : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : EAP type (EAP_TYPE_TLS, EAP_TYPE_PEAP, ...) : Version number for EAP-PEAP/TTLS : EAP identifier for the response : Plaintext phase 2 data to encrypt or NULL to continue fragments : Buffer for returning a pointer to the encrypted response message Returns: 0 on success, -1 on failure
Definition at line 879 of file eap_tls_common.c.
int eap_peer_tls_phase2_nak | ( | struct eap_method_type * | types, | |
size_t | num_types, | |||
struct eap_hdr * | hdr, | |||
struct wpabuf ** | resp | |||
) |
eap_peer_tls_phase2_nak - Generate EAP-Nak for Phase 2 : Buffer for returning allocated list of allowed EAP methods : Buffer for returning number of allocated EAP methods : EAP-Request header (and the following EAP type octet) : Buffer for returning the EAP-Nak message Returns: 0 on success, -1 on failure
Definition at line 996 of file eap_tls_common.c.
int eap_peer_tls_process_helper | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
EapType | eap_type, | |||
int | peap_version, | |||
u8 | id, | |||
const u8 * | in_data, | |||
size_t | in_len, | |||
struct wpabuf ** | out_data | |||
) |
eap_peer_tls_process_helper - Process TLS handshake message : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : EAP type (EAP_TYPE_TLS, EAP_TYPE_PEAP, ...) : Version number for EAP-PEAP/TTLS : EAP identifier for the response : Message received from the server : Length of in_data : Buffer for returning a pointer to the response message Returns: 0 on success, 1 if more input data is needed, 2 if application data is available, or -1 on failure
This function can be used to process TLS handshake messages. It reassembles the received fragments and uses a TLS library to process the messages. The response data from the TLS library is fragmented to suitable output messages that the caller can send out.
out_data is used to return the response message if the return value of this function is 0, 2, or -1. In case of failure, the message is likely a TLS alarm message. The caller is responsible for freeing the allocated buffer if *out_data is not NULL.
This function is called for each received TLS message during the TLS handshake after eap_peer_tls_process_init() call and possible processing of TLS Flags field. Once the handshake has been completed, i.e., when tls_connection_established() returns 1, EAP method specific decrypting of the tunneled data is used.
Definition at line 579 of file eap_tls_common.c.
const u8* eap_peer_tls_process_init | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
EapType | eap_type, | |||
struct eap_method_ret * | ret, | |||
const struct wpabuf * | reqData, | |||
size_t * | len, | |||
u8 * | flags | |||
) |
eap_peer_tls_process_init - Initial validation/processing of EAP requests : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : EAP type (EAP_TYPE_TLS, EAP_TYPE_PEAP, ...) : Return values from EAP request validation and processing : EAP request to be processed (eapReqData) : Buffer for returning length of the remaining payload : Buffer for returning TLS flags Returns: Pointer to payload after TLS flags and length or NULL on failure
This function validates the EAP header and processes the optional TLS Message Length field. If this is the first fragment of a TLS message, the TLS reassembly code is initialized to receive the indicated number of bytes.
EAP-TLS, EAP-PEAP, EAP-TTLS, and EAP-FAST methods are expected to use this function as the first step in processing received messages. They will need to process the flags (apart from Message Length Included) that are returned through the flags pointer and the message payload that will be returned (and the length is returned through the len pointer). Return values (ret) are set for continuation of EAP method processing. The caller is responsible for setting these to indicate completion (either success or failure) based on the authentication result.
Definition at line 739 of file eap_tls_common.c.
int eap_peer_tls_reauth_init | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data | |||
) |
eap_peer_tls_reauth_init - Re-initialize shared TLS for session resumption : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing Returns: 0 on success, -1 on failure
Definition at line 680 of file eap_tls_common.c.
void eap_peer_tls_reset_input | ( | struct eap_ssl_data * | data | ) |
eap_peer_tls_reset_input - Reset input buffers : Data for TLS processing
This function frees any allocated memory for input buffers and resets input state.
Definition at line 816 of file eap_tls_common.c.
void eap_peer_tls_reset_output | ( | struct eap_ssl_data * | data | ) |
eap_peer_tls_reset_output - Reset output buffers : Data for TLS processing
This function frees any allocated memory for output buffers and resets output state.
Definition at line 831 of file eap_tls_common.c.
void eap_peer_tls_ssl_deinit | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data | |||
) |
eap_peer_tls_ssl_deinit - Deinitialize shared TLS functionality : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing
This function deinitializes shared TLS functionality that was initialized with eap_peer_tls_ssl_init().
Definition at line 242 of file eap_tls_common.c.
int eap_peer_tls_ssl_init | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
struct eap_peer_config * | config | |||
) |
eap_peer_tls_ssl_init - Initialize shared TLS functionality : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : Pointer to the network configuration Returns: 0 on success, -1 on failure
This function is used to initialize shared TLS functionality for EAP-TLS, EAP-PEAP, EAP-TTLS, and EAP-FAST.
Definition at line 197 of file eap_tls_common.c.
int eap_peer_tls_status | ( | struct eap_sm * | sm, | |
struct eap_ssl_data * | data, | |||
char * | buf, | |||
size_t | buflen, | |||
int | verbose | |||
) |
eap_peer_tls_status - Get TLS status : Pointer to EAP state machine allocated with eap_peer_sm_init() : Data for TLS processing : Buffer for status information : Maximum buffer length : Whether to include verbose status information Returns: Number of bytes written to buf.
Definition at line 697 of file eap_tls_common.c.