diff --git a/src/crypto.c b/src/crypto.c index 1c2d2db2..7e7085f6 100644 --- 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 index 0b7f0275..87676d96 100644 --- 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 index 19adbfd9..e51e2f92 100644 --- 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))