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

EAP server/peer: EAP-GPSK shared routines. More...

Go to the source code of this file.

Data Structures

struct  eap_gpsk_csuite
 

Macros

#define EAP_GPSK_OPCODE_GPSK_1   1
 
#define EAP_GPSK_OPCODE_GPSK_2   2
 
#define EAP_GPSK_OPCODE_GPSK_3   3
 
#define EAP_GPSK_OPCODE_GPSK_4   4
 
#define EAP_GPSK_OPCODE_FAIL   5
 
#define EAP_GPSK_OPCODE_PROTECTED_FAIL   6
 
#define EAP_GPSK_FAIL_PSK_NOT_FOUND   0x00000001
 
#define EAP_GPSK_FAIL_AUTHENTICATION_FAILURE   0x00000002
 
#define EAP_GPSK_FAIL_AUTHORIZATION_FAILURE   0x00000003
 
#define EAP_GPSK_RAND_LEN   32
 
#define EAP_GPSK_MAX_SK_LEN   32
 
#define EAP_GPSK_MAX_PK_LEN   32
 
#define EAP_GPSK_MAX_MIC_LEN   32
 
#define EAP_GPSK_VENDOR_IETF   0x00000000
 
#define EAP_GPSK_CIPHER_RESERVED   0x000000
 
#define EAP_GPSK_CIPHER_AES   0x000001
 
#define EAP_GPSK_CIPHER_SHA256   0x000002
 

Functions

int eap_gpsk_supported_ciphersuite (int vendor, int specifier)
 Check whether ciphersuite is supported. More...
 
int eap_gpsk_derive_keys (const u8 *psk, size_t psk_len, int vendor, int specifier, const u8 *rand_client, const u8 *rand_server, const u8 *id_client, size_t id_client_len, const u8 *id_server, size_t id_server_len, u8 *msk, u8 *emsk, u8 *sk, size_t *sk_len, u8 *pk, size_t *pk_len)
 Derive EAP-GPSK keys. More...
 
int eap_gpsk_derive_session_id (const u8 *psk, size_t psk_len, int vendor, int specifier, const u8 *rand_peer, const u8 *rand_server, const u8 *id_peer, size_t id_peer_len, const u8 *id_server, size_t id_server_len, u8 method_type, u8 *sid, size_t *sid_len)
 Derive EAP-GPSK Session ID. More...
 
size_t eap_gpsk_mic_len (int vendor, int specifier)
 Get the length of the MIC. More...
 
int eap_gpsk_compute_mic (const u8 *sk, size_t sk_len, int vendor, int specifier, const u8 *data, size_t len, u8 *mic)
 Compute EAP-GPSK MIC for an EAP packet. More...
 

Variables

struct eap_gpsk_csuite STRUCT_PACKED
 

Detailed Description

EAP server/peer: EAP-GPSK shared routines.

Function Documentation

int eap_gpsk_compute_mic ( const u8 *  sk,
size_t  sk_len,
int  vendor,
int  specifier,
const u8 *  data,
size_t  len,
u8 *  mic 
)

Compute EAP-GPSK MIC for an EAP packet.

Parameters
skSession key SK from eap_gpsk_derive_keys()
sk_lenSK length in bytes from eap_gpsk_derive_keys()
vendorCSuite/Vendor
specifierCSuite/Specifier
dataInput data to MIC
lenInput data length in bytes
micBuffer for the computed MIC, eap_gpsk_mic_len(cipher) bytes
Returns
0 on success, -1 on failure
int eap_gpsk_derive_keys ( const u8 *  psk,
size_t  psk_len,
int  vendor,
int  specifier,
const u8 *  rand_peer,
const u8 *  rand_server,
const u8 *  id_peer,
size_t  id_peer_len,
const u8 *  id_server,
size_t  id_server_len,
u8 *  msk,
u8 *  emsk,
u8 *  sk,
size_t *  sk_len,
u8 *  pk,
size_t *  pk_len 
)

Derive EAP-GPSK keys.

Parameters
pskPre-shared key
psk_lenLength of psk in bytes
vendorCSuite/Vendor
specifierCSuite/Specifier
rand_peer32-byte RAND_Peer
rand_server32-byte RAND_Server
id_peerID_Peer
id_peer_lenLength of ID_Peer
id_serverID_Server
id_server_lenLength of ID_Server
mskBuffer for 64-byte MSK
emskBuffer for 64-byte EMSK
skBuffer for SK (at least EAP_GPSK_MAX_SK_LEN bytes)
sk_lenBuffer for returning length of SK
pkBuffer for PK (at least EAP_GPSK_MAX_PK_LEN bytes)
pk_lenBuffer for returning length of PK
Returns
0 on success, -1 on failure
int eap_gpsk_derive_session_id ( const u8 *  psk,
size_t  psk_len,
int  vendor,
int  specifier,
const u8 *  rand_peer,
const u8 *  rand_server,
const u8 *  id_peer,
size_t  id_peer_len,
const u8 *  id_server,
size_t  id_server_len,
u8  method_type,
u8 *  sid,
size_t *  sid_len 
)

Derive EAP-GPSK Session ID.

Parameters
pskPre-shared key
psk_lenLength of psk in bytes
vendorCSuite/Vendor
specifierCSuite/Specifier
rand_peer32-byte RAND_Peer
rand_server32-byte RAND_Server
id_peerID_Peer
id_peer_lenLength of ID_Peer
id_serverID_Server
id_server_lenLength of ID_Server
method_typeEAP Authentication Method Type
sidBuffer for 17-byte Session ID
sid_lenBuffer for returning length of Session ID
Returns
0 on success, -1 on failure
size_t eap_gpsk_mic_len ( int  vendor,
int  specifier 
)

Get the length of the MIC.

Parameters
vendorCSuite/Vendor
specifierCSuite/Specifier
Returns
MIC length in bytes
int eap_gpsk_supported_ciphersuite ( int  vendor,
int  specifier 
)

Check whether ciphersuite is supported.

Parameters
vendorCSuite/Vendor
specifierCSuite/Specifier
Returns
1 if ciphersuite is support, or 0 if not