wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Functions
eap_fast_pac.c File Reference

EAP peer method: EAP-FAST PAC file processing. More...

#include "includes.h"
#include "common.h"
#include "eap_config.h"
#include "eap_i.h"
#include "eap_fast_pac.h"

Data Structures

struct  eap_fast_read_ctx
 

Macros

#define EAP_FAST_PAC_BINARY_MAGIC   0x6ae4920c
 
#define EAP_FAST_PAC_BINARY_FORMAT_VERSION   0
 

Functions

void eap_fast_free_pac (struct eap_fast_pac *pac)
 Free PAC data. More...
 
struct eap_fast_paceap_fast_get_pac (struct eap_fast_pac *pac_root, const u8 *a_id, size_t a_id_len, u16 pac_type)
 Get a PAC entry based on A-ID. More...
 
int eap_fast_add_pac (struct eap_fast_pac **pac_root, struct eap_fast_pac **pac_current, struct eap_fast_pac *entry)
 Add a copy of a PAC entry to a list. More...
 
int eap_fast_load_pac (struct eap_sm *sm, struct eap_fast_pac **pac_root, const char *pac_file)
 Load PAC entries (text format) More...
 
int eap_fast_save_pac (struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file)
 Save PAC entries (text format) More...
 
size_t eap_fast_pac_list_truncate (struct eap_fast_pac *pac_root, size_t max_len)
 Truncate a PAC list to the given length. More...
 
int eap_fast_load_pac_bin (struct eap_sm *sm, struct eap_fast_pac **pac_root, const char *pac_file)
 Load PAC entries (binary format) More...
 
int eap_fast_save_pac_bin (struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file)
 Save PAC entries (binary format) More...
 

Detailed Description

EAP peer method: EAP-FAST PAC file processing.

Function Documentation

int eap_fast_add_pac ( struct eap_fast_pac **  pac_root,
struct eap_fast_pac **  pac_current,
struct eap_fast_pac entry 
)

Add a copy of a PAC entry to a list.

Parameters
pac_rootPointer to PAC list root pointer
pac_currentPointer to the current PAC pointer
entryNew entry to clone and add to the list
Returns
0 on success, -1 on failure

This function makes a clone of the given PAC entry and adds this copied entry to the list (pac_root). If an old entry for the same A-ID is found, it will be removed from the PAC list and in this case, pac_current entry is set to NULL if it was the removed entry.

void eap_fast_free_pac ( struct eap_fast_pac pac)

Free PAC data.

Parameters
pacPointer to the PAC entry

Note that the PAC entry must not be in a list since this function does not remove the list links.

struct eap_fast_pac* eap_fast_get_pac ( struct eap_fast_pac pac_root,
const u8 *  a_id,
size_t  a_id_len,
u16  pac_type 
)

Get a PAC entry based on A-ID.

Parameters
pac_rootPointer to root of the PAC list
a_idA-ID to search for
a_id_lenLength of A-ID
pac_typePAC-Type to search for
Returns
Pointer to the PAC entry, or NULL if A-ID not found
int eap_fast_load_pac ( struct eap_sm sm,
struct eap_fast_pac **  pac_root,
const char *  pac_file 
)

Load PAC entries (text format)

Parameters
smPointer to EAP state machine allocated with eap_peer_sm_init()
pac_rootPointer to root of the PAC list (to be filled)
pac_fileName of the PAC file/blob to load
Returns
0 on success, -1 on failure
int eap_fast_load_pac_bin ( struct eap_sm sm,
struct eap_fast_pac **  pac_root,
const char *  pac_file 
)

Load PAC entries (binary format)

Parameters
smPointer to EAP state machine allocated with eap_peer_sm_init()
pac_rootPointer to root of the PAC list (to be filled)
pac_fileName of the PAC file/blob to load
Returns
0 on success, -1 on failure
size_t eap_fast_pac_list_truncate ( struct eap_fast_pac pac_root,
size_t  max_len 
)

Truncate a PAC list to the given length.

Parameters
pac_rootRoot of the PAC list
max_lenMaximum length of the list (>= 1)
Returns
Number of PAC entries removed
int eap_fast_save_pac ( struct eap_sm sm,
struct eap_fast_pac pac_root,
const char *  pac_file 
)

Save PAC entries (text format)

Parameters
smPointer to EAP state machine allocated with eap_peer_sm_init()
pac_rootRoot of the PAC list
pac_fileName of the PAC file/blob
Returns
0 on success, -1 on failure
int eap_fast_save_pac_bin ( struct eap_sm sm,
struct eap_fast_pac pac_root,
const char *  pac_file 
)

Save PAC entries (binary format)

Parameters
smPointer to EAP state machine allocated with eap_peer_sm_init()
pac_rootRoot of the PAC list
pac_fileName of the PAC file/blob
Returns
0 on success, -1 on failure