wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_gpsk_common.h
Go to the documentation of this file.
1 
5 #ifndef EAP_GPSK_COMMON_H
6 #define EAP_GPSK_COMMON_H
7 
8 #define EAP_GPSK_OPCODE_GPSK_1 1
9 #define EAP_GPSK_OPCODE_GPSK_2 2
10 #define EAP_GPSK_OPCODE_GPSK_3 3
11 #define EAP_GPSK_OPCODE_GPSK_4 4
12 #define EAP_GPSK_OPCODE_FAIL 5
13 #define EAP_GPSK_OPCODE_PROTECTED_FAIL 6
14 
15 /* Failure-Code in GPSK-Fail and GPSK-Protected-Fail */
16 #define EAP_GPSK_FAIL_PSK_NOT_FOUND 0x00000001
17 #define EAP_GPSK_FAIL_AUTHENTICATION_FAILURE 0x00000002
18 #define EAP_GPSK_FAIL_AUTHORIZATION_FAILURE 0x00000003
19 
20 #define EAP_GPSK_RAND_LEN 32
21 #define EAP_GPSK_MAX_SK_LEN 32
22 #define EAP_GPSK_MAX_PK_LEN 32
23 #define EAP_GPSK_MAX_MIC_LEN 32
24 
25 #define EAP_GPSK_VENDOR_IETF 0x00000000
26 #define EAP_GPSK_CIPHER_RESERVED 0x000000
27 #define EAP_GPSK_CIPHER_AES 0x000001
28 #define EAP_GPSK_CIPHER_SHA256 0x000002
29 
30 
31 #ifdef _MSC_VER
32 #pragma pack(push, 1)
33 #endif /* _MSC_VER */
34 
36  u8 vendor[4];
37  u8 specifier[2];
38 } STRUCT_PACKED;
39 
40 #ifdef _MSC_VER
41 #pragma pack(pop)
42 #endif /* _MSC_VER */
43 
44 int eap_gpsk_supported_ciphersuite(int vendor, int specifier);
45 int eap_gpsk_derive_keys(const u8 *psk, size_t psk_len, int vendor,
46  int specifier,
47  const u8 *rand_client, const u8 *rand_server,
48  const u8 *id_client, size_t id_client_len,
49  const u8 *id_server, size_t id_server_len,
50  u8 *msk, u8 *emsk, u8 *sk, size_t *sk_len,
51  u8 *pk, size_t *pk_len);
52 int eap_gpsk_derive_session_id(const u8 *psk, size_t psk_len, int vendor,
53  int specifier,
54  const u8 *rand_peer, const u8 *rand_server,
55  const u8 *id_peer, size_t id_peer_len,
56  const u8 *id_server, size_t id_server_len,
57  u8 method_type, u8 *sid, size_t *sid_len);
58 size_t eap_gpsk_mic_len(int vendor, int specifier);
59 int eap_gpsk_compute_mic(const u8 *sk, size_t sk_len, int vendor,
60  int specifier, const u8 *data, size_t len, u8 *mic);
61 
62 #endif /* EAP_GPSK_COMMON_H */
Definition: eap_gpsk_common.h:35
int eap_gpsk_supported_ciphersuite(int vendor, int specifier)
Check whether ciphersuite is supported.
Definition: eap_gpsk_common.c:20
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.
Definition: eap_gpsk_common.c:412
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.
Definition: eap_gpsk_common.c:519
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.
Definition: eap_gpsk_common.c:274
size_t eap_gpsk_mic_len(int vendor, int specifier)
Get the length of the MIC.
Definition: eap_gpsk_common.c:477