3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

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.
This commit is contained in:
James Prestwood 2019-05-10 13:19:25 -07:00 committed by Denis Kenzior
parent 4c32dd09f6
commit e109e1b1cf
3 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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))