commit e109e1b1cff4f1e84e3e72478b5366eb27331c03
parent 4c32dd09f6eeda204af34b0f5cd34db99b8f4aca
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Fri, 10 May 2019 13:19:25 -0700
crypto: pass xxkey length for crypto_derive_pmk_r0
FILS-FT has a special derivation for xxkey, and depending on AKM
the key may be 32 or 48 bytes long.
Diffstat:
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/crypto.c b/src/crypto.c
@@ -836,7 +836,7 @@ bool crypto_derive_pairwise_ptk(const uint8_t *pmk, size_t pmk_len,
}
/* Defined in 802.11-2012, Section 11.6.1.7.3 PMK-R0 */
-bool crypto_derive_pmk_r0(const uint8_t *xxkey,
+bool crypto_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len,
const uint8_t *ssid, size_t ssid_len,
uint16_t mdid,
const uint8_t *r0khid, size_t r0kh_len,
@@ -869,7 +869,7 @@ bool crypto_derive_pmk_r0(const uint8_t *xxkey,
memcpy(context + pos, s0khid, ETH_ALEN);
pos += ETH_ALEN;
- if (!kdf_sha256(xxkey, 32, "FT-R0", 5, context, pos, output, 48))
+ if (!kdf_sha256(xxkey, xxkey_len, "FT-R0", 5, context, pos, output, 48))
goto exit;
sha256 = l_checksum_new(L_CHECKSUM_SHA256);
diff --git a/src/crypto.h b/src/crypto.h
@@ -116,7 +116,7 @@ bool crypto_derive_pairwise_ptk(const uint8_t *pmk, size_t pmk_len,
uint8_t *out_ptk, size_t ptk_len,
enum l_checksum_type type);
-bool crypto_derive_pmk_r0(const uint8_t *xxkey,
+bool crypto_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len,
const uint8_t *ssid, size_t ssid_len,
uint16_t mdid,
const uint8_t *r0khid, size_t r0kh_len,
diff --git a/src/handshake.c b/src/handshake.c
@@ -424,7 +424,7 @@ bool handshake_state_derive_ptk(struct handshake_state *s)
ie_parse_mobility_domain_from_data(s->mde, s->mde[1] + 2,
&mdid, NULL, NULL);
- if (!crypto_derive_pmk_r0(xxkey, s->ssid, s->ssid_len, mdid,
+ if (!crypto_derive_pmk_r0(xxkey, 32, s->ssid, s->ssid_len, mdid,
s->r0khid, s->r0khid_len,
s->spa,
s->pmk_r0, s->pmk_r0_name))