]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PASN: Move MIC element check to be after PTK derivation
authorAiny Kumari <ainy.kumari@oss.qualcomm.com>
Thu, 27 Nov 2025 00:16:16 +0000 (05:46 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 18 Dec 2025 10:08:24 +0000 (12:08 +0200)
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 <smagam@qti.qualcomm.com>
Signed-off-by: Ainy Kumari <ainy.kumari@oss.qualcomm.com>
src/pasn/pasn_initiator.c

index 8882e4c66e93e0b59a7c6f0257e26c7f91f2f03e..2769473b81d13264328fba7283918fcaaf689458 100644 (file)
@@ -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;