SAE: Add generation of the confirm message fields
[mech_eap.git] / src / common / sae.h
1 /*
2  * Simultaneous authentication of equals
3  * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8
9 #ifndef SAE_H
10 #define SAE_H
11
12 #define SAE_COMMIT_MAX_LEN (2 + 3 * 32)
13 #define SAE_CONFIRM_MAX_LEN (2 + 32)
14
15 struct sae_data {
16         enum { SAE_INIT, SAE_COMMIT, SAE_CONFIRM } state;
17         u16 send_confirm;
18         u8 kck[32];
19         u8 pmk[32];
20         u8 own_commit_scalar[32];
21         u8 own_commit_element[2 * 32];
22         u8 peer_commit_scalar[32];
23         u8 peer_commit_element[2 * 32];
24         u8 pwe[2 * 32];
25         u8 sae_rand[32];
26 };
27
28 int sae_prepare_commit(const u8 *addr1, const u8 *addr2,
29                        const u8 *password, size_t password_len,
30                        struct sae_data *sae);
31 int sae_process_commit(struct sae_data *sae);
32 void sae_write_commit(struct sae_data *sae, struct wpabuf *buf);
33 u16 sae_parse_commit(struct sae_data *sae, const u8 *data, size_t len);
34 void sae_write_confirm(struct sae_data *sae, struct wpabuf *buf);
35
36 #endif /* SAE_H */