[PATCH v2 30/38] tests: Modify sae test sets for python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx>
---
 tests/hwsim/test_ap_psk.py |  2 ++
 tests/hwsim/test_sae.py    | 12 +++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index 03be59cd3..3e67b194e 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -2364,6 +2364,8 @@ def read_process_memory(pid, key=None):
                 continue
             converted_key = key
             if not type(key) == bytes:
+                if len(key) % 2 == 1:
+                    key = '0' + key
                 converted_key = binascii.unhexlify(key)
             if converted_key in data:
                 logger.info("Key found in " + l)
diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py
index 75003fac1..f6d4fa41f 100644
--- a/tests/hwsim/test_sae.py
+++ b/tests/hwsim/test_sae.py
@@ -408,8 +408,10 @@ def test_sae_key_lifetime_in_memory(dev, apdev, params):
 
     logger.info("Checking keys in memory while associated")
     get_key_locations(buf, password, "Password")
+    if len(password) % 2 == 1:
+        password = '0' + password
     get_key_locations(buf, pmk, "PMK")
-    if password not in buf:
+    if binascii.unhexlify(password) not in buf:
         raise HwsimSkip("Password not found while associated")
     if pmk not in buf:
         raise HwsimSkip("PMK not found while associated")
@@ -726,7 +728,7 @@ def test_sae_proto_confirm_replay(dev, apdev):
     hdr = "b0003a01" + bssid + addr + bssid + "1000"
 
     hapd.dump_monitor()
-    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + req['frame'].encode('hex'))
+    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
 
     logger.info("Confirm")
     for i in range(0, 10):
@@ -740,10 +742,10 @@ def test_sae_proto_confirm_replay(dev, apdev):
         raise Exception("Authentication frame (confirm) not received")
 
     hapd.dump_monitor()
-    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + req['frame'].encode('hex'))
+    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
 
     logger.info("Replay Confirm")
-    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + req['frame'].encode('hex'))
+    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
 
     logger.info("Association Request")
     for i in range(0, 10):
@@ -757,7 +759,7 @@ def test_sae_proto_confirm_replay(dev, apdev):
         raise Exception("Association Request frame not received")
 
     hapd.dump_monitor()
-    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + req['frame'].encode('hex'))
+    hapd.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + binascii.hexlify(req['frame']).decode())
     ev = hapd.wait_event(["MGMT-TX-STATUS"], timeout=5)
     if ev is None:
         raise Exception("Management frame TX status not reported (1)")
-- 
2.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux