From: Ainy Kumari Date: Thu, 27 Nov 2025 00:16:16 +0000 (+0530) Subject: PASN: Move MIC element check to be after PTK derivation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaa58560e652474c6e5b7e4e940ef8f814149964;p=thirdparty%2Fhostap.git PASN: Move MIC element check to be after PTK derivation This makes it more convenient to determine which hash algorithm to use during PTK derivation instead of having to figure that out multiple times based on different information. Signed-off-by: Sai Pratyusha Magam Signed-off-by: Ainy Kumari --- diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c index 8882e4c66..2769473b8 100644 --- a/src/pasn/pasn_initiator.c +++ b/src/pasn/pasn_initiator.c @@ -1198,18 +1198,6 @@ int wpa_pasn_auth_rx(struct pasn_data *pasn, const u8 *data, size_t len, goto fail; } - /* Check that the MIC IE exists. Save it and zero out the memory */ - mic_len = pasn_mic_len(pasn->akmp, pasn->cipher); - if (status == WLAN_STATUS_SUCCESS) { - if (!elems.mic || elems.mic_len != mic_len) { - wpa_printf(MSG_DEBUG, - "PASN: Invalid MIC. Expecting len=%u", - mic_len); - goto fail; - } - os_memcpy(mic, elems.mic, mic_len); - } - if (!elems.pasn_params || !elems.pasn_params_len) { wpa_printf(MSG_DEBUG, "PASN: Missing PASN Parameters IE"); @@ -1349,6 +1337,18 @@ int wpa_pasn_auth_rx(struct pasn_data *pasn, const u8 *data, size_t len, wpabuf_free(secret); secret = NULL; + /* Check that the MIC IE exists. Save it and zero out the memory */ + mic_len = pasn_mic_len(pasn->akmp, pasn->cipher); + if (status == WLAN_STATUS_SUCCESS) { + if (!elems.mic || elems.mic_len != mic_len) { + wpa_printf(MSG_DEBUG, + "PASN: Invalid MIC. Expecting len=%u", + mic_len); + goto fail; + } + os_memcpy(mic, elems.mic, mic_len); + } + /* Use a copy of the message since we need to clear the MIC field */ if (!elems.mic) goto fail;