]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_sae.py
2 # Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi>
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
7 from remotehost
import remote_compatible
12 logger
= logging
.getLogger()
16 from utils
import HwsimSkip
, alloc_fail
, fail_test
, wait_fail_trigger
17 from test_ap_psk
import find_wpas_process
, read_process_memory
, verify_not_present
, get_key_locations
20 def test_sae(dev
, apdev
):
21 """SAE with default group"""
22 if "SAE" not in dev
[0].get_capability("auth_alg"):
23 raise HwsimSkip("SAE not supported")
24 params
= hostapd
.wpa2_params(ssid
="test-sae",
25 passphrase
="12345678")
26 params
['wpa_key_mgmt'] = 'SAE'
27 hapd
= hostapd
.add_ap(apdev
[0], params
)
28 key_mgmt
= hapd
.get_config()['key_mgmt']
29 if key_mgmt
.split(' ')[0] != "SAE":
30 raise Exception("Unexpected GET_CONFIG(key_mgmt): " + key_mgmt
)
32 dev
[0].request("SET sae_groups ")
33 id = dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
35 if dev
[0].get_status_field('sae_group') != '19':
36 raise Exception("Expected default SAE group not used")
37 bss
= dev
[0].get_bss(apdev
[0]['bssid'])
38 if 'flags' not in bss
:
39 raise Exception("Could not get BSS flags from BSS table")
40 if "[WPA2-SAE-CCMP]" not in bss
['flags']:
41 raise Exception("Unexpected BSS flags: " + bss
['flags'])
43 res
= hapd
.request("STA-FIRST")
44 if "sae_group=19" not in res
.splitlines():
45 raise Exception("hostapd STA output did not specify SAE group")
48 def test_sae_password_ecc(dev
, apdev
):
49 """SAE with number of different passwords (ECC)"""
50 if "SAE" not in dev
[0].get_capability("auth_alg"):
51 raise HwsimSkip("SAE not supported")
52 params
= hostapd
.wpa2_params(ssid
="test-sae",
53 passphrase
="12345678")
54 params
['wpa_key_mgmt'] = 'SAE'
55 hapd
= hostapd
.add_ap(apdev
[0], params
)
57 dev
[0].request("SET sae_groups 19")
60 password
= "12345678-" + str(i
)
61 hapd
.set("wpa_passphrase", password
)
62 dev
[0].connect("test-sae", psk
=password
, key_mgmt
="SAE",
64 dev
[0].request("REMOVE_NETWORK all")
65 dev
[0].wait_disconnected()
68 def test_sae_password_ffc(dev
, apdev
):
69 """SAE with number of different passwords (FFC)"""
70 if "SAE" not in dev
[0].get_capability("auth_alg"):
71 raise HwsimSkip("SAE not supported")
72 params
= hostapd
.wpa2_params(ssid
="test-sae",
73 passphrase
="12345678")
74 params
['wpa_key_mgmt'] = 'SAE'
75 params
['sae_groups'] = '22'
76 hapd
= hostapd
.add_ap(apdev
[0], params
)
78 dev
[0].request("SET sae_groups 22")
81 password
= "12345678-" + str(i
)
82 hapd
.set("wpa_passphrase", password
)
83 dev
[0].connect("test-sae", psk
=password
, key_mgmt
="SAE",
85 dev
[0].request("REMOVE_NETWORK all")
86 dev
[0].wait_disconnected()
89 def test_sae_pmksa_caching(dev
, apdev
):
90 """SAE and PMKSA caching"""
91 if "SAE" not in dev
[0].get_capability("auth_alg"):
92 raise HwsimSkip("SAE not supported")
93 params
= hostapd
.wpa2_params(ssid
="test-sae",
94 passphrase
="12345678")
95 params
['wpa_key_mgmt'] = 'SAE'
96 hapd
= hostapd
.add_ap(apdev
[0], params
)
98 dev
[0].request("SET sae_groups ")
99 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
101 ev
= hapd
.wait_event([ "AP-STA-CONNECTED" ], timeout
=5)
103 raise Exception("No connection event received from hostapd")
104 dev
[0].request("DISCONNECT")
105 dev
[0].wait_disconnected()
106 dev
[0].request("RECONNECT")
107 dev
[0].wait_connected(timeout
=15, error
="Reconnect timed out")
108 if dev
[0].get_status_field('sae_group') is not None:
109 raise Exception("SAE group claimed to have been used")
112 def test_sae_pmksa_caching_disabled(dev
, apdev
):
113 """SAE and PMKSA caching disabled"""
114 if "SAE" not in dev
[0].get_capability("auth_alg"):
115 raise HwsimSkip("SAE not supported")
116 params
= hostapd
.wpa2_params(ssid
="test-sae",
117 passphrase
="12345678")
118 params
['wpa_key_mgmt'] = 'SAE'
119 params
['disable_pmksa_caching'] = '1'
120 hapd
= hostapd
.add_ap(apdev
[0], params
)
122 dev
[0].request("SET sae_groups ")
123 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
125 ev
= hapd
.wait_event([ "AP-STA-CONNECTED" ], timeout
=5)
127 raise Exception("No connection event received from hostapd")
128 dev
[0].request("DISCONNECT")
129 dev
[0].wait_disconnected()
130 dev
[0].request("RECONNECT")
131 dev
[0].wait_connected(timeout
=15, error
="Reconnect timed out")
132 if dev
[0].get_status_field('sae_group') != '19':
133 raise Exception("Expected default SAE group not used")
135 def test_sae_groups(dev
, apdev
):
136 """SAE with all supported groups"""
137 if "SAE" not in dev
[0].get_capability("auth_alg"):
138 raise HwsimSkip("SAE not supported")
139 # This is the full list of supported groups, but groups 14-16 (2048-4096 bit
140 # MODP) and group 21 (521-bit random ECP group) are a bit too slow on some
141 # VMs and can result in hitting the mac80211 authentication timeout, so
142 # allow them to fail and just report such failures in the debug log.
143 sae_groups
= [ 19, 25, 26, 20, 21, 2, 5, 14, 15, 16, 22, 23, 24 ]
144 tls
= dev
[0].request("GET tls_library")
145 if tls
.startswith("OpenSSL") and "build=OpenSSL 1.0.2" in tls
and "run=OpenSSL 1.0.2" in tls
:
146 logger
.info("Add Brainpool EC groups since OpenSSL is new enough")
147 sae_groups
+= [ 27, 28, 29, 30 ]
148 heavy_groups
= [ 14, 15, 16 ]
149 groups
= [str(g
) for g
in sae_groups
]
150 params
= hostapd
.wpa2_params(ssid
="test-sae-groups",
151 passphrase
="12345678")
152 params
['wpa_key_mgmt'] = 'SAE'
153 params
['sae_groups'] = ' '.join(groups
)
154 hostapd
.add_ap(apdev
[0], params
)
157 logger
.info("Testing SAE group " + g
)
158 dev
[0].request("SET sae_groups " + g
)
159 id = dev
[0].connect("test-sae-groups", psk
="12345678", key_mgmt
="SAE",
160 scan_freq
="2412", wait_connect
=False)
161 if int(g
) in heavy_groups
:
162 ev
= dev
[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=5)
164 logger
.info("No connection with heavy SAE group %s did not connect - likely hitting timeout in mac80211" % g
)
165 dev
[0].remove_network(id)
167 dev
[0].dump_monitor()
169 logger
.info("Connection with heavy SAE group " + g
)
171 ev
= dev
[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout
=10)
173 if "BoringSSL" in tls
and int(g
) in [ 25 ]:
174 logger
.info("Ignore connection failure with group " + g
+ " with BoringSSL")
175 dev
[0].remove_network(id)
176 dev
[0].dump_monitor()
178 raise Exception("Connection timed out with group " + g
)
179 if dev
[0].get_status_field('sae_group') != g
:
180 raise Exception("Expected SAE group not used")
181 dev
[0].remove_network(id)
182 dev
[0].wait_disconnected()
183 dev
[0].dump_monitor()
186 def test_sae_group_nego(dev
, apdev
):
187 """SAE group negotiation"""
188 if "SAE" not in dev
[0].get_capability("auth_alg"):
189 raise HwsimSkip("SAE not supported")
190 params
= hostapd
.wpa2_params(ssid
="test-sae-group-nego",
191 passphrase
="12345678")
192 params
['wpa_key_mgmt'] = 'SAE'
193 params
['sae_groups'] = '19'
194 hostapd
.add_ap(apdev
[0], params
)
196 dev
[0].request("SET sae_groups 25 26 20 19")
197 dev
[0].connect("test-sae-group-nego", psk
="12345678", key_mgmt
="SAE",
199 if dev
[0].get_status_field('sae_group') != '19':
200 raise Exception("Expected SAE group not used")
203 def test_sae_anti_clogging(dev
, apdev
):
204 """SAE anti clogging"""
205 if "SAE" not in dev
[0].get_capability("auth_alg"):
206 raise HwsimSkip("SAE not supported")
207 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
208 params
['wpa_key_mgmt'] = 'SAE'
209 params
['sae_anti_clogging_threshold'] = '1'
210 hostapd
.add_ap(apdev
[0], params
)
212 dev
[0].request("SET sae_groups ")
213 dev
[1].request("SET sae_groups ")
215 for i
in range(0, 2):
216 dev
[i
].scan(freq
="2412")
217 id[i
] = dev
[i
].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
218 scan_freq
="2412", only_add_network
=True)
219 for i
in range(0, 2):
220 dev
[i
].select_network(id[i
])
221 for i
in range(0, 2):
222 dev
[i
].wait_connected(timeout
=10)
224 def test_sae_forced_anti_clogging(dev
, apdev
):
225 """SAE anti clogging (forced)"""
226 if "SAE" not in dev
[0].get_capability("auth_alg"):
227 raise HwsimSkip("SAE not supported")
228 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
229 params
['wpa_key_mgmt'] = 'SAE WPA-PSK'
230 params
['sae_anti_clogging_threshold'] = '0'
231 hostapd
.add_ap(apdev
[0], params
)
232 dev
[2].connect("test-sae", psk
="12345678", scan_freq
="2412")
233 for i
in range(0, 2):
234 dev
[i
].request("SET sae_groups ")
235 dev
[i
].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
238 def test_sae_mixed(dev
, apdev
):
239 """Mixed SAE and non-SAE network"""
240 if "SAE" not in dev
[0].get_capability("auth_alg"):
241 raise HwsimSkip("SAE not supported")
242 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
243 params
['wpa_key_mgmt'] = 'SAE WPA-PSK'
244 params
['sae_anti_clogging_threshold'] = '0'
245 hostapd
.add_ap(apdev
[0], params
)
247 dev
[2].connect("test-sae", psk
="12345678", scan_freq
="2412")
248 for i
in range(0, 2):
249 dev
[i
].request("SET sae_groups ")
250 dev
[i
].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
254 def test_sae_missing_password(dev
, apdev
):
255 """SAE and missing password"""
256 if "SAE" not in dev
[0].get_capability("auth_alg"):
257 raise HwsimSkip("SAE not supported")
258 params
= hostapd
.wpa2_params(ssid
="test-sae",
259 passphrase
="12345678")
260 params
['wpa_key_mgmt'] = 'SAE'
261 hapd
= hostapd
.add_ap(apdev
[0], params
)
263 dev
[0].request("SET sae_groups ")
264 id = dev
[0].connect("test-sae",
265 raw_psk
="46b4a73b8a951ad53ebd2e0afdb9c5483257edd4c21d12b7710759da70945858",
266 key_mgmt
="SAE", scan_freq
="2412", wait_connect
=False)
267 ev
= dev
[0].wait_event(['CTRL-EVENT-SSID-TEMP-DISABLED'], timeout
=10)
269 raise Exception("Invalid network not temporarily disabled")
272 def test_sae_key_lifetime_in_memory(dev
, apdev
, params
):
273 """SAE and key lifetime in memory"""
274 if "SAE" not in dev
[0].get_capability("auth_alg"):
275 raise HwsimSkip("SAE not supported")
276 password
= "5ad144a7c1f5a5503baa6fa01dabc15b1843e8c01662d78d16b70b5cd23cf8b"
277 p
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
=password
)
278 p
['wpa_key_mgmt'] = 'SAE'
279 hapd
= hostapd
.add_ap(apdev
[0], p
)
281 pid
= find_wpas_process(dev
[0])
283 dev
[0].request("SET sae_groups ")
284 id = dev
[0].connect("test-sae", psk
=password
, key_mgmt
="SAE",
287 # The decrypted copy of GTK is freed only after the CTRL-EVENT-CONNECTED
288 # event has been delivered, so verify that wpa_supplicant has returned to
289 # eloop before reading process memory.
292 buf
= read_process_memory(pid
, password
)
294 dev
[0].request("DISCONNECT")
295 dev
[0].wait_disconnected()
304 with
open(os
.path
.join(params
['logdir'], 'log0'), 'r') as f
:
305 for l
in f
.readlines():
306 if "SAE: k - hexdump" in l
:
307 val
= l
.strip().split(':')[3].replace(' ', '')
308 sae_k
= binascii
.unhexlify(val
)
309 if "SAE: keyseed - hexdump" in l
:
310 val
= l
.strip().split(':')[3].replace(' ', '')
311 sae_keyseed
= binascii
.unhexlify(val
)
312 if "SAE: KCK - hexdump" in l
:
313 val
= l
.strip().split(':')[3].replace(' ', '')
314 sae_kck
= binascii
.unhexlify(val
)
315 if "SAE: PMK - hexdump" in l
:
316 val
= l
.strip().split(':')[3].replace(' ', '')
317 pmk
= binascii
.unhexlify(val
)
318 if "WPA: PTK - hexdump" in l
:
319 val
= l
.strip().split(':')[3].replace(' ', '')
320 ptk
= binascii
.unhexlify(val
)
321 if "WPA: Group Key - hexdump" in l
:
322 val
= l
.strip().split(':')[3].replace(' ', '')
323 gtk
= binascii
.unhexlify(val
)
324 if not sae_k
or not sae_keyseed
or not sae_kck
or not pmk
or not ptk
or not gtk
:
325 raise Exception("Could not find keys from debug log")
327 raise Exception("Unexpected GTK length")
333 fname
= os
.path
.join(params
['logdir'],
334 'sae_key_lifetime_in_memory.memctx-')
336 logger
.info("Checking keys in memory while associated")
337 get_key_locations(buf
, password
, "Password")
338 get_key_locations(buf
, pmk
, "PMK")
339 if password
not in buf
:
340 raise HwsimSkip("Password not found while associated")
342 raise HwsimSkip("PMK not found while associated")
344 raise Exception("KCK not found while associated")
346 raise Exception("KEK not found while associated")
348 raise Exception("TK found from memory")
350 get_key_locations(buf
, gtk
, "GTK")
351 raise Exception("GTK found from memory")
352 verify_not_present(buf
, sae_k
, fname
, "SAE(k)")
353 verify_not_present(buf
, sae_keyseed
, fname
, "SAE(keyseed)")
354 verify_not_present(buf
, sae_kck
, fname
, "SAE(KCK)")
356 logger
.info("Checking keys in memory after disassociation")
357 buf
= read_process_memory(pid
, password
)
359 # Note: Password is still present in network configuration
360 # Note: PMK is in PMKSA cache
362 get_key_locations(buf
, password
, "Password")
363 get_key_locations(buf
, pmk
, "PMK")
364 verify_not_present(buf
, kck
, fname
, "KCK")
365 verify_not_present(buf
, kek
, fname
, "KEK")
366 verify_not_present(buf
, tk
, fname
, "TK")
367 verify_not_present(buf
, gtk
, fname
, "GTK")
368 verify_not_present(buf
, sae_k
, fname
, "SAE(k)")
369 verify_not_present(buf
, sae_keyseed
, fname
, "SAE(keyseed)")
370 verify_not_present(buf
, sae_kck
, fname
, "SAE(KCK)")
372 dev
[0].request("PMKSA_FLUSH")
373 logger
.info("Checking keys in memory after PMKSA cache flush")
374 buf
= read_process_memory(pid
, password
)
375 get_key_locations(buf
, password
, "Password")
376 get_key_locations(buf
, pmk
, "PMK")
377 verify_not_present(buf
, pmk
, fname
, "PMK")
379 dev
[0].request("REMOVE_NETWORK all")
381 logger
.info("Checking keys in memory after network profile removal")
382 buf
= read_process_memory(pid
, password
)
384 get_key_locations(buf
, password
, "Password")
385 get_key_locations(buf
, pmk
, "PMK")
386 verify_not_present(buf
, password
, fname
, "password")
387 verify_not_present(buf
, pmk
, fname
, "PMK")
388 verify_not_present(buf
, kck
, fname
, "KCK")
389 verify_not_present(buf
, kek
, fname
, "KEK")
390 verify_not_present(buf
, tk
, fname
, "TK")
391 verify_not_present(buf
, gtk
, fname
, "GTK")
392 verify_not_present(buf
, sae_k
, fname
, "SAE(k)")
393 verify_not_present(buf
, sae_keyseed
, fname
, "SAE(keyseed)")
394 verify_not_present(buf
, sae_kck
, fname
, "SAE(KCK)")
397 def test_sae_oom_wpas(dev
, apdev
):
398 """SAE and OOM in wpa_supplicant"""
399 if "SAE" not in dev
[0].get_capability("auth_alg"):
400 raise HwsimSkip("SAE not supported")
401 params
= hostapd
.wpa2_params(ssid
="test-sae",
402 passphrase
="12345678")
403 params
['wpa_key_mgmt'] = 'SAE'
404 hapd
= hostapd
.add_ap(apdev
[0], params
)
406 dev
[0].request("SET sae_groups 25")
407 tls
= dev
[0].request("GET tls_library")
408 if "BoringSSL" in tls
:
409 dev
[0].request("SET sae_groups 26")
410 with
alloc_fail(dev
[0], 1, "sae_set_group"):
411 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
413 dev
[0].request("REMOVE_NETWORK all")
415 dev
[0].request("SET sae_groups ")
416 with
alloc_fail(dev
[0], 2, "sae_set_group"):
417 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
419 dev
[0].request("REMOVE_NETWORK all")
421 with
alloc_fail(dev
[0], 1, "wpabuf_alloc;sme_auth_build_sae_commit"):
422 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
424 dev
[0].request("REMOVE_NETWORK all")
426 with
alloc_fail(dev
[0], 1, "wpabuf_alloc;sme_auth_build_sae_confirm"):
427 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
428 scan_freq
="2412", wait_connect
=False)
429 wait_fail_trigger(dev
[0], "GET_ALLOC_FAIL")
430 dev
[0].request("REMOVE_NETWORK all")
432 with
alloc_fail(dev
[0], 1, "=sme_authenticate"):
433 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
434 scan_freq
="2412", wait_connect
=False)
435 wait_fail_trigger(dev
[0], "GET_ALLOC_FAIL")
436 dev
[0].request("REMOVE_NETWORK all")
438 with
alloc_fail(dev
[0], 1, "radio_add_work;sme_authenticate"):
439 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
440 scan_freq
="2412", wait_connect
=False)
441 wait_fail_trigger(dev
[0], "GET_ALLOC_FAIL")
442 dev
[0].request("REMOVE_NETWORK all")
445 def test_sae_proto_ecc(dev
, apdev
):
446 """SAE protocol testing (ECC)"""
447 if "SAE" not in dev
[0].get_capability("auth_alg"):
448 raise HwsimSkip("SAE not supported")
449 params
= hostapd
.wpa2_params(ssid
="test-sae",
450 passphrase
="12345678")
451 params
['wpa_key_mgmt'] = 'SAE'
452 hapd
= hostapd
.add_ap(apdev
[0], params
)
453 bssid
= apdev
[0]['bssid']
455 dev
[0].request("SET sae_groups 19")
457 tests
= [ ("Confirm mismatch",
458 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
459 "0000800edebc3f260dc1fe7e0b20888af2b8a3316252ec37388a8504e25b73dc4240"),
460 ("Commit without even full cyclic group field",
464 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02",
466 ("Invalid commit scalar (0)",
467 "1300" + "0000000000000000000000000000000000000000000000000000000000000000" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
469 ("Invalid commit scalar (1)",
470 "1300" + "0000000000000000000000000000000000000000000000000000000000000001" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
472 ("Invalid commit scalar (> r)",
473 "1300" + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
475 ("Commit element not on curve",
476 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728d0000000000000000000000000000000000000000000000000000000000000000",
478 ("Invalid commit element (y coordinate > P)",
479 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
481 ("Invalid commit element (x coordinate > P)",
482 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
484 ("Different group in commit",
485 "1400" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
487 ("Too short confirm",
488 "1300" + "033d3635b39666ed427fd4a3e7d37acec2810afeaf1687f746a14163ff0e6d03" + "559cb8928db4ce4e3cbd6555e837591995e5ebe503ef36b503d9ca519d63728dd3c7c676b8e8081831b6bc3a64bdf136061a7de175e17d1965bfa41983ed02f8",
489 "0000800edebc3f260dc1fe7e0b20888af2b8a3316252ec37388a8504e25b73dc42")]
490 for (note
, commit
, confirm
) in tests
:
492 dev
[0].scan_for_bss(bssid
, freq
=2412)
493 hapd
.set("ext_mgmt_frame_handling", "1")
494 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
495 scan_freq
="2412", wait_connect
=False)
497 logger
.info("Commit")
498 for i
in range(0, 10):
501 raise Exception("MGMT RX wait timed out (commit)")
502 if req
['subtype'] == 11:
506 raise Exception("Authentication frame (commit) not received")
510 resp
['fc'] = req
['fc']
511 resp
['da'] = req
['sa']
512 resp
['sa'] = req
['da']
513 resp
['bssid'] = req
['bssid']
514 resp
['payload'] = binascii
.unhexlify("030001000000" + commit
)
518 logger
.info("Confirm")
519 for i
in range(0, 10):
522 raise Exception("MGMT RX wait timed out (confirm)")
523 if req
['subtype'] == 11:
527 raise Exception("Authentication frame (confirm) not received")
531 resp
['fc'] = req
['fc']
532 resp
['da'] = req
['sa']
533 resp
['sa'] = req
['da']
534 resp
['bssid'] = req
['bssid']
535 resp
['payload'] = binascii
.unhexlify("030002000000" + confirm
)
539 dev
[0].request("REMOVE_NETWORK all")
540 hapd
.set("ext_mgmt_frame_handling", "0")
544 def test_sae_proto_ffc(dev
, apdev
):
545 """SAE protocol testing (FFC)"""
546 if "SAE" not in dev
[0].get_capability("auth_alg"):
547 raise HwsimSkip("SAE not supported")
548 params
= hostapd
.wpa2_params(ssid
="test-sae",
549 passphrase
="12345678")
550 params
['wpa_key_mgmt'] = 'SAE'
551 hapd
= hostapd
.add_ap(apdev
[0], params
)
552 bssid
= apdev
[0]['bssid']
554 dev
[0].request("SET sae_groups 2")
556 tests
= [ ("Confirm mismatch",
557 "0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "a8c00117493cdffa5dd671e934bc9cb1a69f39e25e9dd9cd9afd3aea2441a0f5491211c7ba50a753563f9ce943b043557cb71193b28e86ed9544f4289c471bf91b70af5c018cf4663e004165b0fd0bc1d8f3f78adf42eee92bcbc55246fd3ee9f107ab965dc7d4986f23eb71d616ebfe6bfe0a6c1ac5dc1718acee17c9a17486",
558 "0000f3116a9731f1259622e3eb55d4b3b50ba16f8c5f5565b28e609b180c51460251"),
560 "0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "a8c00117493cdffa5dd671e934bc9cb1a69f39e25e9dd9cd9afd3aea2441a0f5491211c7ba50a753563f9ce943b043557cb71193b28e86ed9544f4289c471bf91b70af5c018cf4663e004165b0fd0bc1d8f3f78adf42eee92bcbc55246fd3ee9f107ab965dc7d4986f23eb71d616ebfe6bfe0a6c1ac5dc1718acee17c9a174",
562 ("Invalid element (0) in commit",
563 "0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
565 ("Invalid element (1) in commit",
566 "0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
568 ("Invalid element (> P) in commit",
569 "0200" + "0c70519d874e3e4930a917cc5e17ea7a26028211159f217bab28b8d6c56691805e49f03249b2c6e22c7c9f86b30e04ccad2deedd5e5108ae07b737c00001c59cd0eb08b1dfc7f1b06a1542e2b6601a963c066e0c65940983a03917ae57a101ce84b5cbbc76ff33ebb990aac2e54aa0f0ab6ec0a58113d927683502b2cb2347d2" + "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
571 for (note
, commit
, confirm
) in tests
:
573 dev
[0].scan_for_bss(bssid
, freq
=2412)
574 hapd
.set("ext_mgmt_frame_handling", "1")
575 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
576 scan_freq
="2412", wait_connect
=False)
578 logger
.info("Commit")
579 for i
in range(0, 10):
582 raise Exception("MGMT RX wait timed out (commit)")
583 if req
['subtype'] == 11:
587 raise Exception("Authentication frame (commit) not received")
591 resp
['fc'] = req
['fc']
592 resp
['da'] = req
['sa']
593 resp
['sa'] = req
['da']
594 resp
['bssid'] = req
['bssid']
595 resp
['payload'] = binascii
.unhexlify("030001000000" + commit
)
599 logger
.info("Confirm")
600 for i
in range(0, 10):
603 raise Exception("MGMT RX wait timed out (confirm)")
604 if req
['subtype'] == 11:
608 raise Exception("Authentication frame (confirm) not received")
612 resp
['fc'] = req
['fc']
613 resp
['da'] = req
['sa']
614 resp
['sa'] = req
['da']
615 resp
['bssid'] = req
['bssid']
616 resp
['payload'] = binascii
.unhexlify("030002000000" + confirm
)
620 dev
[0].request("REMOVE_NETWORK all")
621 hapd
.set("ext_mgmt_frame_handling", "0")
624 def test_sae_proto_hostapd(dev
, apdev
):
625 """SAE protocol testing with hostapd"""
626 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
627 params
['wpa_key_mgmt'] = 'SAE'
628 params
['sae_groups'] = "19 65535"
629 hapd
= hostapd
.add_ap(apdev
[0], params
)
630 hapd
.set("ext_mgmt_frame_handling", "1")
631 bssid
= hapd
.own_addr().replace(':', '')
632 addr
= "020000000000"
633 addr2
= "020000000001"
634 hdr
= "b0003a01" + bssid
+ addr
+ bssid
+ "1000"
635 hdr2
= "b0003a01" + bssid
+ addr2
+ bssid
+ "1000"
637 scalar
= "f7df19f4a7fef1d3b895ea1de150b7c5a7a705c8ebb31a52b623e0057908bd93"
638 element_x
= "21931572027f2e953e2a49fab3d992944102cc95aa19515fc068b394fb25ae3c"
639 element_y
= "cb4eeb94d7b0b789abfdb73a67ab9d6d5efa94dd553e0e724a6289821cbce530"
640 hapd
.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr
+ "030001000000" + group
+ scalar
+ element_x
+ element_y
)
641 # "SAE: Not enough data for scalar"
642 hapd
.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr
+ "030001000000" + group
+ scalar
[:-2])
643 # "SAE: Do not allow group to be changed"
644 hapd
.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr
+ "030001000000" + "ffff" + scalar
[:-2])
645 # "SAE: Unsupported Finite Cyclic Group 65535"
646 hapd
.request("MGMT_RX_PROCESS freq=2412 datarate=0 ssi_signal=-30 frame=" + hdr2
+ "030001000000" + "ffff" + scalar
[:-2])
649 def test_sae_no_ffc_by_default(dev
, apdev
):
650 """SAE and default groups rejecting FFC"""
651 if "SAE" not in dev
[0].get_capability("auth_alg"):
652 raise HwsimSkip("SAE not supported")
653 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
654 params
['wpa_key_mgmt'] = 'SAE'
655 hapd
= hostapd
.add_ap(apdev
[0], params
)
657 dev
[0].request("SET sae_groups 5")
658 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE", scan_freq
="2412",
660 ev
= dev
[0].wait_event(["SME: Trying to authenticate"], timeout
=3)
662 raise Exception("Did not try to authenticate")
663 ev
= dev
[0].wait_event(["SME: Trying to authenticate"], timeout
=3)
665 raise Exception("Did not try to authenticate (2)")
666 dev
[0].request("REMOVE_NETWORK all")
668 def sae_reflection_attack(apdev
, dev
, group
):
669 if "SAE" not in dev
.get_capability("auth_alg"):
670 raise HwsimSkip("SAE not supported")
671 params
= hostapd
.wpa2_params(ssid
="test-sae",
672 passphrase
="no-knowledge-of-passphrase")
673 params
['wpa_key_mgmt'] = 'SAE'
674 hapd
= hostapd
.add_ap(apdev
, params
)
675 bssid
= apdev
['bssid']
677 dev
.scan_for_bss(bssid
, freq
=2412)
678 hapd
.set("ext_mgmt_frame_handling", "1")
680 dev
.request("SET sae_groups %d" % group
)
681 dev
.connect("test-sae", psk
="reflection-attack", key_mgmt
="SAE",
682 scan_freq
="2412", wait_connect
=False)
685 for i
in range(0, 10):
688 raise Exception("MGMT RX wait timed out")
689 if req
['subtype'] == 11:
693 raise Exception("Authentication frame not received")
696 resp
['fc'] = req
['fc']
697 resp
['da'] = req
['sa']
698 resp
['sa'] = req
['da']
699 resp
['bssid'] = req
['bssid']
700 resp
['payload'] = req
['payload']
704 req
= hapd
.mgmt_rx(timeout
=0.5)
706 if req
['subtype'] == 11:
707 raise Exception("Unexpected Authentication frame seen")
710 def test_sae_reflection_attack_ecc(dev
, apdev
):
711 """SAE reflection attack (ECC)"""
712 sae_reflection_attack(apdev
[0], dev
[0], 19)
715 def test_sae_reflection_attack_ffc(dev
, apdev
):
716 """SAE reflection attack (FFC)"""
717 sae_reflection_attack(apdev
[0], dev
[0], 5)
720 def test_sae_anti_clogging_proto(dev
, apdev
):
721 """SAE anti clogging protocol testing"""
722 if "SAE" not in dev
[0].get_capability("auth_alg"):
723 raise HwsimSkip("SAE not supported")
724 params
= hostapd
.wpa2_params(ssid
="test-sae",
725 passphrase
="no-knowledge-of-passphrase")
726 params
['wpa_key_mgmt'] = 'SAE'
727 hapd
= hostapd
.add_ap(apdev
[0], params
)
728 bssid
= apdev
[0]['bssid']
730 dev
[0].scan_for_bss(bssid
, freq
=2412)
731 hapd
.set("ext_mgmt_frame_handling", "1")
733 dev
[0].request("SET sae_groups ")
734 dev
[0].connect("test-sae", psk
="anti-cloggign", key_mgmt
="SAE",
735 scan_freq
="2412", wait_connect
=False)
738 for i
in range(0, 10):
741 raise Exception("MGMT RX wait timed out")
742 if req
['subtype'] == 11:
746 raise Exception("Authentication frame not received")
749 resp
['fc'] = req
['fc']
750 resp
['da'] = req
['sa']
751 resp
['sa'] = req
['da']
752 resp
['bssid'] = req
['bssid']
753 resp
['payload'] = binascii
.unhexlify("030001004c00" + "ffff00")
756 # Confirm (not received due to DH group being rejected)
757 req
= hapd
.mgmt_rx(timeout
=0.5)
759 if req
['subtype'] == 11:
760 raise Exception("Unexpected Authentication frame seen")
763 def test_sae_no_random(dev
, apdev
):
764 """SAE and no random numbers available"""
765 if "SAE" not in dev
[0].get_capability("auth_alg"):
766 raise HwsimSkip("SAE not supported")
767 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
768 params
['wpa_key_mgmt'] = 'SAE'
769 hapd
= hostapd
.add_ap(apdev
[0], params
)
771 dev
[0].request("SET sae_groups ")
772 tests
= [ (1, "os_get_random;sae_get_rand"),
773 (1, "os_get_random;get_rand_1_to_p_1"),
774 (1, "os_get_random;get_random_qr_qnr"),
775 (1, "os_get_random;sae_derive_pwe_ecc") ]
776 for count
, func
in tests
:
777 with
fail_test(dev
[0], count
, func
):
778 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
780 dev
[0].request("REMOVE_NETWORK all")
781 dev
[0].wait_disconnected()
784 def test_sae_pwe_failure(dev
, apdev
):
785 """SAE and pwe failure"""
786 if "SAE" not in dev
[0].get_capability("auth_alg"):
787 raise HwsimSkip("SAE not supported")
788 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
789 params
['wpa_key_mgmt'] = 'SAE'
790 params
['sae_groups'] = '19 5'
791 hapd
= hostapd
.add_ap(apdev
[0], params
)
793 dev
[0].request("SET sae_groups 19")
794 with
fail_test(dev
[0], 1, "hmac_sha256_vector;sae_derive_pwe_ecc"):
795 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
797 dev
[0].request("REMOVE_NETWORK all")
798 dev
[0].wait_disconnected()
799 with
fail_test(dev
[0], 1, "sae_test_pwd_seed_ecc"):
800 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
802 dev
[0].request("REMOVE_NETWORK all")
803 dev
[0].wait_disconnected()
805 dev
[0].request("SET sae_groups 5")
806 with
fail_test(dev
[0], 1, "hmac_sha256_vector;sae_derive_pwe_ffc"):
807 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
809 dev
[0].request("REMOVE_NETWORK all")
810 dev
[0].wait_disconnected()
812 dev
[0].request("SET sae_groups 5")
813 with
fail_test(dev
[0], 1, "sae_test_pwd_seed_ffc"):
814 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
816 dev
[0].request("REMOVE_NETWORK all")
817 dev
[0].wait_disconnected()
818 with
fail_test(dev
[0], 2, "sae_test_pwd_seed_ffc"):
819 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
821 dev
[0].request("REMOVE_NETWORK all")
822 dev
[0].wait_disconnected()
825 def test_sae_bignum_failure(dev
, apdev
):
826 """SAE and bignum failure"""
827 if "SAE" not in dev
[0].get_capability("auth_alg"):
828 raise HwsimSkip("SAE not supported")
829 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
830 params
['wpa_key_mgmt'] = 'SAE'
831 params
['sae_groups'] = '19 5 22'
832 hapd
= hostapd
.add_ap(apdev
[0], params
)
834 dev
[0].request("SET sae_groups 19")
835 tests
= [ (1, "crypto_bignum_init_set;get_rand_1_to_p_1"),
836 (1, "crypto_bignum_init;is_quadratic_residue_blind"),
837 (1, "crypto_bignum_mulmod;is_quadratic_residue_blind"),
838 (2, "crypto_bignum_mulmod;is_quadratic_residue_blind"),
839 (3, "crypto_bignum_mulmod;is_quadratic_residue_blind"),
840 (1, "crypto_bignum_legendre;is_quadratic_residue_blind"),
841 (1, "crypto_bignum_init_set;sae_test_pwd_seed_ecc"),
842 (1, "crypto_ec_point_compute_y_sqr;sae_test_pwd_seed_ecc"),
843 (1, "crypto_bignum_init_set;get_random_qr_qnr"),
844 (1, "crypto_bignum_to_bin;sae_derive_pwe_ecc"),
845 (1, "crypto_ec_point_init;sae_derive_pwe_ecc"),
846 (1, "crypto_ec_point_solve_y_coord;sae_derive_pwe_ecc"),
847 (1, "crypto_ec_point_init;sae_derive_commit_element_ecc"),
848 (1, "crypto_ec_point_mul;sae_derive_commit_element_ecc"),
849 (1, "crypto_ec_point_invert;sae_derive_commit_element_ecc"),
850 (1, "crypto_bignum_init;=sae_derive_commit"),
851 (1, "crypto_ec_point_init;sae_derive_k_ecc"),
852 (1, "crypto_ec_point_mul;sae_derive_k_ecc"),
853 (1, "crypto_ec_point_add;sae_derive_k_ecc"),
854 (2, "crypto_ec_point_mul;sae_derive_k_ecc"),
855 (1, "crypto_ec_point_to_bin;sae_derive_k_ecc"),
856 (1, "crypto_bignum_legendre;get_random_qr_qnr"),
857 (1, "sha256_prf;sae_derive_keys"),
858 (1, "crypto_bignum_init;sae_derive_keys"),
859 (1, "crypto_bignum_init_set;sae_parse_commit_scalar"),
860 (1, "crypto_bignum_to_bin;sae_parse_commit_element_ecc"),
861 (1, "crypto_ec_point_from_bin;sae_parse_commit_element_ecc") ]
862 for count
, func
in tests
:
863 with
fail_test(dev
[0], count
, func
):
864 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
865 scan_freq
="2412", wait_connect
=False)
866 wait_fail_trigger(dev
[0], "GET_FAIL")
867 dev
[0].request("REMOVE_NETWORK all")
869 dev
[0].request("SET sae_groups 5")
870 tests
= [ (1, "crypto_bignum_init_set;sae_set_group"),
871 (2, "crypto_bignum_init_set;sae_set_group"),
872 (1, "crypto_bignum_init_set;sae_get_rand"),
873 (1, "crypto_bignum_init_set;sae_test_pwd_seed_ffc"),
874 (1, "crypto_bignum_exptmod;sae_test_pwd_seed_ffc"),
875 (1, "crypto_bignum_init;sae_derive_pwe_ffc"),
876 (1, "crypto_bignum_init;sae_derive_commit_element_ffc"),
877 (1, "crypto_bignum_exptmod;sae_derive_commit_element_ffc"),
878 (1, "crypto_bignum_inverse;sae_derive_commit_element_ffc"),
879 (1, "crypto_bignum_init;sae_derive_k_ffc"),
880 (1, "crypto_bignum_exptmod;sae_derive_k_ffc"),
881 (1, "crypto_bignum_mulmod;sae_derive_k_ffc"),
882 (2, "crypto_bignum_exptmod;sae_derive_k_ffc"),
883 (1, "crypto_bignum_to_bin;sae_derive_k_ffc"),
884 (1, "crypto_bignum_init_set;sae_parse_commit_element_ffc"),
885 (1, "crypto_bignum_init;sae_parse_commit_element_ffc"),
886 (2, "crypto_bignum_init_set;sae_parse_commit_element_ffc"),
887 (1, "crypto_bignum_exptmod;sae_parse_commit_element_ffc") ]
888 for count
, func
in tests
:
889 with
fail_test(dev
[0], count
, func
):
890 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
891 scan_freq
="2412", wait_connect
=False)
892 wait_fail_trigger(dev
[0], "GET_FAIL")
893 dev
[0].request("REMOVE_NETWORK all")
895 dev
[0].request("SET sae_groups 22")
896 tests
= [ (1, "crypto_bignum_init_set;sae_test_pwd_seed_ffc"),
897 (1, "crypto_bignum_sub;sae_test_pwd_seed_ffc"),
898 (1, "crypto_bignum_div;sae_test_pwd_seed_ffc") ]
899 for count
, func
in tests
:
900 with
fail_test(dev
[0], count
, func
):
901 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
902 scan_freq
="2412", wait_connect
=False)
903 wait_fail_trigger(dev
[0], "GET_FAIL")
904 dev
[0].request("REMOVE_NETWORK all")
906 def test_sae_invalid_anti_clogging_token_req(dev
, apdev
):
907 """SAE and invalid anti-clogging token request"""
908 if "SAE" not in dev
[0].get_capability("auth_alg"):
909 raise HwsimSkip("SAE not supported")
910 params
= hostapd
.wpa2_params(ssid
="test-sae", passphrase
="12345678")
911 params
['wpa_key_mgmt'] = 'SAE'
912 hapd
= hostapd
.add_ap(apdev
[0], params
)
913 bssid
= apdev
[0]['bssid']
915 dev
[0].request("SET sae_groups 19")
916 dev
[0].scan_for_bss(bssid
, freq
=2412)
917 hapd
.set("ext_mgmt_frame_handling", "1")
918 dev
[0].connect("test-sae", psk
="12345678", key_mgmt
="SAE",
919 scan_freq
="2412", wait_connect
=False)
920 ev
= dev
[0].wait_event(["SME: Trying to authenticate"])
922 raise Exception("No authentication attempt seen")
923 dev
[0].dump_monitor()
925 for i
in range(0, 10):
928 raise Exception("MGMT RX wait timed out (commit)")
929 if req
['subtype'] == 11:
933 raise Exception("Authentication frame (commit) not received")
937 resp
['fc'] = req
['fc']
938 resp
['da'] = req
['sa']
939 resp
['sa'] = req
['da']
940 resp
['bssid'] = req
['bssid']
941 resp
['payload'] = binascii
.unhexlify("030001004c0013")
944 ev
= dev
[0].wait_event(["SME: Trying to authenticate"])
946 raise Exception("No authentication attempt seen")
947 dev
[0].dump_monitor()
949 for i
in range(0, 10):
952 raise Exception("MGMT RX wait timed out (commit) (2)")
953 if req
['subtype'] == 11:
957 raise Exception("Authentication frame (commit) not received (2)")
961 resp
['fc'] = req
['fc']
962 resp
['da'] = req
['sa']
963 resp
['sa'] = req
['da']
964 resp
['bssid'] = req
['bssid']
965 resp
['payload'] = binascii
.unhexlify("030001000100")
968 ev
= dev
[0].wait_event(["SME: Trying to authenticate"])
970 raise Exception("No authentication attempt seen")
971 dev
[0].dump_monitor()
973 dev
[0].request("DISCONNECT")