2012-12-30 14:48:19 -05:00
|
|
|
/*
|
|
|
|
* Simultaneous authentication of equals
|
2013-01-01 07:00:40 -05:00
|
|
|
* Copyright (c) 2012-2013, Jouni Malinen <j@w1.fi>
|
2012-12-30 14:48:19 -05:00
|
|
|
*
|
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SAE_H
|
|
|
|
#define SAE_H
|
|
|
|
|
2013-01-01 04:52:49 -05:00
|
|
|
#define SAE_KCK_LEN 32
|
|
|
|
#define SAE_PMK_LEN 32
|
|
|
|
#define SAE_PMKID_LEN 16
|
|
|
|
#define SAE_KEYSEED_KEY_LEN 32
|
2013-01-05 14:22:00 -05:00
|
|
|
#define SAE_MAX_PRIME_LEN 512
|
2013-01-01 04:49:01 -05:00
|
|
|
#define SAE_COMMIT_MAX_LEN (2 + 3 * SAE_MAX_PRIME_LEN)
|
|
|
|
#define SAE_CONFIRM_MAX_LEN (2 + SAE_MAX_PRIME_LEN)
|
2012-12-30 15:06:11 -05:00
|
|
|
|
2012-12-30 14:48:19 -05:00
|
|
|
struct sae_data {
|
2012-12-31 04:05:42 -05:00
|
|
|
enum { SAE_NOTHING, SAE_COMMITTED, SAE_CONFIRMED, SAE_ACCEPTED } state;
|
2012-12-30 14:48:19 -05:00
|
|
|
u16 send_confirm;
|
2013-01-01 04:52:49 -05:00
|
|
|
u8 kck[SAE_KCK_LEN];
|
|
|
|
u8 pmk[SAE_PMK_LEN];
|
2013-01-01 04:49:01 -05:00
|
|
|
u8 own_commit_scalar[SAE_MAX_PRIME_LEN];
|
|
|
|
u8 own_commit_element[2 * SAE_MAX_PRIME_LEN];
|
|
|
|
u8 peer_commit_scalar[SAE_MAX_PRIME_LEN];
|
|
|
|
u8 peer_commit_element[2 * SAE_MAX_PRIME_LEN];
|
2013-01-06 09:10:48 -05:00
|
|
|
struct crypto_ec_point *pwe_ecc;
|
|
|
|
struct crypto_bignum *pwe_ffc;
|
2013-01-06 08:32:38 -05:00
|
|
|
struct crypto_bignum *sae_rand;
|
2013-01-01 04:29:53 -05:00
|
|
|
int group;
|
|
|
|
struct crypto_ec *ec;
|
|
|
|
int prime_len;
|
2013-01-05 14:22:00 -05:00
|
|
|
const struct dh_group *dh;
|
2013-01-05 14:12:29 -05:00
|
|
|
const struct crypto_bignum *prime;
|
|
|
|
const struct crypto_bignum *order;
|
2013-01-05 14:22:00 -05:00
|
|
|
struct crypto_bignum *prime_buf;
|
|
|
|
struct crypto_bignum *order_buf;
|
2012-12-30 14:48:19 -05:00
|
|
|
};
|
|
|
|
|
2013-01-01 04:29:53 -05:00
|
|
|
int sae_set_group(struct sae_data *sae, int group);
|
|
|
|
void sae_clear_data(struct sae_data *sae);
|
|
|
|
|
2012-12-30 15:06:11 -05:00
|
|
|
int sae_prepare_commit(const u8 *addr1, const u8 *addr2,
|
|
|
|
const u8 *password, size_t password_len,
|
|
|
|
struct sae_data *sae);
|
2012-12-30 15:16:18 -05:00
|
|
|
int sae_process_commit(struct sae_data *sae);
|
2012-12-31 09:58:36 -05:00
|
|
|
void sae_write_commit(struct sae_data *sae, struct wpabuf *buf,
|
|
|
|
const struct wpabuf *token);
|
|
|
|
u16 sae_parse_commit(struct sae_data *sae, const u8 *data, size_t len,
|
2013-01-01 09:23:47 -05:00
|
|
|
const u8 **token, size_t *token_len, int *allowed_groups);
|
2012-12-30 15:28:57 -05:00
|
|
|
void sae_write_confirm(struct sae_data *sae, struct wpabuf *buf);
|
2012-12-30 15:31:19 -05:00
|
|
|
int sae_check_confirm(struct sae_data *sae, const u8 *data, size_t len);
|
2012-12-30 15:06:11 -05:00
|
|
|
|
2012-12-30 14:48:19 -05:00
|
|
|
#endif /* SAE_H */
|