]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Remove unnecessary duplication of tk_len from STA entries
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 14 Nov 2017 10:54:45 +0000 (12:54 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 14 Nov 2017 10:54:45 +0000 (12:54 +0200)
The length of the TK is available within struct wpa_ptk, so there is no
need to try to maintain it separately in wlantest.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wlantest/rx_data.c
wlantest/rx_eapol.c
wlantest/wlantest.h

index 23586eaeeb052aa60c7a06f90062e650246873e0..6437b8363158bd799d419b0ff1338a2c09fba35f 100644 (file)
@@ -426,7 +426,7 @@ skip_replay_det:
                        decrypted = ccmp_256_decrypt(tk, hdr, data, len, &dlen);
                else if (sta->pairwise_cipher == WPA_CIPHER_GCMP ||
                         sta->pairwise_cipher == WPA_CIPHER_GCMP_256)
-                       decrypted = gcmp_decrypt(tk, sta->tk_len, hdr, data,
+                       decrypted = gcmp_decrypt(tk, sta->ptk.tk_len, hdr, data,
                                                 len, &dlen);
                else
                        decrypted = ccmp_decrypt(tk, hdr, data, len, &dlen);
@@ -440,7 +440,7 @@ skip_replay_det:
                                                     len, &dlen);
                else if (sta->pairwise_cipher == WPA_CIPHER_GCMP ||
                         sta->pairwise_cipher == WPA_CIPHER_GCMP_256)
-                       decrypted = gcmp_decrypt(sta->ptk.tk, sta->tk_len,
+                       decrypted = gcmp_decrypt(sta->ptk.tk, sta->ptk.tk_len,
                                                 hdr, data, len, &dlen);
                else
                        decrypted = ccmp_decrypt(sta->ptk.tk, hdr, data, len,
index 1353702ab007fc0d431ede160f5022fc09684f9e..536a6c07d6956c53acad1ba81d5743e3f56190ae 100644 (file)
@@ -136,7 +136,6 @@ static int try_pmk(struct wlantest *wt, struct wlantest_bss *bss,
                return -1;
        }
 
-       sta->tk_len = wpa_cipher_key_len(sta->pairwise_cipher);
        wpa_printf(MSG_INFO, "Derived PTK for STA " MACSTR " BSSID " MACSTR,
                   MAC2STR(sta->addr), MAC2STR(bss->bssid));
        sta->counters[WLANTEST_STA_COUNTER_PTK_LEARNED]++;
index a841c18b7959d559d78eae7df5df854619f7dfca..7a99b489c136749c7a118cf6a6f2a68272799253 100644 (file)
@@ -72,7 +72,6 @@ struct wlantest_sta {
        u8 anonce[32]; /* ANonce from the previous EAPOL-Key msg 1/4 or 3/4 */
        u8 snonce[32]; /* SNonce from the previous EAPOL-Key msg 2/4 */
        struct wpa_ptk ptk; /* Derived PTK */
-       size_t tk_len;
        int ptk_set;
        struct wpa_ptk tptk; /* Derived PTK during rekeying */
        int tptk_set;