From: Jouni Malinen Date: Tue, 14 Nov 2017 10:54:45 +0000 (+0200) Subject: wlantest: Remove unnecessary duplication of tk_len from STA entries X-Git-Tag: hostap_2_7~858 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5420bcf477d0088fac84cba1d803f89830b6b970;p=thirdparty%2Fhostap.git 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 --- diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c index 23586eaee..6437b8363 100644 --- a/wlantest/rx_data.c +++ b/wlantest/rx_data.c @@ -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, diff --git a/wlantest/rx_eapol.c b/wlantest/rx_eapol.c index 1353702ab..536a6c07d 100644 --- a/wlantest/rx_eapol.c +++ b/wlantest/rx_eapol.c @@ -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]++; diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h index a841c18b7..7a99b489c 100644 --- a/wlantest/wlantest.h +++ b/wlantest/wlantest.h @@ -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;