3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

fils: Fix endianness issues

Using mmpdu_associate_response and mmpdu_authenticate structure
members marked __le requires the relevant endianness conversion.
This commit is contained in:
Denis Kenzior 2019-05-23 16:51:43 -05:00
parent e53bd17992
commit 360ec1488d

View File

@ -328,6 +328,7 @@ static int fils_rx_authenticate(struct auth_proto *driver, const uint8_t *frame,
struct fils_sm *fils = l_container_of(driver, struct fils_sm, ap); struct fils_sm *fils = l_container_of(driver, struct fils_sm, ap);
const struct mmpdu_header *hdr = mpdu_validate(frame, len); const struct mmpdu_header *hdr = mpdu_validate(frame, len);
const struct mmpdu_authentication *auth; const struct mmpdu_authentication *auth;
uint16_t alg;
struct ie_tlv_iter iter; struct ie_tlv_iter iter;
const uint8_t *anonce = NULL; const uint8_t *anonce = NULL;
const uint8_t *session = NULL; const uint8_t *session = NULL;
@ -351,11 +352,12 @@ static int fils_rx_authenticate(struct auth_proto *driver, const uint8_t *frame,
if (auth->status != 0) { if (auth->status != 0) {
l_debug("invalid status %u", auth->status); l_debug("invalid status %u", auth->status);
return (int)auth->status; return L_LE16_TO_CPU(auth->status);
} }
if (auth->algorithm != MMPDU_AUTH_ALGO_FILS_SK && alg = L_LE16_TO_CPU(auth->algorithm);
auth->algorithm != MMPDU_AUTH_ALGO_FILS_SK_PFS) { if (alg != MMPDU_AUTH_ALGO_FILS_SK &&
alg != MMPDU_AUTH_ALGO_FILS_SK_PFS) {
l_debug("invalid auth algorithm %u", auth->algorithm); l_debug("invalid auth algorithm %u", auth->algorithm);
return MMPDU_STATUS_CODE_UNSUP_AUTH_ALG; return MMPDU_STATUS_CODE_UNSUP_AUTH_ALG;
} }
@ -474,7 +476,7 @@ static int fils_rx_associate(struct auth_proto *driver, const uint8_t *frame,
} }
if (assoc->status_code != 0) if (assoc->status_code != 0)
return (int)assoc->status_code; return L_CPU_TO_LE16(assoc->status_code);
ie_tlv_iter_init(&iter, assoc->ies, (const uint8_t *) hdr + len - ie_tlv_iter_init(&iter, assoc->ies, (const uint8_t *) hdr + len -
assoc->ies); assoc->ies);