diff mbox series

[3/5] test_ap_ciphers: extend debugfs for IGTK/BIGTK

Message ID 1588772536-I5c09edfbd0fdfaac87042d52da51d78d302b18ca@changeid
State Superseded
Headers show
Series [1/5] test_ap_ciphers: replace gtk boolean by keytype | expand

Commit Message

Johannes Berg May 6, 2020, 1:42 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Extend the debugfs read helpers to work with IGTK and BIGTK.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/test_ap_ciphers.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index 3d10cb0dce2c..6726e90d054a 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -17,7 +17,7 @@  from utils import *
 from wlantest import Wlantest
 from wpasupplicant import WpaSupplicant
 
-KT_PTK, KT_GTK = range(2)
+KT_PTK, KT_GTK, KT_IGTK, KT_BIGTK = range(4)
 
 def check_cipher(dev, ap, cipher, group_cipher=None):
     if cipher not in dev.get_capability("pairwise"):
@@ -490,6 +490,14 @@  def get_rx_spec(phy, keytype=KT_PTK):
     try:
         for key in os.listdir(keys):
             keydir = keys + "/" + key
+            with open(keydir + '/keyidx') as f:
+                keyid = int(f.read())
+            if keytype in (KT_PTK, KT_GTK) and not keyid in (0, 1, 2, 3):
+                continue
+            if keytype == KT_IGTK and not keyid in (4, 5):
+                continue
+            if keytype == KT_BIGTK and not keyid in (6, 7):
+                continue
             files = os.listdir(keydir)
             if keytype == KT_PTK and "station" not in files:
                 continue
@@ -506,6 +514,14 @@  def get_tk_replay_counter(phy, keytype=KT_PTK):
     try:
         for key in os.listdir(keys):
             keydir = keys + "/" + key
+            with open(keydir + '/keyidx') as f:
+                keyid = int(f.read())
+            if keytype in (KT_PTK, KT_GTK) and not keyid in (0, 1, 2, 3):
+                continue
+            if keytype == KT_IGTK and not keyid in (4, 5):
+                continue
+            if keytype == KT_BIGTK and not keyid in (6, 7):
+                continue
             files = os.listdir(keydir)
             if keytype == KT_PTK and "station" not in files:
                 continue