wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_eke_common.h
Go to the documentation of this file.
1 
5 #ifndef EAP_EKE_COMMON_H
6 #define EAP_EKE_COMMON_H
7 
8 /* EKE Exchange */
9 #define EAP_EKE_ID 1
10 #define EAP_EKE_COMMIT 2
11 #define EAP_EKE_CONFIRM 3
12 #define EAP_EKE_FAILURE 4
13 
14 /* Diffie-Hellman Group Registry */
15 #define EAP_EKE_DHGROUP_EKE_2 1
16 #define EAP_EKE_DHGROUP_EKE_5 2
17 #define EAP_EKE_DHGROUP_EKE_14 3 /* mandatory to implement */
18 #define EAP_EKE_DHGROUP_EKE_15 4
19 #define EAP_EKE_DHGROUP_EKE_16 5
20 
21 /* Encryption Algorithm Registry */
22 #define EAP_EKE_ENCR_AES128_CBC 1 /* mandatory to implement */
23 
24 /* Pseudo Random Function Registry */
25 #define EAP_EKE_PRF_HMAC_SHA1 1 /* mandatory to implement */
26 #define EAP_EKE_PRF_HMAC_SHA2_256 2
27 
28 /* Keyed Message Digest (MAC) Registry */
29 #define EAP_EKE_MAC_HMAC_SHA1 1 /* mandatory to implement */
30 #define EAP_EKE_MAC_HMAC_SHA2_256 2
31 
32 /* Identity Type Registry */
33 #define EAP_EKE_ID_OPAQUE 1
34 #define EAP_EKE_ID_NAI 2
35 #define EAP_EKE_ID_IPv4 3
36 #define EAP_EKE_ID_IPv6 4
37 #define EAP_EKE_ID_FQDN 5
38 #define EAP_EKE_ID_DN 6
39 
40 /* Failure-Code */
41 #define EAP_EKE_FAIL_NO_ERROR 1
42 #define EAP_EKE_FAIL_PROTO_ERROR 2
43 #define EAP_EKE_FAIL_PASSWD_NOT_FOUND 3
44 #define EAP_EKE_FAIL_AUTHENTICATION_FAIL 4
45 #define EAP_EKE_FAIL_AUTHORIZATION_FAIL 5
46 #define EAP_EKE_FAIL_NO_PROPOSAL_CHOSEN 6
47 #define EAP_EKE_FAIL_PRIVATE_INTERNAL_ERROR 0xffffffff
48 
49 #define EAP_EKE_MAX_DH_LEN 512
50 #define EAP_EKE_MAX_HASH_LEN 32
51 #define EAP_EKE_MAX_KEY_LEN 16
52 #define EAP_EKE_MAX_KE_LEN 16
53 #define EAP_EKE_MAX_KI_LEN 32
54 #define EAP_EKE_MAX_KA_LEN 32
55 #define EAP_EKE_MAX_NONCE_LEN 16
56 
58  /* Selected proposal */
59  u8 dhgroup;
60  u8 encr;
61  u8 prf;
62  u8 mac;
63 
64  u8 shared_secret[EAP_EKE_MAX_HASH_LEN];
65  u8 ke[EAP_EKE_MAX_KE_LEN];
66  u8 ki[EAP_EKE_MAX_KI_LEN];
67  u8 ka[EAP_EKE_MAX_KA_LEN];
68 
69  int prf_len;
70  int nonce_len;
71  int auth_len;
72  int dhcomp_len;
73  int pnonce_len;
74  int pnonce_ps_len;
75 };
76 
77 int eap_eke_session_init(struct eap_eke_session *sess, u8 dhgroup, u8 encr,
78  u8 prf, u8 mac);
79 void eap_eke_session_clean(struct eap_eke_session *sess);
80 int eap_eke_dh_init(u8 group, u8 *ret_priv, u8 *ret_pub);
81 int eap_eke_derive_key(struct eap_eke_session *sess,
82  const u8 *password, size_t password_len,
83  const u8 *id_s, size_t id_s_len, const u8 *id_p,
84  size_t id_p_len, u8 *key);
85 int eap_eke_dhcomp(struct eap_eke_session *sess, const u8 *key, const u8 *dhpub,
86  u8 *ret_dhcomp);
87 int eap_eke_shared_secret(struct eap_eke_session *sess, const u8 *key,
88  const u8 *dhpriv, const u8 *peer_dhcomp);
89 int eap_eke_derive_ke_ki(struct eap_eke_session *sess,
90  const u8 *id_s, size_t id_s_len,
91  const u8 *id_p, size_t id_p_len);
92 int eap_eke_derive_ka(struct eap_eke_session *sess,
93  const u8 *id_s, size_t id_s_len,
94  const u8 *id_p, size_t id_p_len,
95  const u8 *nonce_p, const u8 *nonce_s);
96 int eap_eke_derive_msk(struct eap_eke_session *sess,
97  const u8 *id_s, size_t id_s_len,
98  const u8 *id_p, size_t id_p_len,
99  const u8 *nonce_p, const u8 *nonce_s,
100  u8 *msk, u8 *emsk);
101 int eap_eke_prot(struct eap_eke_session *sess,
102  const u8 *data, size_t data_len,
103  u8 *prot, size_t *prot_len);
104 int eap_eke_decrypt_prot(struct eap_eke_session *sess,
105  const u8 *prot, size_t prot_len,
106  u8 *data, size_t *data_len);
107 int eap_eke_auth(struct eap_eke_session *sess, const char *label,
108  const struct wpabuf *msgs, u8 *auth);
109 
110 #endif /* EAP_EKE_COMMON_H */
Definition: wpabuf.h:16
Definition: eap_eke_common.h:57