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;
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)
{
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)
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;
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)
#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;