From b3361e5dc9f3ca768032bae40a1708934f18a6f5 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Feb 2019 18:50:13 +0200 Subject: [PATCH] tests: Explicit str/bytes conversion for key_lifetime_in_memory This is needed for python3. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_eap.py | 1 + tests/hwsim/test_ap_psk.py | 4 ++-- tests/hwsim/test_erp.py | 3 ++- tests/hwsim/test_sae.py | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py index 39fd812fc..0c45058fa 100644 --- a/tests/hwsim/test_ap_eap.py +++ b/tests/hwsim/test_ap_eap.py @@ -5083,6 +5083,7 @@ def test_wpa2_eap_ttls_pap_key_lifetime_in_memory(dev, apdev, params): # eloop before reading process memory. time.sleep(1) dev[0].ping() + password = password.encode() buf = read_process_memory(pid, password) dev[0].request("DISCONNECT") diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py index b6ed58d56..c10d835bd 100644 --- a/tests/hwsim/test_ap_psk.py +++ b/tests/hwsim/test_ap_psk.py @@ -2329,7 +2329,7 @@ def read_process_memory(pid, key=None): buf = bytes() logger.info("Reading process memory (pid=%d)" % pid) with open('/proc/%d/maps' % pid, 'r') as maps, \ - open('/proc/%d/mem' % pid, 'r') as mem: + open('/proc/%d/mem' % pid, 'rb') as mem: for l in maps.readlines(): m = re.match(r'([0-9a-f]+)-([0-9a-f]+) ([-r][-w][-x][-p])', l) if not m: @@ -2360,7 +2360,7 @@ def verify_not_present(buf, key, fname, keyname): return prefix = 2048 if pos > 2048 else pos - with open(fname + keyname, 'w') as f: + with open(fname + keyname, 'wb') as f: f.write(buf[pos - prefix:pos + 2048]) raise Exception(keyname + " found after disassociation") diff --git a/tests/hwsim/test_erp.py b/tests/hwsim/test_erp.py index 10b4234ea..7da605287 100644 --- a/tests/hwsim/test_erp.py +++ b/tests/hwsim/test_erp.py @@ -1,5 +1,5 @@ # EAP Re-authentication Protocol (ERP) tests -# Copyright (c) 2014-2015, Jouni Malinen +# Copyright (c) 2014-2019, Jouni Malinen # # This software may be distributed under the terms of the BSD license. # See README for more details. @@ -275,6 +275,7 @@ def test_erp_key_lifetime_in_memory(dev, apdev, params): # eloop before reading process memory. time.sleep(1) dev[0].ping() + password = password.encode() buf = read_process_memory(pid, password) dev[0].request("DISCONNECT") diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py index 104fb5bb4..0e94d95ff 100644 --- a/tests/hwsim/test_sae.py +++ b/tests/hwsim/test_sae.py @@ -362,6 +362,7 @@ def test_sae_key_lifetime_in_memory(dev, apdev, params): # eloop before reading process memory. time.sleep(1) dev[0].ping() + password = password.encode() buf = read_process_memory(pid, password) dev[0].request("DISCONNECT")