SAE: Add a define for maximum supported prime length
This can be used to increase buffer sizes when adding support for new groups. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
12e06dc228
commit
7babd2539c
2 changed files with 14 additions and 13 deletions
|
@ -111,7 +111,7 @@ static void sae_pwd_seed_key(const u8 *addr1, const u8 *addr2, u8 *key)
|
|||
static int sae_test_pwd_seed(struct sae_data *sae, const u8 *pwd_seed,
|
||||
struct crypto_ec_point *pwe, u8 *pwe_bin)
|
||||
{
|
||||
u8 pwd_value[32];
|
||||
u8 pwd_value[SAE_MAX_PRIME_LEN];
|
||||
struct crypto_bignum *x;
|
||||
int y_bit;
|
||||
|
||||
|
@ -163,7 +163,7 @@ static int sae_derive_pwe(struct sae_data *sae, const u8 *addr1,
|
|||
size_t len[2];
|
||||
int found = 0;
|
||||
struct crypto_ec_point *pwe_tmp;
|
||||
u8 pwe_bin_tmp[2 * 32];
|
||||
u8 pwe_bin_tmp[2 * SAE_MAX_PRIME_LEN];
|
||||
|
||||
pwe_tmp = crypto_ec_point_init(sae->ec);
|
||||
if (pwe_tmp == NULL)
|
||||
|
@ -229,7 +229,7 @@ static int sae_derive_commit(struct sae_data *sae, struct crypto_ec_point *pwe)
|
|||
{
|
||||
struct crypto_bignum *x, *bn_rand, *bn_mask, *order;
|
||||
struct crypto_ec_point *elem;
|
||||
u8 mask[32];
|
||||
u8 mask[SAE_MAX_PRIME_LEN];
|
||||
int ret = -1;
|
||||
|
||||
if (sae_get_rand(sae->sae_rand) < 0 || sae_get_rand(mask) < 0)
|
||||
|
@ -375,7 +375,7 @@ fail:
|
|||
|
||||
static int sae_derive_keys(struct sae_data *sae, const u8 *k)
|
||||
{
|
||||
u8 null_key[32], val[32];
|
||||
u8 null_key[32], val[SAE_MAX_PRIME_LEN];
|
||||
u8 keyseed[SHA256_MAC_LEN];
|
||||
u8 keys[32 + 32];
|
||||
struct crypto_bignum *order, *own_scalar, *peer_scalar, *tmp;
|
||||
|
@ -424,7 +424,7 @@ fail:
|
|||
|
||||
int sae_process_commit(struct sae_data *sae)
|
||||
{
|
||||
u8 k[32];
|
||||
u8 k[SAE_MAX_PRIME_LEN];
|
||||
if (sae_check_peer_commit(sae) < 0 ||
|
||||
sae_derive_k(sae, k) < 0 ||
|
||||
sae_derive_keys(sae, k) < 0)
|
||||
|
|
|
@ -9,20 +9,21 @@
|
|||
#ifndef SAE_H
|
||||
#define SAE_H
|
||||
|
||||
#define SAE_COMMIT_MAX_LEN (2 + 3 * 32)
|
||||
#define SAE_CONFIRM_MAX_LEN (2 + 32)
|
||||
#define SAE_MAX_PRIME_LEN 32
|
||||
#define SAE_COMMIT_MAX_LEN (2 + 3 * SAE_MAX_PRIME_LEN)
|
||||
#define SAE_CONFIRM_MAX_LEN (2 + SAE_MAX_PRIME_LEN)
|
||||
|
||||
struct sae_data {
|
||||
enum { SAE_NOTHING, SAE_COMMITTED, SAE_CONFIRMED, SAE_ACCEPTED } state;
|
||||
u16 send_confirm;
|
||||
u8 kck[32];
|
||||
u8 pmk[32];
|
||||
u8 own_commit_scalar[32];
|
||||
u8 own_commit_element[2 * 32];
|
||||
u8 peer_commit_scalar[32];
|
||||
u8 peer_commit_element[2 * 32];
|
||||
u8 pwe[2 * 32];
|
||||
u8 sae_rand[32];
|
||||
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];
|
||||
u8 pwe[2 * SAE_MAX_PRIME_LEN];
|
||||
u8 sae_rand[SAE_MAX_PRIME_LEN];
|
||||
int group;
|
||||
struct crypto_ec *ec;
|
||||
int prime_len;
|
||||
|
|
Loading…
Reference in a new issue