]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/common/sae.h
EAP-TLS server: Add application data to indicate end of v1.3 handshake
[thirdparty/hostap.git] / src / common / sae.h
CommitLineData
98efcc41
JM
1/*
2 * Simultaneous authentication of equals
cd9c2714 3 * Copyright (c) 2012-2013, Jouni Malinen <j@w1.fi>
98efcc41
JM
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
4925b303
JM
12#define SAE_KCK_LEN 32
13#define SAE_PMK_LEN 32
14#define SAE_PMKID_LEN 16
15#define SAE_KEYSEED_KEY_LEN 32
fbfb0e65 16#define SAE_MAX_PRIME_LEN 512
ce4479c1 17#define SAE_MAX_ECC_PRIME_LEN 66
7babd253
JM
18#define SAE_COMMIT_MAX_LEN (2 + 3 * SAE_MAX_PRIME_LEN)
19#define SAE_CONFIRM_MAX_LEN (2 + SAE_MAX_PRIME_LEN)
8e31e955 20
6a58444d
JM
21/* Special value returned by sae_parse_commit() */
22#define SAE_SILENTLY_DISCARD 65535
23
0ef29e0c 24struct sae_temporary_data {
4925b303 25 u8 kck[SAE_KCK_LEN];
b0f6124c 26 struct crypto_bignum *own_commit_scalar;
ce4479c1
JM
27 struct crypto_bignum *own_commit_element_ffc;
28 struct crypto_ec_point *own_commit_element_ecc;
ce4479c1
JM
29 struct crypto_bignum *peer_commit_element_ffc;
30 struct crypto_ec_point *peer_commit_element_ecc;
4df61ba5
JM
31 struct crypto_ec_point *pwe_ecc;
32 struct crypto_bignum *pwe_ffc;
629c56d7 33 struct crypto_bignum *sae_rand;
a46d72d7
JM
34 struct crypto_ec *ec;
35 int prime_len;
fbfb0e65 36 const struct dh_group *dh;
388f5354
JM
37 const struct crypto_bignum *prime;
38 const struct crypto_bignum *order;
fbfb0e65
JM
39 struct crypto_bignum *prime_buf;
40 struct crypto_bignum *order_buf;
872b7545 41 struct wpabuf *anti_clogging_token;
9be19d0b 42 char *pw_id;
b0e91e38 43 int vlan_id;
fd830891 44 u8 bssid[ETH_ALEN];
98efcc41
JM
45};
46
9249afc8
JM
47enum sae_state {
48 SAE_NOTHING, SAE_COMMITTED, SAE_CONFIRMED, SAE_ACCEPTED
49};
50
0ef29e0c 51struct sae_data {
9249afc8 52 enum sae_state state;
0ef29e0c
JM
53 u16 send_confirm;
54 u8 pmk[SAE_PMK_LEN];
6c33eed3 55 u8 pmkid[SAE_PMKID_LEN];
0ef29e0c
JM
56 struct crypto_bignum *peer_commit_scalar;
57 int group;
d8b841eb 58 unsigned int sync; /* protocol instance variable: Sync */
abcbd060 59 u16 rc; /* protocol instance variable: Rc (received send-confirm) */
0ef29e0c
JM
60 struct sae_temporary_data *tmp;
61};
62
a46d72d7 63int sae_set_group(struct sae_data *sae, int group);
b4fd3613 64void sae_clear_temp_data(struct sae_data *sae);
a46d72d7
JM
65void sae_clear_data(struct sae_data *sae);
66
8e31e955
JM
67int sae_prepare_commit(const u8 *addr1, const u8 *addr2,
68 const u8 *password, size_t password_len,
9be19d0b 69 const char *identifier, struct sae_data *sae);
146f6c9a 70int sae_process_commit(struct sae_data *sae);
d136c376 71void sae_write_commit(struct sae_data *sae, struct wpabuf *buf,
9be19d0b 72 const struct wpabuf *token, const char *identifier);
d136c376 73u16 sae_parse_commit(struct sae_data *sae, const u8 *data, size_t len,
625f202a 74 const u8 **token, size_t *token_len, int *allowed_groups);
fb8fcc29 75void sae_write_confirm(struct sae_data *sae, struct wpabuf *buf);
f2e9818f 76int sae_check_confirm(struct sae_data *sae, const u8 *data, size_t len);
a959a3b6 77u16 sae_group_allowed(struct sae_data *sae, int *allowed_groups, u16 group);
9249afc8 78const char * sae_state_txt(enum sae_state state);
8e31e955 79
98efcc41 80#endif /* SAE_H */