wlantest: Remove unnecessary duplication of tk_len from STA entries

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>
This commit is contained in:
Jouni Malinen 2017-11-14 12:54:45 +02:00 committed by Jouni Malinen
parent 1d624a0702
commit 5420bcf477
3 changed files with 2 additions and 4 deletions

View file

@ -426,7 +426,7 @@ skip_replay_det:
decrypted = ccmp_256_decrypt(tk, hdr, data, len, &dlen); decrypted = ccmp_256_decrypt(tk, hdr, data, len, &dlen);
else if (sta->pairwise_cipher == WPA_CIPHER_GCMP || else if (sta->pairwise_cipher == WPA_CIPHER_GCMP ||
sta->pairwise_cipher == WPA_CIPHER_GCMP_256) 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); len, &dlen);
else else
decrypted = ccmp_decrypt(tk, hdr, data, len, &dlen); decrypted = ccmp_decrypt(tk, hdr, data, len, &dlen);
@ -440,7 +440,7 @@ skip_replay_det:
len, &dlen); len, &dlen);
else if (sta->pairwise_cipher == WPA_CIPHER_GCMP || else if (sta->pairwise_cipher == WPA_CIPHER_GCMP ||
sta->pairwise_cipher == WPA_CIPHER_GCMP_256) 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); hdr, data, len, &dlen);
else else
decrypted = ccmp_decrypt(sta->ptk.tk, hdr, data, len, decrypted = ccmp_decrypt(sta->ptk.tk, hdr, data, len,

View file

@ -136,7 +136,6 @@ static int try_pmk(struct wlantest *wt, struct wlantest_bss *bss,
return -1; return -1;
} }
sta->tk_len = wpa_cipher_key_len(sta->pairwise_cipher);
wpa_printf(MSG_INFO, "Derived PTK for STA " MACSTR " BSSID " MACSTR, wpa_printf(MSG_INFO, "Derived PTK for STA " MACSTR " BSSID " MACSTR,
MAC2STR(sta->addr), MAC2STR(bss->bssid)); MAC2STR(sta->addr), MAC2STR(bss->bssid));
sta->counters[WLANTEST_STA_COUNTER_PTK_LEARNED]++; sta->counters[WLANTEST_STA_COUNTER_PTK_LEARNED]++;

View file

@ -72,7 +72,6 @@ struct wlantest_sta {
u8 anonce[32]; /* ANonce from the previous EAPOL-Key msg 1/4 or 3/4 */ 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 */ u8 snonce[32]; /* SNonce from the previous EAPOL-Key msg 2/4 */
struct wpa_ptk ptk; /* Derived PTK */ struct wpa_ptk ptk; /* Derived PTK */
size_t tk_len;
int ptk_set; int ptk_set;
struct wpa_ptk tptk; /* Derived PTK during rekeying */ struct wpa_ptk tptk; /* Derived PTK during rekeying */
int tptk_set; int tptk_set;