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

eapol: Pass actual PTK size to crypto_derive_pairwise_ptk()

It doesn't matter for crypto_derive_pairwise_ptk in non-SHA256 mode
but in the FT PTK derivation function, as well as in SHA256 mode all
bytes of the output do actually change with the PTK size.
This commit is contained in:
Andrew Zaborowski 2016-10-04 05:47:41 +02:00 committed by Denis Kenzior
parent f93b7dfad1
commit 721be04f95

View File

@ -927,6 +927,8 @@ static void eapol_handle_ptk_1_of_4(uint32_t ifindex, struct eapol_sm *sm,
struct eapol_key *step2; struct eapol_key *step2;
uint8_t mic[16]; uint8_t mic[16];
bool use_sha256; bool use_sha256;
enum crypto_cipher cipher;
size_t ptk_size;
if (!eapol_verify_ptk_1_of_4(ek)) { if (!eapol_verify_ptk_1_of_4(ek)) {
handshake_failed(ifindex, sm, MPDU_REASON_CODE_UNSPECIFIED); handshake_failed(ifindex, sm, MPDU_REASON_CODE_UNSPECIFIED);
@ -949,10 +951,13 @@ static void eapol_handle_ptk_1_of_4(uint32_t ifindex, struct eapol_sm *sm,
else else
use_sha256 = false; use_sha256 = false;
cipher = ie_rsn_cipher_suite_to_cipher(sm->pairwise_cipher);
ptk_size = sizeof(struct crypto_ptk) + crypto_cipher_key_len(cipher);
crypto_derive_pairwise_ptk(sm->pmk, sm->spa, sm->aa, crypto_derive_pairwise_ptk(sm->pmk, sm->spa, sm->aa,
sm->anonce, sm->snonce, sm->anonce, sm->snonce,
ptk, sizeof(sm->ptk), ptk, ptk_size, use_sha256);
use_sha256);
step2 = eapol_create_ptk_2_of_4(sm->protocol_version, step2 = eapol_create_ptk_2_of_4(sm->protocol_version,
ek->key_descriptor_version, ek->key_descriptor_version,