Lines Matching refs:dev

37 def check_dpp_capab(dev, brainpool=False, min_ver=1):  argument
38 if "UNKNOWN COMMAND" in dev.request("DPP_BOOTSTRAP_GET_URI 0"):
41 tls = dev.request("GET tls_library")
44 capa = dev.request("GET_CAPABILITY dpp")
52 def wait_dpp_fail(dev, expected=None): argument
53 ev = dev.wait_event(["DPP-FAIL"], timeout=5)
59 def test_dpp_qr_code_parsing(dev, apdev): argument
61 check_dpp_capab(dev[0])
75 id.append(dev[0].dpp_qr_code(uri))
77 uri2 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id[-1])
96 res = dev[0].request("DPP_QR_CODE " + t)
104 if "FAIL" not in dev[0].request("DPP_BOOTSTRAP_REMOVE 12345678"):
106 if "OK" not in dev[0].request("DPP_BOOTSTRAP_REMOVE %d" % id[1]):
109 id = dev[0].dpp_bootstrap_gen()
110 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
113 dev[0].dpp_qr_code(uri)
115 id = dev[0].dpp_bootstrap_gen(chan="81/1,115/36", mac="010203040506",
117 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
120 dev[0].dpp_qr_code(uri)
122 def test_dpp_uri_version(dev, apdev): argument
124 check_dpp_capab(dev[0], min_ver=2)
126 id0 = dev[0].dpp_bootstrap_gen()
127 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
130 id1 = dev[0].dpp_qr_code(uri)
131 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
132 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id1)
134 capa = dev[0].request("GET_CAPABILITY dpp")
141 dev[0].set("dpp_version_override", "1")
142 id0 = dev[0].dpp_bootstrap_gen()
143 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
146 id1 = dev[0].dpp_qr_code(uri)
147 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
148 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id1)
153 def test_dpp_uri_supported_curves(dev, apdev): argument
155 check_dpp_capab(dev[0], min_ver=3)
169 id0 = dev[0].dpp_bootstrap_gen(supported_curves=t[0])
170 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
175 id1 = dev[0].dpp_qr_code(uri)
176 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
177 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id1)
182 def test_dpp_uri_host(dev, apdev): argument
184 check_dpp_capab(dev[0], min_ver=3)
193 id0 = dev[0].dpp_bootstrap_gen(host=t[0])
194 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
199 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id0)
204 def test_dpp_qr_code_parsing_fail(dev, apdev): argument
206 check_dpp_capab(dev[0])
207 with alloc_fail(dev[0], 1, "dpp_parse_uri_info"):
208 …if "FAIL" not in dev[0].request("DPP_QR_CODE DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj…
211 with alloc_fail(dev[0], 1, "dpp_parse_uri_pk"):
212 …if "FAIL" not in dev[0].request("DPP_QR_CODE DPP:K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIR…
215 with fail_test(dev[0], 1, "dpp_parse_uri_pk"):
216 …if "FAIL" not in dev[0].request("DPP_QR_CODE DPP:K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgADURzxmttZoIR…
219 with alloc_fail(dev[0], 1, "dpp_parse_uri"):
220 …if "FAIL" not in dev[0].request("DPP_QR_CODE DPP:I:SN=4774LH2b4044;M:010203040506;K:MDkwEwYHKoZIzj…
230 def test_dpp_qr_code_curves(dev, apdev): argument
232 check_dpp_capab(dev[0])
237 id = dev[0].dpp_bootstrap_gen(key=hex)
238 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
244 def test_dpp_qr_code_curves_brainpool(dev, apdev): argument
246 check_dpp_capab(dev[0], brainpool=True)
251 id = dev[0].dpp_bootstrap_gen(key=hex)
252 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
258 def test_dpp_qr_code_unsupported_curve(dev, apdev): argument
260 check_dpp_capab(dev[0])
262 id = dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode curve=unsupported")
269 id = dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode key=" + hex)
273 def test_dpp_qr_code_keygen_fail(dev, apdev): argument
275 check_dpp_capab(dev[0])
277 with alloc_fail(dev[0], 1,
279 if "FAIL" not in dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode"):
282 with alloc_fail(dev[0], 1, "base64_gen_encode;dpp_keygen"):
283 if "FAIL" not in dev[0].request("DPP_BOOTSTRAP_GEN type=qrcode"):
286 def test_dpp_qr_code_curve_select(dev, apdev): argument
288 check_dpp_capab(dev[0], brainpool=True)
289 check_dpp_capab(dev[1], brainpool=True)
294 id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True, key=key)
295 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
302 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
309 dev[0].dpp_listen(2412)
310 dev[1].dpp_auth_init(uri=uri)
311 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
315 def test_dpp_qr_code_auth_broadcast(dev, apdev): argument
317 check_dpp_capab(dev[0])
318 check_dpp_capab(dev[1])
320 id0 = dev[0].dpp_bootstrap_gen(chan="81/1")
321 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
323 dev[0].dpp_listen(2412)
324 dev[1].dpp_auth_init(uri=uri0)
325 wait_auth_success(dev[0], dev[1], stop_responder=True, timeout=20)
327 def test_dpp_qr_code_auth_unicast(dev, apdev): argument
329 run_dpp_qr_code_auth_unicast(dev, apdev, None)
331 def test_dpp_qr_code_auth_unicast_ap_enrollee(dev, apdev): argument
333 run_dpp_qr_code_auth_unicast(dev, apdev, None, netrole="ap")
335 def run_dpp_configurator_enrollee(dev, apdev, conf_curve=None): argument
336 run_dpp_qr_code_auth_unicast(dev, apdev, None, netrole="configurator",
339 ev = dev[0].wait_event(["DPP-CONFIGURATOR-ID"], timeout=2)
343 def test_dpp_configurator_enrollee(dev, apdev): argument
345 run_dpp_configurator_enrollee(dev, apdev)
347 def test_dpp_configurator_enrollee_prime256v1(dev, apdev): argument
349 run_dpp_configurator_enrollee(dev, apdev, conf_curve="prime256v1")
351 def test_dpp_configurator_enrollee_secp384r1(dev, apdev): argument
353 run_dpp_configurator_enrollee(dev, apdev, conf_curve="secp384r1")
355 def test_dpp_configurator_enrollee_secp521r1(dev, apdev): argument
357 run_dpp_configurator_enrollee(dev, apdev, conf_curve="secp521r1")
359 def test_dpp_configurator_enrollee_brainpoolP256r1(dev, apdev): argument
361 run_dpp_configurator_enrollee(dev, apdev, conf_curve="brainpoolP256r1")
363 def test_dpp_configurator_enrollee_brainpoolP384r1(dev, apdev): argument
365 run_dpp_configurator_enrollee(dev, apdev, conf_curve="brainpoolP384r1")
367 def test_dpp_configurator_enrollee_brainpoolP512r1(dev, apdev): argument
369 run_dpp_configurator_enrollee(dev, apdev, conf_curve="brainpoolP512r1")
371 def test_dpp_configurator_enroll_conf(dev, apdev): argument
373 check_dpp_capab(dev[0], min_ver=2)
375 dev[0].set("dpp_config_processing", "2")
376 run_dpp_configurator_enroll_conf(dev, apdev)
378 dev[0].set("dpp_config_processing", "0", allow_fail=True)
380 def run_dpp_configurator_enroll_conf(dev, apdev): argument
381 run_dpp_qr_code_auth_unicast(dev, apdev, None, netrole="configurator",
384 ev = dev[0].wait_event(["DPP-CONFIGURATOR-ID"], timeout=2)
387 dev[1].reset()
388 dev[0].dump_monitor()
392 dev[0].set("dpp_configurator_params",
394 dev[0].dpp_listen(2412, role="configurator")
395 id0 = dev[0].dpp_bootstrap_gen(chan="81/1")
396 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
397 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
398 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1])
400 def test_dpp_qr_code_curve_prime256v1(dev, apdev): argument
402 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1")
404 def test_dpp_qr_code_curve_secp384r1(dev, apdev): argument
406 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1")
408 def test_dpp_qr_code_curve_secp521r1(dev, apdev): argument
410 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1")
412 def test_dpp_qr_code_curve_brainpoolP256r1(dev, apdev): argument
414 run_dpp_qr_code_auth_unicast(dev, apdev, "brainpoolP256r1")
416 def test_dpp_qr_code_curve_brainpoolP384r1(dev, apdev): argument
418 run_dpp_qr_code_auth_unicast(dev, apdev, "brainpoolP384r1")
420 def test_dpp_qr_code_curve_brainpoolP512r1(dev, apdev): argument
422 run_dpp_qr_code_auth_unicast(dev, apdev, "brainpoolP512r1")
424 def test_dpp_qr_code_set_key(dev, apdev): argument
426 …run_dpp_qr_code_auth_unicast(dev, apdev, None, key="30770201010420e5143ac74682cc6869a830e8f5301a5f…
428 def run_dpp_qr_code_auth_unicast(dev, apdev, curve, netrole=None, key=None, argument
437 check_dpp_capab(dev[0], brainpool, min_ver=min_ver)
438 check_dpp_capab(dev[1], brainpool, min_ver=min_ver)
440 conf_id = dev[1].dpp_configurator_add(curve=conf_curve,
447 id1 = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True, curve=curve)
448 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
449 id1c = dev[0].dpp_qr_code(uri1)
454 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True, curve=curve, key=key)
455 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
458 dev[0].dpp_listen(2412, netrole=netrole, qr=qr)
459 dev[1].dpp_auth_init(uri=uri0, extra=init_extra, configurator=conf_id,
461 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
467 def test_dpp_qr_code_auth_mutual(dev, apdev): argument
469 check_dpp_capab(dev[0])
470 check_dpp_capab(dev[1])
472 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
473 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
476 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
477 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
480 id0b = dev[0].dpp_qr_code(uri1b)
483 dev[0].dpp_listen(2412)
484 dev[1].dpp_auth_init(uri=uri0, own=id1b)
486 ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5)
492 wait_auth_success(dev[0], dev[1], stop_responder=True)
494 def test_dpp_qr_code_auth_mutual2(dev, apdev): argument
496 check_dpp_capab(dev[0])
497 check_dpp_capab(dev[1])
499 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
500 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
503 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
504 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
507 dev[0].dpp_listen(2412, qr="mutual")
508 dev[1].dpp_auth_init(uri=uri0, own=id1b)
510 ev = dev[1].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
513 ev = dev[0].wait_event(["DPP-SCAN-PEER-QR-CODE"], timeout=5)
517 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=1)
523 id0b = dev[0].dpp_qr_code(uri1b)
525 ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5)
531 wait_auth_success(dev[0], dev[1], stop_responder=True)
533 def test_dpp_qr_code_auth_mutual_p_256(dev, apdev): argument
535 run_dpp_qr_code_auth_mutual(dev, apdev, "P-256")
537 def test_dpp_qr_code_auth_mutual_p_384(dev, apdev): argument
539 run_dpp_qr_code_auth_mutual(dev, apdev, "P-384")
541 def test_dpp_qr_code_auth_mutual_p_521(dev, apdev): argument
543 run_dpp_qr_code_auth_mutual(dev, apdev, "P-521")
545 def test_dpp_qr_code_auth_mutual_bp_256(dev, apdev): argument
547 run_dpp_qr_code_auth_mutual(dev, apdev, "BP-256")
549 def test_dpp_qr_code_auth_mutual_bp_384(dev, apdev): argument
551 run_dpp_qr_code_auth_mutual(dev, apdev, "BP-384")
553 def test_dpp_qr_code_auth_mutual_bp_512(dev, apdev): argument
555 run_dpp_qr_code_auth_mutual(dev, apdev, "BP-512")
557 def run_dpp_qr_code_auth_mutual(dev, apdev, curve): argument
558 check_dpp_capab(dev[0], curve and "BP-" in curve)
559 check_dpp_capab(dev[1], curve and "BP-" in curve)
561 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True, curve=curve)
562 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
564 dev[0].dpp_listen(2412, qr="mutual")
565 dev[1].dpp_auth_init(uri=uri0)
567 ev = dev[1].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
572 ev = dev[0].wait_event(["DPP-SCAN-PEER-QR-CODE"], timeout=5)
576 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=1)
582 dev[0].dpp_qr_code(uri)
584 ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5)
590 wait_auth_success(dev[0], dev[1], stop_responder=True)
592 def test_dpp_auth_resp_retries(dev, apdev): argument
594 check_dpp_capab(dev[0])
595 check_dpp_capab(dev[1])
596 dev[0].set("dpp_resp_max_tries", "3")
597 dev[0].set("dpp_resp_retry_time", "100")
600 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
601 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
603 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
604 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
606 dev[0].dpp_listen(2412, qr="mutual")
607 dev[1].dpp_auth_init(uri=uri0, own=id1b)
609 ev = dev[1].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
612 ev = dev[0].wait_event(["DPP-SCAN-PEER-QR-CODE"], timeout=5)
618 dev[1].request("DPP_STOP_LISTEN")
620 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=1)
625 dev[1].dump_monitor()
626 dev[0].dump_monitor()
629 id0b = dev[0].dpp_qr_code(uri1b)
631 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
634 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=5)
640 ev = dev[0].wait_event(["DPP-TX "], timeout=15)
644 def test_dpp_qr_code_auth_mutual_not_used(dev, apdev): argument
646 check_dpp_capab(dev[0])
647 check_dpp_capab(dev[1])
649 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
650 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
652 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
653 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
656 dev[0].dpp_listen(2412)
657 dev[1].dpp_auth_init(uri=uri0, own=id1b)
659 ev = dev[1].wait_event(["DPP-AUTH-DIRECTION"], timeout=5)
665 wait_auth_success(dev[0], dev[1], stop_responder=True)
667 def test_dpp_qr_code_auth_mutual_curve_mismatch(dev, apdev): argument
669 check_dpp_capab(dev[0])
670 check_dpp_capab(dev[1])
672 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
673 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
675 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True, curve="secp384r1")
676 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
678 id0b = dev[0].dpp_qr_code(uri1b)
680 dev[1].dpp_auth_init(uri=uri0, own=id1b, expect_fail=True)
682 def test_dpp_qr_code_auth_hostapd_mutual2(dev, apdev): argument
684 check_dpp_capab(dev[0])
691 id0b = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
692 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0b)
695 dev[0].dpp_auth_init(uri=uri_h, own=id0b)
697 ev = dev[0].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
712 wait_auth_success(hapd, dev[0], stop_responder=True)
714 def test_dpp_qr_code_listen_continue(dev, apdev): argument
716 check_dpp_capab(dev[0])
717 check_dpp_capab(dev[1])
719 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
720 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
721 dev[0].dpp_listen(2412)
725 dev[1].dpp_auth_init(uri=uri0)
726 wait_auth_success(dev[0], dev[1], stop_responder=True)
728 def test_dpp_qr_code_auth_initiator_enrollee(dev, apdev): argument
731 run_dpp_qr_code_auth_initiator_enrollee(dev, apdev)
733 dev[0].set("gas_address3", "0")
734 dev[1].set("gas_address3", "0")
736 def run_dpp_qr_code_auth_initiator_enrollee(dev, apdev): argument
737 check_dpp_capab(dev[0])
738 check_dpp_capab(dev[1])
739 dev[0].request("SET gas_address3 1")
740 dev[1].request("SET gas_address3 1")
742 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
743 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
745 dev[0].dpp_listen(2412)
746 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
747 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1],
750 def test_dpp_qr_code_auth_initiator_either_1(dev, apdev): argument
752 run_dpp_qr_code_auth_initiator_either(dev, apdev, None, dev[1], dev[0])
754 def test_dpp_qr_code_auth_initiator_either_2(dev, apdev): argument
756 run_dpp_qr_code_auth_initiator_either(dev, apdev, "enrollee",
757 dev[1], dev[0])
759 def test_dpp_qr_code_auth_initiator_either_3(dev, apdev): argument
761 run_dpp_qr_code_auth_initiator_either(dev, apdev, "configurator",
762 dev[0], dev[1])
764 def run_dpp_qr_code_auth_initiator_either(dev, apdev, resp_role, argument
766 check_dpp_capab(dev[0])
767 check_dpp_capab(dev[1])
769 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
770 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
772 dev[0].dpp_listen(2412, role=resp_role)
773 dev[1].dpp_auth_init(uri=uri0, role="either")
774 wait_auth_success(dev[0], dev[1], configurator=conf_dev,
778 def run_init_incompatible_roles(dev, role="enrollee"): argument
779 check_dpp_capab(dev[0])
780 check_dpp_capab(dev[1])
782 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
783 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
786 id1 = dev[1].dpp_qr_code(uri0)
789 dev[0].dpp_listen(2412, role=role)
792 def test_dpp_qr_code_auth_incompatible_roles(dev, apdev): argument
794 id1 = run_init_incompatible_roles(dev)
795 dev[1].dpp_auth_init(peer=id1, role="enrollee")
796 ev = dev[1].wait_event(["DPP-NOT-COMPATIBLE"], timeout=5)
799 ev = dev[0].wait_event(["DPP-NOT-COMPATIBLE"], timeout=1)
802 dev[1].dpp_auth_init(peer=id1, role="configurator")
803 wait_auth_success(dev[0], dev[1], stop_responder=True)
805 def test_dpp_qr_code_auth_incompatible_roles2(dev, apdev): argument
807 id1 = run_init_incompatible_roles(dev, role="configurator")
808 dev[1].dpp_auth_init(peer=id1, role="configurator")
809 ev = dev[1].wait_event(["DPP-NOT-COMPATIBLE"], timeout=5)
812 ev = dev[0].wait_event(["DPP-NOT-COMPATIBLE"], timeout=1)
816 def test_dpp_qr_code_auth_incompatible_roles_failure(dev, apdev): argument
818 id1 = run_init_incompatible_roles(dev, role="configurator")
819 with alloc_fail(dev[0], 1, "dpp_auth_build_resp_status"):
820 dev[1].dpp_auth_init(peer=id1, role="configurator")
821 ev = dev[0].wait_event(["DPP-NOT-COMPATIBLE"], timeout=1)
825 def test_dpp_qr_code_auth_incompatible_roles_failure2(dev, apdev): argument
827 id1 = run_init_incompatible_roles(dev, role="configurator")
828 with alloc_fail(dev[1], 1, "dpp_auth_resp_rx_status"):
829 dev[1].dpp_auth_init(peer=id1, role="configurator")
830 wait_fail_trigger(dev[1], "GET_ALLOC_FAIL")
832 def test_dpp_qr_code_auth_incompatible_roles_failure3(dev, apdev): argument
834 id1 = run_init_incompatible_roles(dev, role="configurator")
835 with fail_test(dev[1], 1, "dpp_auth_resp_rx_status"):
836 dev[1].dpp_auth_init(peer=id1, role="configurator")
837 wait_dpp_fail(dev[1], "AES-SIV decryption failed")
839 def test_dpp_qr_code_auth_neg_chan(dev, apdev): argument
841 check_dpp_capab(dev[0])
842 check_dpp_capab(dev[1])
843 conf_id = dev[1].dpp_configurator_add()
845 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
846 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
848 dev[0].dpp_listen(2412)
849 dev[1].dpp_auth_init(uri=uri0, conf="sta-dpp", neg_freq=2462,
852 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
858 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
864 ev = dev[1].wait_event(["DPP-TX-STATUS"], timeout=5)
870 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
876 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
882 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
888 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
894 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
897 def test_dpp_config_legacy(dev, apdev): argument
899 check_dpp_capab(dev[1])
901 dev[1].set("dpp_config_obj_override", conf)
902 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
905 def test_dpp_config_legacy_psk_hex(dev, apdev): argument
907 check_dpp_capab(dev[1])
909 dev[1].set("dpp_config_obj_override", conf)
910 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
913 def test_dpp_config_fragmentation(dev, apdev): argument
915 check_dpp_capab(dev[1])
917 dev[1].set("dpp_config_obj_override", conf)
918 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
921 def test_dpp_config_legacy_gen(dev, apdev): argument
923 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
927 def test_dpp_config_legacy_gen_psk(dev, apdev): argument
929 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
933 def test_dpp_config_legacy_gen_two_conf(dev, apdev): argument
935 check_dpp_capab(dev[0])
946 dev[0].set("dpp_config_processing", "1")
947 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
951 dev[0].set("dpp_config_processing", "0", allow_fail=True)
953 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=5)
956 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=5)
959 ev = dev[0].wait_event(["DPP-CONFOBJ-PASS"], timeout=5)
963 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=5)
966 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=5)
969 ev = dev[0].wait_event(["DPP-CONFOBJ-PASS"], timeout=5)
973 val = dev[0].get_network(0, "ssid")
976 val = dev[0].get_network(0, "key_mgmt")
980 val = dev[0].get_network(1, "ssid")
983 val = dev[0].get_network(1, "key_mgmt")
987 def test_dpp_config_legacy_gen_two_conf_psk(dev, apdev): argument
989 check_dpp_capab(dev[0])
999 dev[0].set("dpp_config_processing", "1")
1000 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1004 dev[0].set("dpp_config_processing", "0", allow_fail=True)
1006 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=5)
1009 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=5)
1012 ev = dev[0].wait_event(["DPP-CONFOBJ-PSK"], timeout=5)
1016 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=5)
1019 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=5)
1022 ev = dev[0].wait_event(["DPP-CONFOBJ-PASS"], timeout=5)
1026 val = dev[0].get_network(0, "ssid")
1029 val = dev[0].get_network(0, "key_mgmt")
1033 val = dev[0].get_network(1, "ssid")
1036 val = dev[0].get_network(1, "key_mgmt")
1040 def test_dpp_config_legacy_gen_sta_ap_conf(dev, apdev): argument
1051 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1055 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=5)
1058 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=5)
1061 ev = dev[0].wait_event(["DPP-CONFOBJ-PASS"], timeout=5)
1065 ev = dev[0].wait_event(["DPP-CONFOBJ-AKM"], timeout=1)
1069 def test_dpp_config_dpp_gen_prime256v1(dev, apdev): argument
1071 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1076 def test_dpp_config_dpp_gen_secp384r1(dev, apdev): argument
1078 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1",
1083 def test_dpp_config_dpp_gen_secp521r1(dev, apdev): argument
1085 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1",
1090 def test_dpp_config_dpp_gen_prime256v1_prime256v1(dev, apdev): argument
1092 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1098 def test_dpp_config_dpp_gen_prime256v1_secp384r1(dev, apdev): argument
1100 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1106 def test_dpp_config_dpp_gen_prime256v1_secp521r1(dev, apdev): argument
1108 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1114 def test_dpp_config_dpp_gen_secp384r1_prime256v1(dev, apdev): argument
1116 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1",
1122 def test_dpp_config_dpp_gen_secp384r1_secp384r1(dev, apdev): argument
1124 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1",
1130 def test_dpp_config_dpp_gen_secp384r1_secp521r1(dev, apdev): argument
1132 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1",
1138 def test_dpp_config_dpp_gen_secp521r1_prime256v1(dev, apdev): argument
1140 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1",
1146 def test_dpp_config_dpp_gen_secp521r1_secp384r1(dev, apdev): argument
1148 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1",
1154 def test_dpp_config_dpp_gen_secp521r1_secp521r1(dev, apdev): argument
1156 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1",
1162 def test_dpp_config_dpp_gen_prime256v1_secp384r1_secp384r1(dev, apdev): argument
1164 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1171 def test_dpp_config_dpp_gen_expiry(dev, apdev): argument
1173 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1178 def test_dpp_config_dpp_gen_expired_key(dev, apdev): argument
1180 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1185 def test_dpp_config_dpp_gen_3rd_party(dev, apdev): argument
1187 check_dpp_capab(dev[0])
1188 check_dpp_capab(dev[1])
1190 dev[0].set("dpp_extra_conf_req_name", "org.example")
1192 dev[0].set("dpp_extra_conf_req_value", json)
1193 run_dpp_config_dpp_gen_3rd_party(dev, apdev)
1195 dev[0].set("dpp_extra_conf_req_name", "", allow_fail=True)
1196 dev[0].set("dpp_extra_conf_req_value", "", allow_fail=True)
1198 def run_dpp_config_dpp_gen_3rd_party(dev, apdev): argument
1202 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1207 def test_dpp_config_dpp_override_prime256v1(dev, apdev): argument
1209 check_dpp_capab(dev[0])
1210 check_dpp_capab(dev[1])
1212 dev[0].set("dpp_ignore_netaccesskey_mismatch", "1")
1213 dev[1].set("dpp_config_obj_override", conf)
1214 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1217 def test_dpp_config_dpp_override_secp384r1(dev, apdev): argument
1219 check_dpp_capab(dev[0])
1220 check_dpp_capab(dev[1])
1222 dev[0].set("dpp_ignore_netaccesskey_mismatch", "1")
1223 dev[1].set("dpp_config_obj_override", conf)
1224 run_dpp_qr_code_auth_unicast(dev, apdev, "secp384r1",
1227 def test_dpp_config_dpp_override_secp521r1(dev, apdev): argument
1229 check_dpp_capab(dev[0])
1230 check_dpp_capab(dev[1])
1232 dev[0].set("dpp_ignore_netaccesskey_mismatch", "1")
1233 dev[1].set("dpp_config_obj_override", conf)
1234 run_dpp_qr_code_auth_unicast(dev, apdev, "secp521r1",
1237 def test_dpp_config_override_objects(dev, apdev): argument
1239 check_dpp_capab(dev[1])
1242 dev[1].set("dpp_discovery_override", discovery)
1243 dev[1].set("dpp_groups_override", groups)
1244 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1292 def run_dpp_config_error(dev, apdev, conf, argument
1295 check_dpp_capab(dev[0])
1296 check_dpp_capab(dev[1])
1298 dev[0].set("dpp_ignore_netaccesskey_mismatch", "1")
1299 dev[1].set("dpp_config_obj_override", conf)
1300 run_dpp_qr_code_auth_unicast(dev, apdev, "prime256v1",
1304 def test_dpp_config_jwk_error_no_kty(dev, apdev): argument
1306 run_dpp_config_error(dev, apdev, build_conf_obj(kty=None))
1308 def test_dpp_config_jwk_error_unexpected_kty(dev, apdev): argument
1310 run_dpp_config_error(dev, apdev, build_conf_obj(kty="unknown"))
1312 def test_dpp_config_jwk_error_no_crv(dev, apdev): argument
1314 run_dpp_config_error(dev, apdev, build_conf_obj(crv=None))
1316 def test_dpp_config_jwk_error_unsupported_crv(dev, apdev): argument
1318 run_dpp_config_error(dev, apdev, build_conf_obj(crv="unsupported"))
1320 def test_dpp_config_jwk_error_no_x(dev, apdev): argument
1322 run_dpp_config_error(dev, apdev, build_conf_obj(x=None))
1324 def test_dpp_config_jwk_error_invalid_x(dev, apdev): argument
1326 run_dpp_config_error(dev, apdev, build_conf_obj(x="MTIz"))
1328 def test_dpp_config_jwk_error_no_y(dev, apdev): argument
1330 run_dpp_config_error(dev, apdev, build_conf_obj(y=None))
1332 def test_dpp_config_jwk_error_invalid_y(dev, apdev): argument
1334 run_dpp_config_error(dev, apdev, build_conf_obj(y="MTIz"))
1336 def test_dpp_config_jwk_error_invalid_xy(dev, apdev): argument
1340 run_dpp_config_error(dev, apdev, conf)
1342 def test_dpp_config_jwk_error_no_kid(dev, apdev): argument
1345 run_dpp_config_error(dev, apdev, build_conf_obj(kid=None),
1348 def test_dpp_config_jws_error_prot_hdr_not_an_object(dev, apdev): argument
1350 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr="1"))
1352 def test_dpp_config_jws_error_prot_hdr_no_typ(dev, apdev): argument
1355 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1357 def test_dpp_config_jws_error_prot_hdr_unsupported_typ(dev, apdev): argument
1360 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1362 def test_dpp_config_jws_error_prot_hdr_no_alg(dev, apdev): argument
1365 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1367 def test_dpp_config_jws_error_prot_hdr_unexpected_alg(dev, apdev): argument
1370 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1372 def test_dpp_config_jws_error_prot_hdr_no_kid(dev, apdev): argument
1375 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1377 def test_dpp_config_jws_error_prot_hdr_unexpected_kid(dev, apdev): argument
1380 run_dpp_config_error(dev, apdev, build_conf_obj(prot_hdr=prot_hdr))
1382 def test_dpp_config_signed_connector_error_no_dot_1(dev, apdev): argument
1385 run_dpp_config_error(dev, apdev, build_conf_obj(signed_connector=conn))
1387 def test_dpp_config_signed_connector_error_no_dot_2(dev, apdev): argument
1390 run_dpp_config_error(dev, apdev, build_conf_obj(signed_connector=conn))
1392 def test_dpp_config_signed_connector_error_unexpected_signature_len(dev, apdev): argument
1395 run_dpp_config_error(dev, apdev, build_conf_obj(signed_connector=conn))
1397 def test_dpp_config_signed_connector_error_invalid_signature_der(dev, apdev): argument
1400 run_dpp_config_error(dev, apdev, build_conf_obj(signed_connector=conn))
1402 def test_dpp_config_no_csign(dev, apdev): argument
1404 run_dpp_config_error(dev, apdev, build_conf_obj(csign=False))
1406 def test_dpp_config_no_signed_connector(dev, apdev): argument
1408 run_dpp_config_error(dev, apdev, build_conf_obj(no_signed_connector=True))
1410 def test_dpp_config_unexpected_signed_connector_char(dev, apdev): argument
1412 run_dpp_config_error(dev, apdev, build_conf_obj(signed_connector='a\nb'))
1414 def test_dpp_config_root_not_an_object(dev, apdev): argument
1417 run_dpp_config_error(dev, apdev, conf)
1419 def test_dpp_config_no_wi_fi_tech(dev, apdev): argument
1422 run_dpp_config_error(dev, apdev, conf)
1424 def test_dpp_config_unsupported_wi_fi_tech(dev, apdev): argument
1427 run_dpp_config_error(dev, apdev, conf)
1429 def test_dpp_config_no_discovery(dev, apdev): argument
1432 run_dpp_config_error(dev, apdev, conf)
1434 def test_dpp_config_no_discovery_ssid(dev, apdev): argument
1437 run_dpp_config_error(dev, apdev, conf)
1439 def test_dpp_config_too_long_discovery_ssid(dev, apdev): argument
1442 run_dpp_config_error(dev, apdev, conf)
1444 def test_dpp_config_no_cred(dev, apdev): argument
1447 run_dpp_config_error(dev, apdev, conf)
1449 def test_dpp_config_no_cred_akm(dev, apdev): argument
1452 run_dpp_config_error(dev, apdev, conf)
1454 def test_dpp_config_unsupported_cred_akm(dev, apdev): argument
1457 run_dpp_config_error(dev, apdev, conf)
1459 def test_dpp_config_error_legacy_no_pass(dev, apdev): argument
1462 run_dpp_config_error(dev, apdev, conf)
1464 def test_dpp_config_error_legacy_too_short_pass(dev, apdev): argument
1467 run_dpp_config_error(dev, apdev, conf)
1469 def test_dpp_config_error_legacy_too_long_pass(dev, apdev): argument
1472 run_dpp_config_error(dev, apdev, conf)
1474 def test_dpp_config_error_legacy_psk_with_sae(dev, apdev): argument
1477 run_dpp_config_error(dev, apdev, conf)
1479 def test_dpp_config_error_legacy_no_pass_for_sae(dev, apdev): argument
1482 run_dpp_config_error(dev, apdev, conf)
1484 def test_dpp_config_error_legacy_invalid_psk(dev, apdev): argument
1487 run_dpp_config_error(dev, apdev, conf)
1489 def test_dpp_config_error_legacy_too_short_psk(dev, apdev): argument
1492 run_dpp_config_error(dev, apdev, conf)
1541 def run_dpp_config_connector(dev, apdev, expiry=None, payload=None, argument
1565 run_dpp_config_error(dev, apdev,
1570 def test_dpp_config_connector_error_ext_sign(dev, apdev): argument
1572 run_dpp_config_connector(dev, apdev, conf_failure=False)
1574 def test_dpp_config_connector_error_too_short_timestamp(dev, apdev): argument
1576 run_dpp_config_connector(dev, apdev, expiry="1")
1578 def test_dpp_config_connector_error_invalid_timestamp(dev, apdev): argument
1580 run_dpp_config_connector(dev, apdev, expiry=19*"1")
1582 def test_dpp_config_connector_error_invalid_timestamp_date(dev, apdev): argument
1584 run_dpp_config_connector(dev, apdev, expiry="9999-99-99T99:99:99Z")
1586 def test_dpp_config_connector_error_invalid_time_zone(dev, apdev): argument
1588 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00*")
1590 def test_dpp_config_connector_error_invalid_time_zone_2(dev, apdev): argument
1592 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00+")
1594 def test_dpp_config_connector_error_expired_1(dev, apdev): argument
1596 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00")
1598 def test_dpp_config_connector_error_expired_2(dev, apdev): argument
1600 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00Z")
1602 def test_dpp_config_connector_error_expired_3(dev, apdev): argument
1604 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00+01")
1606 def test_dpp_config_connector_error_expired_4(dev, apdev): argument
1608 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00+01:02")
1610 def test_dpp_config_connector_error_expired_5(dev, apdev): argument
1612 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00-01")
1614 def test_dpp_config_connector_error_expired_6(dev, apdev): argument
1616 run_dpp_config_connector(dev, apdev, expiry="2018-01-01T00:00:00-01:02")
1618 def test_dpp_config_connector_error_no_groups(dev, apdev): argument
1621 run_dpp_config_connector(dev, apdev, payload=payload)
1623 def test_dpp_config_connector_error_empty_groups(dev, apdev): argument
1626 run_dpp_config_connector(dev, apdev, payload=payload)
1628 def test_dpp_config_connector_error_missing_group_id(dev, apdev): argument
1631 run_dpp_config_connector(dev, apdev, payload=payload)
1633 def test_dpp_config_connector_error_missing_net_role(dev, apdev): argument
1636 run_dpp_config_connector(dev, apdev, payload=payload)
1638 def test_dpp_config_connector_error_missing_net_access_key(dev, apdev): argument
1641 run_dpp_config_connector(dev, apdev, payload=payload)
1643 def test_dpp_config_connector_error_net_access_key_mismatch(dev, apdev): argument
1646 run_dpp_config_connector(dev, apdev, payload=payload,
1649 def test_dpp_gas_timeout(dev, apdev): argument
1651 check_dpp_capab(dev[0])
1652 check_dpp_capab(dev[1])
1654 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
1655 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
1658 dev[0].set("ext_mgmt_frame_handling", "1")
1659 dev[0].dpp_listen(2412)
1663 dev[1].set("dpp_config_obj_override", conf)
1665 dev[1].dpp_auth_init(uri=uri0)
1668 msg = dev[0].mgmt_rx()
1669 … if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(
1674 msg = dev[0].mgmt_rx()
1675 … if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(
1679 wait_auth_success(dev[0], dev[1])
1682 msg = dev[0].mgmt_rx()
1683 … if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(
1688 msg = dev[0].mgmt_rx()
1691 ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=10)
1696 dev[0].set("ext_mgmt_frame_handling", "0")
1698 ev = dev[1].wait_event(["DPP-CONF-FAILED"], timeout=65)
1702 ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=1)
1706 def test_dpp_akm_sha256(dev, apdev): argument
1708 run_dpp_akm(dev, apdev, 32)
1710 def test_dpp_akm_sha384(dev, apdev): argument
1712 run_dpp_akm(dev, apdev, 48)
1714 def test_dpp_akm_sha512(dev, apdev): argument
1716 run_dpp_akm(dev, apdev, 64)
1718 def run_dpp_akm(dev, apdev, pmk_len): argument
1719 check_dpp_capab(dev[0])
1720 check_dpp_capab(dev[1])
1736 id = dev[0].connect("dpp", key_mgmt="DPP", ieee80211w="2", scan_freq="2412",
1738 ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-NOT-FOUND"], timeout=2)
1741 dev[0].request("DISCONNECT")
1742 dev[0].dump_monitor()
1749 if "OK" not in dev[0].request(cmd):
1751 dev[0].select_network(id, freq="2412")
1752 ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT"], timeout=2)
1753 dev[0].request("DISCONNECT")
1754 dev[0].dump_monitor()
1760 addr = dev[0].own_addr()
1766 if "OK" not in dev[0].request(cmd):
1768 dev[0].select_network(id, freq="2412")
1769 dev[0].wait_connected()
1770 val = dev[0].get_status_field("key_mgmt")
1781 def test_dpp_network_introduction(dev, apdev): argument
1783 check_dpp_capab(dev[0])
1784 check_dpp_capab(dev[1])
1799 id = dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
1804 val = dev[0].get_status_field("key_mgmt")
1808 ev = hapd.wait_sta(dev[0].own_addr())
1812 sta = hapd.get_sta(dev[0].own_addr())
1818 def test_dpp_network_introduction_expired(dev, apdev): argument
1820 check_dpp_capab(dev[0])
1821 check_dpp_capab(dev[1])
1837 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
1848 ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
1849 dev[0].request("DISCONNECT")
1856 dev[0].request("RECONNECT")
1857 dev[0].wait_connected()
1859 def test_dpp_network_introduction_clear_ap(dev, apdev): argument
1861 check_dpp_capab(dev[0])
1862 check_dpp_capab(dev[1])
1877 id = dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
1882 dev[0].request("DISCONNECT")
1883 dev[0].wait_disconnected()
1884 dev[0].request("RECONNECT")
1885 ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED", "DPP-INTRO"], timeout=10)
1890 dev[0].request("DISCONNECT")
1891 dev[0].wait_disconnected()
1894 dev[0].request("RECONNECT")
1895 ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED", "DPP-INTRO"], timeout=10)
1901 def test_dpp_and_sae_akm(dev, apdev): argument
1903 check_dpp_capab(dev[0])
1904 check_dpp_capab(dev[1])
1905 check_sae_capab(dev[1])
1921 id = dev[0].connect("dpp+sae", key_mgmt="DPP", scan_freq="2412",
1926 val = dev[0].get_status_field("key_mgmt")
1930 dev[1].request("SET sae_groups ")
1931 id = dev[1].connect("dpp+sae", key_mgmt="SAE", scan_freq="2412",
1933 val = dev[1].get_status_field("key_mgmt")
1937 def test_dpp_ap_config(dev, apdev): argument
1939 run_dpp_ap_config(dev, apdev)
1941 def test_dpp_ap_config_p256_p256(dev, apdev): argument
1943 run_dpp_ap_config(dev, apdev, curve="P-256", conf_curve="P-256")
1945 def test_dpp_ap_config_p256_p384(dev, apdev): argument
1947 run_dpp_ap_config(dev, apdev, curve="P-256", conf_curve="P-384")
1949 def test_dpp_ap_config_p256_p521(dev, apdev): argument
1951 run_dpp_ap_config(dev, apdev, curve="P-256", conf_curve="P-521")
1953 def test_dpp_ap_config_p384_p256(dev, apdev): argument
1955 run_dpp_ap_config(dev, apdev, curve="P-384", conf_curve="P-256")
1957 def test_dpp_ap_config_p384_p384(dev, apdev): argument
1959 run_dpp_ap_config(dev, apdev, curve="P-384", conf_curve="P-384")
1961 def test_dpp_ap_config_p384_p521(dev, apdev): argument
1963 run_dpp_ap_config(dev, apdev, curve="P-384", conf_curve="P-521")
1965 def test_dpp_ap_config_p521_p256(dev, apdev): argument
1967 run_dpp_ap_config(dev, apdev, curve="P-521", conf_curve="P-256")
1969 def test_dpp_ap_config_p521_p384(dev, apdev): argument
1971 run_dpp_ap_config(dev, apdev, curve="P-521", conf_curve="P-384")
1973 def test_dpp_ap_config_p521_p521(dev, apdev): argument
1975 run_dpp_ap_config(dev, apdev, curve="P-521", conf_curve="P-521")
1977 def test_dpp_ap_config_bp256_bp256(dev, apdev): argument
1979 run_dpp_ap_config(dev, apdev, curve="BP-256", conf_curve="BP-256")
1981 def test_dpp_ap_config_bp384_bp384(dev, apdev): argument
1983 run_dpp_ap_config(dev, apdev, curve="BP-384", conf_curve="BP-384")
1985 def test_dpp_ap_config_bp512_bp512(dev, apdev): argument
1987 run_dpp_ap_config(dev, apdev, curve="BP-512", conf_curve="BP-512")
1989 def test_dpp_ap_config_p256_bp256(dev, apdev): argument
1991 run_dpp_ap_config(dev, apdev, curve="P-256", conf_curve="BP-256")
1993 def test_dpp_ap_config_bp256_p256(dev, apdev): argument
1995 run_dpp_ap_config(dev, apdev, curve="BP-256", conf_curve="P-256")
1997 def test_dpp_ap_config_p521_bp512(dev, apdev): argument
1999 run_dpp_ap_config(dev, apdev, curve="P-521", conf_curve="BP-512")
2001 def test_dpp_ap_config_bp512_p521(dev, apdev): argument
2003 run_dpp_ap_config(dev, apdev, curve="BP-512", conf_curve="P-521")
2005 def test_dpp_ap_config_reconfig_configurator(dev, apdev): argument
2007 run_dpp_ap_config(dev, apdev, reconf_configurator=True)
2009 def test_dpp_ap_config_sae(dev, apdev): argument
2011 run_dpp_ap_config(dev, apdev, sae=True)
2067 def run_dpp_ap_config(dev, apdev, curve=None, conf_curve=None, argument
2070 check_sae_capab(dev[0])
2071 check_sae_capab(dev[1])
2072 dev[0].set("sae_groups", "")
2073 dev[1].set("sae_groups", "")
2077 check_dpp_capab(dev[0], brainpool)
2078 check_dpp_capab(dev[1], brainpool)
2085 conf_id = dev[0].dpp_configurator_add(curve=conf_curve)
2088 csign = dev[0].request("DPP_CONFIGURATOR_GET_KEY %d" % conf_id)
2093 dev[0].dpp_auth_init(uri=uri, conf="ap-sae", configurator=conf_id,
2096 dev[0].dpp_auth_init(uri=uri, conf="ap-dpp", configurator=conf_id)
2097 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd)
2100 id1 = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True, curve=curve)
2101 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
2104 dev[0].dpp_configurator_remove(conf_id)
2105 conf_id = dev[0].dpp_configurator_add(curve=conf_curve, key=csign)
2107 dev[1].dpp_listen(2412)
2109 dev[0].dpp_auth_init(uri=uri1, conf="sta-sae", configurator=conf_id,
2112 dev[0].dpp_auth_init(uri=uri1, conf="sta-dpp", configurator=conf_id)
2113 res = wait_auth_success(dev[1], dev[0],
2114 configurator=dev[0], enrollee=dev[1],
2118 ev = dev[1].wait_event(["DPP-CONFOBJ-SSID"], timeout=1)
2123 ev = dev[1].wait_event(["DPP-CONNECTOR"], timeout=1)
2128 ev = dev[1].wait_event(["DPP-C-SIGN-KEY"], timeout=1)
2134 ev = dev[1].wait_event(["DPP-NET-ACCESS-KEY"], timeout=1)
2141 dev[1].dump_monitor()
2144 id = dev[1].connect(ssid, key_mgmt="SAE", ieee80211w="2",
2149 id = dev[1].connect(ssid, key_mgmt="DPP", ieee80211w="2",
2152 dev[1].set_network_quoted(id, "dpp_connector", connector)
2153 dev[1].set_network(id, "dpp_csign", csign)
2154 dev[1].set_network(id, "dpp_netaccesskey", net_access_key)
2156 dev[1].set_network(id, "dpp_netaccess_expiry",
2160 dev[1].select_network(id, freq="2412")
2161 dev[1].wait_connected()
2164 ev = hapd.wait_sta(dev[1].own_addr())
2168 sta = hapd.get_sta(dev[1].own_addr())
2174 dev[1].request("DISCONNECT")
2175 dev[1].wait_disconnected()
2176 dev[1].request("RECONNECT")
2177 dev[1].wait_connected()
2178 ev = hapd.wait_sta(dev[1].own_addr())
2182 sta = hapd.get_sta(dev[1].own_addr())
2188 def test_dpp_auto_connect_1(dev, apdev): argument
2191 run_dpp_auto_connect(dev, apdev, 1)
2193 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2195 def test_dpp_auto_connect_2(dev, apdev): argument
2198 run_dpp_auto_connect(dev, apdev, 2)
2200 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2202 def test_dpp_auto_connect_2_connect_cmd(dev, apdev): argument
2206 dev_new = [wpas, dev[1]]
2212 def test_dpp_auto_connect_2_sta_ver1(dev, apdev): argument
2215 run_dpp_auto_connect(dev, apdev, 2, sta_version=1)
2217 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2219 def test_dpp_auto_connect_2_ap_ver1(dev, apdev): argument
2222 run_dpp_auto_connect(dev, apdev, 2, ap_version=1)
2224 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2226 def test_dpp_auto_connect_2_ver1(dev, apdev): argument
2229 run_dpp_auto_connect(dev, apdev, 2, ap_version=1, sta_version=1)
2231 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2233 def test_dpp_auto_connect_2_conf_ver1(dev, apdev): argument
2236 run_dpp_auto_connect(dev, apdev, 2, sta1_version=1)
2238 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2240 def run_dpp_auto_connect(dev, apdev, processing, ap_version=0, sta_version=0, argument
2242 check_dpp_capab(dev[0])
2243 check_dpp_capab(dev[1])
2266 dev[0].set("dpp_version_override", str(sta_version))
2268 dev[1].set("dpp_version_override", str(sta1_version))
2269 conf_id = dev[1].dpp_configurator_add(key=csign)
2270 dev[0].set("dpp_config_processing", str(processing))
2271 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
2272 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2273 dev[0].dpp_listen(2412)
2274 dev[1].dpp_auth_init(uri=uri0, conf="sta-dpp", configurator=conf_id)
2275 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
2276 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
2284 dev[0].select_network(id, freq=2412)
2286 dev[0].wait_connected()
2287 hwsim_utils.test_connectivity(dev[0], hapd)
2289 def test_dpp_auto_connect_legacy(dev, apdev): argument
2292 run_dpp_auto_connect_legacy(dev, apdev)
2294 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2296 def test_dpp_auto_connect_legacy_ssid_charset(dev, apdev): argument
2299 run_dpp_auto_connect_legacy(dev, apdev, ssid_charset=12345)
2301 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2303 def test_dpp_auto_connect_legacy_sae_1(dev, apdev): argument
2306 run_dpp_auto_connect_legacy(dev, apdev, conf='sta-sae', psk_sae=True)
2308 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2310 def test_dpp_auto_connect_legacy_sae_2(dev, apdev): argument
2313 run_dpp_auto_connect_legacy(dev, apdev, conf='sta-sae', sae_only=True)
2315 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2317 def test_dpp_auto_connect_legacy_psk_sae_1(dev, apdev): argument
2320 run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk-sae',
2323 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2325 def test_dpp_auto_connect_legacy_psk_sae_2(dev, apdev): argument
2328 run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk-sae',
2331 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2333 def test_dpp_auto_connect_legacy_psk_sae_3(dev, apdev): argument
2336 run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk-sae')
2338 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2340 def run_dpp_auto_connect_legacy(dev, apdev, conf='sta-psk', argument
2343 check_dpp_capab(dev[0])
2344 check_dpp_capab(dev[1])
2358 dev[0].request("SET sae_groups ")
2359 dev[0].set("dpp_config_processing", "2")
2360 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
2361 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2363 dev[0].dpp_listen(2412)
2364 dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid="dpp-legacy",
2367 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
2369 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID-CHARSET"], timeout=1)
2375 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
2380 dev[0].wait_connected()
2382 def test_dpp_auto_connect_legacy_pmf_required(dev, apdev): argument
2385 run_dpp_auto_connect_legacy_pmf_required(dev, apdev)
2387 dev[0].set("dpp_config_processing", "0", allow_fail=True)
2389 def run_dpp_auto_connect_legacy_pmf_required(dev, apdev): argument
2390 check_dpp_capab(dev[0])
2391 check_dpp_capab(dev[1])
2399 dev[0].set("dpp_config_processing", "2")
2400 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
2401 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2402 dev[0].dpp_listen(2412)
2403 dev[1].dpp_auth_init(uri=uri0, conf="sta-psk", ssid="dpp-legacy",
2405 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
2406 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
2409 dev[0].wait_connected()
2411 def test_dpp_qr_code_auth_responder_configurator(dev, apdev): argument
2413 run_dpp_qr_code_auth_responder_configurator(dev, apdev, "")
2415 def test_dpp_qr_code_auth_responder_configurator_group_id(dev, apdev): argument
2417 run_dpp_qr_code_auth_responder_configurator(dev, apdev,
2420 def run_dpp_qr_code_auth_responder_configurator(dev, apdev, extra): argument
2421 check_dpp_capab(dev[0])
2422 check_dpp_capab(dev[1])
2423 conf_id = dev[0].dpp_configurator_add()
2424 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
2425 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2426 dev[0].set("dpp_configurator_params",
2428 dev[0].dpp_listen(2412, role="configurator")
2429 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
2430 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1],
2433 def test_dpp_qr_code_auth_enrollee_init_netrole(dev, apdev): argument
2435 check_dpp_capab(dev[0])
2436 check_dpp_capab(dev[1])
2437 conf_id = dev[0].dpp_configurator_add()
2438 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
2439 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2440 dev[0].set("dpp_configurator_params",
2442 dev[0].dpp_listen(2412, role="configurator")
2443 dev[1].dpp_auth_init(uri=uri0, role="enrollee", netrole="configurator")
2444 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1],
2446 dev[0].dump_monitor()
2447 dev[1].dump_monitor()
2450 dev[0].set("dpp_configurator_params",
2452 dev[0].dpp_listen(2412, role="configurator")
2453 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
2454 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1],
2457 def test_dpp_qr_code_hostapd_init(dev, apdev): argument
2459 check_dpp_capab(dev[0])
2463 conf_id = dev[0].dpp_configurator_add()
2464 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
2465 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2466 dev[0].set("dpp_configurator_params",
2468 dev[0].dpp_listen(2437, role="configurator")
2470 wait_auth_success(dev[0], hapd, configurator=dev[0], enrollee=hapd,
2473 def test_dpp_qr_code_hostapd_init_offchannel(dev, apdev): argument
2475 run_dpp_qr_code_hostapd_init_offchannel(dev, apdev, None)
2477 def test_dpp_qr_code_hostapd_init_offchannel_neg_freq(dev, apdev): argument
2479 run_dpp_qr_code_hostapd_init_offchannel(dev, apdev, "neg_freq=2437")
2481 def run_dpp_qr_code_hostapd_init_offchannel(dev, apdev, extra): argument
2482 check_dpp_capab(dev[0])
2486 conf_id = dev[0].dpp_configurator_add()
2487 id0 = dev[0].dpp_bootstrap_gen(chan="81/1,81/11", mac=True)
2488 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2489 dev[0].set("dpp_configurator_params",
2491 dev[0].dpp_listen(2462, role="configurator")
2493 wait_auth_success(dev[0], hapd, configurator=dev[0], enrollee=hapd,
2496 def test_dpp_qr_code_hostapd_init_offchannel_configurator(dev, apdev): argument
2498 check_dpp_capab(dev[0])
2502 id0 = dev[0].dpp_bootstrap_gen(chan="81/1")
2503 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2504 dev[0].dpp_listen(2412)
2507 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0])
2509 def test_dpp_qr_code_hostapd_ignore_mismatch(dev, apdev): argument
2511 check_dpp_capab(dev[0])
2515 conf_id = dev[0].dpp_configurator_add()
2516 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
2517 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2518 dev[0].set("dpp_configurator_params",
2521 dev[0].set("dpp_config_obj_override", conf)
2522 dev[0].dpp_listen(2437, role="configurator")
2525 wait_auth_success(dev[0], hapd, configurator=dev[0], enrollee=hapd,
2528 def test_dpp_test_vector_p_256(dev, apdev): argument
2530 check_dpp_capab(dev[0])
2531 check_dpp_capab(dev[1])
2535 …id0 = dev[0].dpp_bootstrap_gen(chan="81/11", mac=True, key="30310201010420" + priv + "a00a06082a86…
2536 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2540 dev[0].set("dpp_protocol_key_override",
2543 dev[0].set("dpp_nonce_override", "3d0cfb011ca916d796f7029ff0b43393")
2547 id1 = dev[1].dpp_bootstrap_gen(key="30310201010420" + priv + "a00a06082a8648ce3d030107")
2548 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
2552 dev[1].set("dpp_protocol_key_override",
2555 dev[1].set("dpp_nonce_override", "13f4602a16daeb69712263b9c46cba31")
2557 dev[0].dpp_qr_code(uri1)
2558 dev[0].dpp_listen(2462, qr="mutual")
2559 dev[1].dpp_auth_init(uri=uri0, own=id1, neg_freq=2412)
2560 wait_auth_success(dev[0], dev[1])
2562 def test_dpp_test_vector_p_256_b(dev, apdev): argument
2564 check_dpp_capab(dev[0])
2565 check_dpp_capab(dev[1])
2569 …id0 = dev[0].dpp_bootstrap_gen(chan="81/11", mac=True, key="30310201010420" + priv + "a00a06082a86…
2570 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2574 dev[0].set("dpp_protocol_key_override",
2577 dev[0].set("dpp_nonce_override", "3d0cfb011ca916d796f7029ff0b43393")
2581 id1 = dev[1].dpp_bootstrap_gen(key="30310201010420" + priv + "a00a06082a8648ce3d030107")
2582 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
2586 dev[1].set("dpp_protocol_key_override",
2589 dev[1].set("dpp_nonce_override", "13f4602a16daeb69712263b9c46cba31")
2591 dev[0].dpp_listen(2462)
2592 dev[1].dpp_auth_init(uri=uri0, own=id1, neg_freq=2412)
2593 wait_auth_success(dev[0], dev[1])
2602 def test_dpp_test_vector_p_521(dev, apdev): argument
2604 check_dpp_capab(dev[0])
2605 check_dpp_capab(dev[1])
2609 id0 = dev[0].dpp_bootstrap_gen(chan="81/11", mac=True,
2611 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
2615 dev[0].set("dpp_protocol_key_override", der_priv_key_p_521(priv))
2617 dev[0].set("dpp_nonce_override",
2622 id1 = dev[1].dpp_bootstrap_gen(key=der_priv_key_p_521(priv))
2623 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
2627 dev[1].set("dpp_protocol_key_override", der_priv_key_p_521(priv))
2629 dev[1].set("dpp_nonce_override",
2632 dev[0].dpp_qr_code(uri1)
2633 dev[0].dpp_listen(2462, qr="mutual")
2634 dev[1].dpp_auth_init(uri=uri0, own=id1, neg_freq=2412)
2635 wait_auth_success(dev[0], dev[1])
2637 def test_dpp_pkex(dev, apdev): argument
2639 run_dpp_pkex(dev, apdev)
2641 def test_dpp_pkex_v2(dev, apdev): argument
2643 run_dpp_pkex(dev, apdev, ver=2)
2645 def test_dpp_pkex_p256(dev, apdev): argument
2647 run_dpp_pkex(dev, apdev, "P-256")
2649 def test_dpp_pkex_p384(dev, apdev): argument
2651 run_dpp_pkex(dev, apdev, "P-384")
2653 def test_dpp_pkex_p521(dev, apdev): argument
2655 run_dpp_pkex(dev, apdev, "P-521")
2657 def test_dpp_pkex_bp256(dev, apdev): argument
2659 run_dpp_pkex(dev, apdev, "brainpoolP256r1")
2661 def test_dpp_pkex_bp384(dev, apdev): argument
2663 run_dpp_pkex(dev, apdev, "brainpoolP384r1")
2665 def test_dpp_pkex_bp512(dev, apdev): argument
2667 run_dpp_pkex(dev, apdev, "brainpoolP512r1")
2669 def test_dpp_pkex_config(dev, apdev): argument
2671 check_dpp_capab(dev[1])
2672 conf_id = dev[1].dpp_configurator_add()
2673 run_dpp_pkex(dev, apdev,
2677 def test_dpp_pkex_no_identifier(dev, apdev): argument
2679 run_dpp_pkex(dev, apdev, identifier_i=None, identifier_r=None)
2681 def test_dpp_pkex_identifier_mismatch(dev, apdev): argument
2683 run_dpp_pkex(dev, apdev, identifier_i="foo", identifier_r="bar",
2686 def test_dpp_pkex_identifier_mismatch2(dev, apdev): argument
2688 run_dpp_pkex(dev, apdev, identifier_i="foo", identifier_r=None,
2691 def test_dpp_pkex_identifier_mismatch3(dev, apdev): argument
2693 run_dpp_pkex(dev, apdev, identifier_i=None, identifier_r="bar",
2696 def run_dpp_pkex(dev, apdev, curve=None, init_extra=None, check_config=False, argument
2700 check_dpp_capab(dev[0], curve and "brainpool" in curve, min_ver=min_ver)
2701 check_dpp_capab(dev[1], curve and "brainpool" in curve, min_ver=min_ver)
2702 dev[0].dpp_pkex_resp(2437, identifier=identifier_r, code="secret",
2704 dev[1].dpp_pkex_init(identifier=identifier_i, code="secret", curve=curve,
2708 ev = dev[0].wait_event(["DPP-RX"], timeout=10)
2711 ev = dev[1].wait_event(["DPP-AUTH-SUCCESS"], timeout=1)
2714 ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=0.1)
2719 wait_auth_success(dev[0], dev[1],
2720 configurator=dev[1] if check_config else None,
2721 enrollee=dev[0] if check_config else None)
2723 def test_dpp_pkex_5ghz(dev, apdev): argument
2726 dev[0].request("SET country US")
2727 dev[1].request("SET country US")
2728 ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1)
2730 ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"],
2732 run_dpp_pkex_5ghz(dev, apdev)
2734 dev[0].request("SET country 00")
2735 dev[1].request("SET country 00")
2739 def run_dpp_pkex_5ghz(dev, apdev): argument
2740 check_dpp_capab(dev[0])
2741 check_dpp_capab(dev[1])
2742 dev[0].dpp_pkex_resp(5745, identifier="test", code="secret")
2743 dev[1].dpp_pkex_init(identifier="test", code="secret")
2744 wait_auth_success(dev[0], dev[1], timeout=20)
2746 def test_dpp_pkex_test_vector(dev, apdev): argument
2748 check_dpp_capab(dev[0])
2749 check_dpp_capab(dev[1])
2772 dev[0].set("dpp_pkex_own_mac_override", resp_addr)
2773 dev[0].set("dpp_pkex_peer_mac_override", init_addr)
2774 dev[1].set("dpp_pkex_own_mac_override", init_addr)
2775 dev[1].set("dpp_pkex_peer_mac_override", resp_addr)
2778 dev[0].set("dpp_pkex_ephemeral_key_override",
2782 dev[1].set("dpp_pkex_ephemeral_key_override",
2785 dev[0].dpp_pkex_resp(2437, identifier=identifier, code=code,
2787 dev[1].dpp_pkex_init(identifier=identifier, code=code,
2789 wait_auth_success(dev[0], dev[1])
2791 def test_dpp_pkex_code_mismatch(dev, apdev): argument
2793 check_dpp_capab(dev[0])
2794 check_dpp_capab(dev[1])
2795 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret")
2796 id1 = dev[1].dpp_pkex_init(identifier="test", code="unknown")
2797 wait_dpp_fail(dev[0], "possible PKEX code mismatch")
2798 dev[0].dump_monitor()
2799 dev[1].dump_monitor()
2800 dev[1].dpp_pkex_init(identifier="test", code="secret", use_id=id1)
2801 wait_auth_success(dev[0], dev[1])
2803 def test_dpp_pkex_code_mismatch_limit(dev, apdev): argument
2805 check_dpp_capab(dev[0])
2806 check_dpp_capab(dev[1])
2807 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret")
2811 dev[0].dump_monitor()
2812 dev[1].dump_monitor()
2813 id1 = dev[1].dpp_pkex_init(identifier="test", code="unknown",
2815 wait_dpp_fail(dev[0], "possible PKEX code mismatch")
2817 ev = dev[0].wait_event(["DPP-PKEX-T-LIMIT"], timeout=1)
2821 def test_dpp_pkex_curve_mismatch(dev, apdev): argument
2823 check_dpp_capab(dev[0])
2824 check_dpp_capab(dev[1])
2825 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret", curve="P-256")
2826 dev[1].dpp_pkex_init(identifier="test", code="secret", curve="P-384")
2827 wait_dpp_fail(dev[0], "Mismatching PKEX curve: peer=20 own=19")
2828 wait_dpp_fail(dev[1], "Peer indicated mismatching PKEX group - proposed 19")
2830 def test_dpp_pkex_curve_mismatch_failure(dev, apdev): argument
2832 run_dpp_pkex_curve_mismatch_failure(dev, apdev, "=dpp_pkex_rx_exchange_req")
2834 def test_dpp_pkex_curve_mismatch_failure2(dev, apdev): argument
2836 run_dpp_pkex_curve_mismatch_failure(dev, apdev,
2839 def run_dpp_pkex_curve_mismatch_failure(dev, apdev, func): argument
2840 check_dpp_capab(dev[0])
2841 check_dpp_capab(dev[1])
2842 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret", curve="P-256")
2844 with alloc_fail(dev[0], 1, func):
2845 dev[1].dpp_pkex_init(identifier="test", code="secret", curve="P-384")
2847 ev = dev[0].wait_event(["DPP-FAIL"], timeout=5)
2852 wait_dpp_fail(dev[0], "Mismatching PKEX curve: peer=20 own=19")
2854 def test_dpp_pkex_exchange_resp_processing_failure(dev, apdev): argument
2856 check_dpp_capab(dev[0])
2857 check_dpp_capab(dev[1])
2858 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret")
2860 with fail_test(dev[1], 1, "dpp_pkex_derive_Qr;dpp_pkex_rx_exchange_resp"):
2861 dev[1].dpp_pkex_init(identifier="test", code="secret")
2862 wait_fail_trigger(dev[1], "GET_FAIL")
2864 def test_dpp_pkex_commit_reveal_req_processing_failure(dev, apdev): argument
2866 check_dpp_capab(dev[0])
2867 check_dpp_capab(dev[1])
2868 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret")
2870 with alloc_fail(dev[0], 1,
2872 dev[1].dpp_pkex_init(identifier="test", code="secret")
2873 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
2875 def test_dpp_pkex_config2(dev, apdev): argument
2877 check_dpp_capab(dev[0])
2878 conf_id = dev[0].dpp_configurator_add()
2879 dev[0].set("dpp_configurator_params",
2881 run_dpp_pkex2(dev, apdev)
2883 def run_dpp_pkex2(dev, apdev, curve=None, init_extra=""): argument
2884 check_dpp_capab(dev[0])
2885 check_dpp_capab(dev[1])
2886 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret", curve=curve,
2888 dev[1].dpp_pkex_init(identifier="test", code="secret", role="enrollee",
2890 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1])
2892 def test_dpp_pkex_no_responder(dev, apdev): argument
2894 check_dpp_capab(dev[0])
2895 dev[0].dpp_pkex_init(identifier="test", code="secret")
2898 ev = dev[0].wait_event(["DPP-TX ", "DPP-FAIL"], timeout=5)
2907 def test_dpp_pkex_after_retry(dev, apdev): argument
2909 check_dpp_capab(dev[0])
2910 dev[0].dpp_pkex_init(identifier="test", code="secret")
2912 dev[1].dpp_pkex_resp(2437, identifier="test", code="secret")
2913 wait_auth_success(dev[1], dev[0], configurator=dev[0], enrollee=dev[1],
2916 def test_dpp_pkex_hostapd_responder(dev, apdev): argument
2918 check_dpp_capab(dev[0])
2923 conf_id = dev[0].dpp_configurator_add()
2924 dev[0].dpp_pkex_init(identifier="test", code="secret",
2926 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
2929 def test_dpp_pkex_v2_hostapd_responder(dev, apdev): argument
2931 check_dpp_capab(dev[0], min_ver=3)
2936 conf_id = dev[0].dpp_configurator_add()
2937 dev[0].dpp_pkex_init(identifier="test", code="secret",
2939 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
2942 def test_dpp_pkex_hostapd_initiator(dev, apdev): argument
2944 check_dpp_capab(dev[0])
2948 conf_id = dev[0].dpp_configurator_add()
2949 dev[0].set("dpp_configurator_params",
2951 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
2954 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
2957 def test_dpp_pkex_v2_hostapd_initiator(dev, apdev): argument
2959 check_dpp_capab(dev[0], min_ver=3)
2963 conf_id = dev[0].dpp_configurator_add()
2964 dev[0].set("dpp_configurator_params",
2966 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
2970 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
2973 def test_dpp_pkex_hostapd_initiator_fallback(dev, apdev): argument
2975 check_dpp_capab(dev[0])
2979 conf_id = dev[0].dpp_configurator_add()
2980 dev[0].set("dpp_configurator_params",
2982 dev[0].dpp_listen(2437, role="configurator")
2985 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
2990 conf_id = dev[0].dpp_configurator_add()
2991 dev[0].set("dpp_configurator_params",
2993 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
2996 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
2999 def test_dpp_pkex_hostapd_initiator_no_response(dev, apdev): argument
3001 check_dpp_capab(dev[0])
3005 conf_id = dev[0].dpp_configurator_add()
3013 def test_dpp_pkex_hostapd_errors(dev, apdev): argument
3040 def test_dpp_pkex_nak_curve_change(dev, apdev): argument
3043 run_dpp_pkex_nak_curve_change(dev, apdev)
3045 dev[1].set("dpp_config_processing", "0", allow_fail=True)
3047 def test_dpp_pkex_nak_curve_change2(dev, apdev): argument
3050 run_dpp_pkex_nak_curve_change(dev, apdev, failure=True)
3052 dev[1].set("dpp_config_processing", "0", allow_fail=True)
3054 def run_dpp_pkex_nak_curve_change(dev, apdev, failure=False): argument
3055 check_dpp_capab(dev[0], min_ver=3)
3056 check_dpp_capab(dev[1], min_ver=3)
3062 conf_id = dev[0].dpp_configurator_add()
3063 dev[0].dpp_pkex_init(identifier="test-1", code="secret-1",
3066 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
3069 dev[0].dump_monitor()
3072 dev[1].set("dpp_config_processing", "2")
3073 dev[1].dpp_pkex_resp(2437, identifier="test-2", code="secret-2")
3075 dev[0].dpp_configurator_set(conf_id, net_access_key_curve="prime256v1")
3076 dev[0].dpp_pkex_init(identifier="test-2", code="secret-2",
3078 wait_auth_success(dev[1], dev[0], configurator=dev[0], enrollee=dev[1],
3081 ev = dev[1].wait_event(["DPP-INTRO"], timeout=10)
3087 dev[1].wait_connected()
3088 dev[0].dump_monitor()
3089 dev[1].dump_monitor()
3092 def test_dpp_hostapd_configurator(dev, apdev): argument
3094 run_dpp_hostapd_configurator(dev, apdev)
3096 def test_dpp_hostapd_configurator_enrollee_v1(dev, apdev): argument
3098 check_dpp_capab(dev[0])
3099 dev[0].set("dpp_version_override", "1")
3100 run_dpp_hostapd_configurator(dev, apdev)
3102 def run_dpp_hostapd_configurator(dev, apdev): argument
3103 check_dpp_capab(dev[0])
3108 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
3109 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3116 if "mac_addr=" + dev[0].own_addr() not in res:
3118 dev[0].dpp_listen(2412)
3120 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0],
3123 def test_dpp_hostapd_configurator_responder(dev, apdev): argument
3125 check_dpp_capab(dev[0])
3134 dev[0].dpp_auth_init(uri=uri0, role="enrollee")
3135 wait_auth_success(hapd, dev[0], configurator=hapd, enrollee=dev[0],
3138 def test_dpp_hostapd_configurator_fragmentation(dev, apdev): argument
3140 check_dpp_capab(dev[0])
3145 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
3146 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3153 if "mac_addr=" + dev[0].own_addr() not in res:
3155 dev[0].dpp_listen(2412)
3159 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0],
3162 def test_dpp_hostapd_enrollee_fragmentation(dev, apdev): argument
3164 check_dpp_capab(dev[0])
3168 conf_id = dev[0].dpp_configurator_add()
3169 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3170 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3172 dev[0].set("dpp_config_obj_override", conf)
3173 dev[0].set("dpp_configurator_params",
3175 dev[0].dpp_listen(2437, role="configurator")
3177 wait_auth_success(dev[0], hapd, configurator=dev[0], enrollee=hapd,
3180 def test_dpp_hostapd_enrollee_gas_timeout(dev, apdev): argument
3182 check_dpp_capab(dev[0])
3186 conf_id = dev[0].dpp_configurator_add()
3187 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3188 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3190 dev[0].set("dpp_config_obj_override", conf)
3191 dev[0].set("dpp_configurator_params",
3193 dev[0].set("ext_mgmt_frame_handling", "1")
3194 dev[0].dpp_listen(2437, role="configurator")
3196 process_dpp_frames(dev[0])
3201 def test_dpp_hostapd_enrollee_gas_timeout_comeback(dev, apdev): argument
3203 check_dpp_capab(dev[0])
3207 conf_id = dev[0].dpp_configurator_add()
3208 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3209 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3211 dev[0].set("dpp_config_obj_override", conf)
3212 dev[0].set("dpp_configurator_params",
3214 dev[0].set("ext_mgmt_frame_handling", "1")
3215 dev[0].dpp_listen(2437, role="configurator")
3217 process_dpp_frames(dev[0], count=4)
3222 def process_dpp_frames(dev, count=3): argument
3224 msg = dev.mgmt_rx()
3226 if "OK" not in dev.request(cmd):
3229 def test_dpp_hostapd_enrollee_gas_errors(dev, apdev): argument
3231 check_dpp_capab(dev[0])
3235 conf_id = dev[0].dpp_configurator_add()
3236 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3237 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3238 dev[0].set("dpp_configurator_params",
3240 dev[0].set("ext_mgmt_frame_handling", "1")
3248 dev[0].request("DPP_STOP_LISTEN")
3249 dev[0].dpp_listen(2437, role="configurator")
3250 dev[0].dump_monitor()
3254 process_dpp_frames(dev[0], count=frame_count)
3262 dev[0].set("dpp_config_obj_override", conf)
3268 dev[0].request("DPP_STOP_LISTEN")
3269 dev[0].dpp_listen(2437, role="configurator")
3270 dev[0].dump_monitor()
3274 process_dpp_frames(dev[0], count=frame_count)
3279 def test_dpp_hostapd_enrollee_gas_proto(dev, apdev): argument
3281 check_dpp_capab(dev[0])
3286 conf_id = dev[0].dpp_configurator_add()
3287 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3288 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3289 dev[0].set("dpp_configurator_params",
3292 dev[0].set("dpp_config_obj_override", conf)
3293 dev[0].set("ext_mgmt_frame_handling", "1")
3294 dev[0].dpp_listen(2437, role="configurator")
3296 process_dpp_frames(dev[0], count=3)
3297 msg = dev[0].mgmt_rx()
3305 dev[0].request(cmd)
3309 dev[0].request("DPP_STOP_LISTEN")
3311 dev[0].dump_monitor()
3313 dev[0].dpp_listen(2437, role="configurator")
3315 process_dpp_frames(dev[0], count=3)
3316 msg = dev[0].mgmt_rx()
3324 dev[0].request(cmd)
3325 msg = dev[0].mgmt_rx()
3330 dev[0].request(cmd)
3334 dev[0].request("DPP_STOP_LISTEN")
3336 dev[0].dump_monitor()
3338 dev[0].dpp_listen(2437, role="configurator")
3340 process_dpp_frames(dev[0], count=3)
3341 msg = dev[0].mgmt_rx()
3348 dev[0].request(cmd)
3349 msg = dev[0].mgmt_rx()
3354 dev[0].request(cmd)
3359 dev[0].request(cmd)
3363 dev[0].request("DPP_STOP_LISTEN")
3365 dev[0].dump_monitor()
3367 dev[0].dpp_listen(2437, role="configurator")
3369 process_dpp_frames(dev[0], count=3)
3370 msg = dev[0].mgmt_rx()
3377 dev[0].request(cmd)
3383 dev[0].request(cmd)
3388 dev[0].request(cmd)
3393 dev[0].request(cmd)
3398 dev[0].request(cmd)
3404 dev[0].request(cmd)
3410 dev[0].request(cmd)
3415 dev[0].request(cmd)
3420 dev[0].request(cmd)
3425 dev[0].request(cmd)
3429 dev[0].request("DPP_STOP_LISTEN")
3431 dev[0].dump_monitor()
3433 dev[0].dpp_listen(2437, role="configurator")
3435 process_dpp_frames(dev[0], count=2)
3436 msg = dev[0].mgmt_rx()
3444 dev[0].request(cmd)
3449 dev[0].request(cmd)
3453 dev[0].request("DPP_STOP_LISTEN")
3455 dev[0].dump_monitor()
3457 def test_dpp_hostapd_enrollee_gas_tx_status_errors(dev, apdev): argument
3459 check_dpp_capab(dev[0])
3463 conf_id = dev[0].dpp_configurator_add()
3464 id0 = dev[0].dpp_bootstrap_gen(chan="81/6", mac=True)
3465 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3467 dev[0].set("dpp_config_obj_override", conf)
3468 dev[0].set("dpp_configurator_params",
3470 dev[0].set("ext_mgmt_frame_handling", "1")
3471 dev[0].dpp_listen(2437, role="configurator")
3473 process_dpp_frames(dev[0], count=3)
3483 frame = "d0003a01" + dev[0].own_addr().replace(':', '')
3496 def test_dpp_hostapd_configurator_override_objects(dev, apdev): argument
3498 check_dpp_capab(dev[0])
3503 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
3504 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3509 dev[0].dpp_listen(2412)
3515 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0],
3518 def test_dpp_own_config(dev, apdev): argument
3521 run_dpp_own_config(dev, apdev)
3523 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3525 def test_dpp_own_config_group_id(dev, apdev): argument
3528 run_dpp_own_config(dev, apdev, extra=" group_id=test-group")
3530 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3532 def test_dpp_own_config_curve_mismatch(dev, apdev): argument
3535 run_dpp_own_config(dev, apdev, own_curve="BP-384", expect_failure=True)
3537 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3539 def run_dpp_own_config(dev, apdev, own_curve=None, expect_failure=False, argument
3541 check_dpp_capab(dev[0], own_curve and "BP" in own_curve)
3546 conf_id = dev[0].dpp_configurator_add()
3547 dev[0].dpp_auth_init(uri=uri, conf="ap-dpp", configurator=conf_id,
3549 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd)
3552 dev[0].set("dpp_config_processing", "1")
3555 dev[0].dpp_configurator_set(conf_id, net_access_key_curve=own_curve)
3557 res = dev[0].request(cmd)
3561 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
3565 dev[0].select_network(id, freq="2412")
3567 ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
3570 dev[0].request("DISCONNECT")
3572 dev[0].wait_connected()
3574 def test_dpp_own_config_ap(dev, apdev): argument
3577 run_dpp_own_config_ap(dev, apdev)
3579 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3581 def test_dpp_own_config_ap_group_id(dev, apdev): argument
3584 run_dpp_own_config_ap(dev, apdev, extra=" group_id=test-group")
3586 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3588 def test_dpp_own_config_ap_reconf(dev, apdev): argument
3591 run_dpp_own_config_ap(dev, apdev)
3593 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3595 def run_dpp_own_config_ap(dev, apdev, reconf_configurator=False, extra=None): argument
3596 check_dpp_capab(dev[0])
3615 id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
3616 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
3617 dev[0].set("dpp_config_processing", "2")
3618 dev[0].dpp_listen(2412)
3621 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0])
3622 dev[0].wait_connected()
3624 def test_dpp_intro_mismatch(dev, apdev): argument
3631 run_dpp_intro_mismatch(dev, apdev, wpas)
3633 dev[0].set("dpp_config_processing", "0", allow_fail=True)
3634 dev[2].set("dpp_config_processing", "0", allow_fail=True)
3638 def run_dpp_intro_mismatch(dev, apdev, wpas): argument
3639 check_dpp_capab(dev[0])
3640 check_dpp_capab(dev[1], min_ver=3)
3641 check_dpp_capab(dev[2], min_ver=3)
3648 conf_id = dev[1].dpp_configurator_add()
3649 dev[1].set("dpp_groups_override", '[{"groupId":"a","netRole":"ap"}]')
3650 dev[1].dpp_auth_init(uri=uri, conf="ap-dpp", configurator=conf_id)
3654 dev[0].set("dpp_config_processing", "2")
3655 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
3656 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3657 dev[0].dpp_listen(2412)
3658 dev[1].set("dpp_groups_override", '[{"groupId":"b","netRole":"sta"}]')
3659 dev[1].dpp_auth_init(uri=uri0, conf="sta-dpp", configurator=conf_id)
3660 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
3663 dev[2].set("dpp_config_processing", "2")
3664 id2 = dev[2].dpp_bootstrap_gen(chan="81/1", mac=True)
3665 uri2 = dev[2].request("DPP_BOOTSTRAP_GET_URI %d" % id2)
3666 dev[2].dpp_listen(2412)
3667 conf_id_2 = dev[1].dpp_configurator_add()
3668 dev[1].set("dpp_groups_override", '')
3669 dev[1].dpp_auth_init(uri=uri2, conf="sta-dpp", configurator=conf_id_2)
3670 wait_auth_success(dev[2], dev[1], configurator=dev[1], enrollee=dev[2])
3677 dev[1].set("dpp_groups_override", '')
3678 dev[1].dpp_configurator_set(conf_id, net_access_key_curve="P-521")
3679 dev[1].dpp_auth_init(uri=uri5, conf="sta-dpp", configurator=conf_id)
3680 wait_auth_success(wpas, dev[1], configurator=dev[1], enrollee=wpas)
3683 ev = dev[0].wait_event(["DPP-INTRO"], timeout=10)
3689 ev = dev[2].wait_event(["DPP-INTRO"], timeout=5)
3701 def run_dpp_proto_init(dev, test_dev, test, mutual=False, unicast=True, argument
3704 check_dpp_capab(dev[0])
3705 check_dpp_capab(dev[1])
3706 dev[test_dev].set("dpp_test", str(test))
3708 conf_id = dev[0].dpp_configurator_add()
3710 conf_id = dev[1].dpp_configurator_add()
3711 id0 = dev[0].dpp_bootstrap_gen(chan=chan, mac=unicast)
3712 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
3715 id1b = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
3716 uri1b = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1b)
3718 id0b = dev[0].dpp_qr_code(uri1b)
3728 dev[0].set("dpp_configurator_params",
3736 dev[0].dpp_listen(2412, qr=qr, role=role)
3752 dev[1].dpp_auth_init(uri=uri0, role=role, configurator=configurator,
3756 def test_dpp_proto_after_wrapped_data_auth_req(dev, apdev): argument
3758 run_dpp_proto_init(dev, 1, 1)
3759 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
3764 ev = dev[1].wait_event(["DPP-RX"], timeout=0.1)
3768 def test_dpp_auth_req_stop_after_ack(dev, apdev): argument
3770 run_dpp_proto_init(dev, 1, 1, listen=True)
3771 ev = dev[1].wait_event(["DPP-AUTH-INIT-FAILED"], timeout=5)
3775 def test_dpp_auth_req_retries(dev, apdev): argument
3777 check_dpp_capab(dev[1])
3778 dev[1].set("dpp_init_max_tries", "3")
3779 dev[1].set("dpp_init_retry_time", "1000")
3780 dev[1].set("dpp_resp_wait_time", "100")
3781 run_dpp_proto_init(dev, 1, 1, unicast=False, listen=False)
3784 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
3788 ev = dev[1].wait_event(["DPP-AUTH-INIT-FAILED"], timeout=5)
3792 def test_dpp_auth_req_retries_multi_chan(dev, apdev): argument
3794 check_dpp_capab(dev[1])
3795 dev[1].set("dpp_init_max_tries", "3")
3796 dev[1].set("dpp_init_retry_time", "1000")
3797 dev[1].set("dpp_resp_wait_time", "100")
3798 run_dpp_proto_init(dev, 1, 1, unicast=False, listen=False,
3802 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
3806 ev = dev[1].wait_event(["DPP-AUTH-INIT-FAILED"], timeout=5)
3810 def test_dpp_proto_after_wrapped_data_auth_resp(dev, apdev): argument
3812 run_dpp_proto_init(dev, 0, 2)
3813 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
3818 ev = dev[0].wait_event(["DPP-RX"], timeout=1)
3821 ev = dev[0].wait_event(["DPP-RX"], timeout=0.1)
3825 def test_dpp_proto_after_wrapped_data_auth_conf(dev, apdev): argument
3827 run_dpp_proto_init(dev, 1, 3)
3828 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
3831 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
3837 def test_dpp_proto_after_wrapped_data_conf_req(dev, apdev): argument
3839 run_dpp_proto_init(dev, 0, 6)
3840 ev = dev[1].wait_event(["DPP-CONF-FAILED"], timeout=10)
3844 def test_dpp_proto_after_wrapped_data_conf_resp(dev, apdev): argument
3846 run_dpp_proto_init(dev, 1, 7)
3847 ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=10)
3851 def test_dpp_proto_zero_i_capab(dev, apdev): argument
3853 run_dpp_proto_init(dev, 1, 8)
3854 wait_dpp_fail(dev[0], "Invalid role in I-capabilities 0x00")
3855 ev = dev[1].wait_event(["DPP-RX"], timeout=0.1)
3859 def test_dpp_proto_zero_r_capab(dev, apdev): argument
3861 run_dpp_proto_init(dev, 0, 9)
3862 wait_dpp_fail(dev[1], "Unexpected role in R-capabilities 0x00")
3863 ev = dev[0].wait_event(["DPP-RX"], timeout=1)
3866 ev = dev[0].wait_event(["DPP-RX"], timeout=0.1)
3870 def run_dpp_proto_auth_req_missing(dev, test, reason, mutual=False): argument
3871 run_dpp_proto_init(dev, 1, test, mutual=mutual)
3872 wait_dpp_fail(dev[0], reason)
3873 ev = dev[1].wait_event(["DPP-RX"], timeout=0.1)
3877 def test_dpp_proto_auth_req_no_r_bootstrap_key(dev, apdev): argument
3879 …run_dpp_proto_auth_req_missing(dev, 10, "Missing or invalid required Responder Bootstrapping Key H…
3881 def test_dpp_proto_auth_req_invalid_r_bootstrap_key(dev, apdev): argument
3883 …run_dpp_proto_auth_req_missing(dev, 68, "No matching own bootstrapping key found - ignore message")
3885 def test_dpp_proto_auth_req_no_i_bootstrap_key(dev, apdev): argument
3887 …run_dpp_proto_auth_req_missing(dev, 11, "Missing or invalid required Initiator Bootstrapping Key H…
3889 def test_dpp_proto_auth_req_invalid_i_bootstrap_key(dev, apdev): argument
3891 run_dpp_proto_init(dev, 1, 69, mutual=True)
3892 ev = dev[0].wait_event(["DPP-SCAN-PEER-QR-CODE"], timeout=5)
3895 ev = dev[1].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
3899 def test_dpp_proto_auth_req_no_i_proto_key(dev, apdev): argument
3901 run_dpp_proto_auth_req_missing(dev, 12, "Missing required Initiator Protocol Key attribute")
3903 def test_dpp_proto_auth_req_invalid_i_proto_key(dev, apdev): argument
3905 run_dpp_proto_auth_req_missing(dev, 66, "Invalid Initiator Protocol Key")
3907 def test_dpp_proto_auth_req_no_i_nonce(dev, apdev): argument
3909 run_dpp_proto_auth_req_missing(dev, 13, "Missing or invalid I-nonce")
3911 def test_dpp_proto_auth_req_invalid_i_nonce(dev, apdev): argument
3913 run_dpp_proto_auth_req_missing(dev, 81, "Missing or invalid I-nonce")
3915 def test_dpp_proto_auth_req_no_i_capab(dev, apdev): argument
3917 run_dpp_proto_auth_req_missing(dev, 14, "Missing or invalid I-capab")
3919 def test_dpp_proto_auth_req_no_wrapped_data(dev, apdev): argument
3921 run_dpp_proto_auth_req_missing(dev, 15, "Missing or invalid required Wrapped Data attribute")
3923 def run_dpp_proto_auth_resp_missing(dev, test, reason, argument
3925 run_dpp_proto_init(dev, 0, test, mutual=True,
3929 ev = dev[0].wait_event(["DPP-NOT-COMPATIBLE"], timeout=5)
3934 wait_dpp_fail(dev[1], reason)
3935 ev = dev[0].wait_event(["DPP-RX"], timeout=1)
3938 ev = dev[0].wait_event(["DPP-RX"], timeout=0.1)
3942 def test_dpp_proto_auth_resp_no_status(dev, apdev): argument
3944 run_dpp_proto_auth_resp_missing(dev, 16, "Missing or invalid required DPP Status attribute")
3946 def test_dpp_proto_auth_resp_status_no_status(dev, apdev): argument
3948 run_dpp_proto_auth_resp_missing(dev, 16,
3952 def test_dpp_proto_auth_resp_invalid_status(dev, apdev): argument
3954 run_dpp_proto_auth_resp_missing(dev, 74, "Responder reported failure")
3956 def test_dpp_proto_auth_resp_no_r_bootstrap_key(dev, apdev): argument
3958 …run_dpp_proto_auth_resp_missing(dev, 17, "Missing or invalid required Responder Bootstrapping Key …
3960 def test_dpp_proto_auth_resp_status_no_r_bootstrap_key(dev, apdev): argument
3962 run_dpp_proto_auth_resp_missing(dev, 17,
3966 def test_dpp_proto_auth_resp_invalid_r_bootstrap_key(dev, apdev): argument
3968 run_dpp_proto_auth_resp_missing(dev, 70, "Unexpected Responder Bootstrapping Key Hash value")
3970 def test_dpp_proto_auth_resp_status_invalid_r_bootstrap_key(dev, apdev): argument
3972 run_dpp_proto_auth_resp_missing(dev, 70,
3976 def test_dpp_proto_auth_resp_no_i_bootstrap_key(dev, apdev): argument
3978 run_dpp_proto_auth_resp_missing(dev, 18, None)
3980 def test_dpp_proto_auth_resp_status_no_i_bootstrap_key(dev, apdev): argument
3982 run_dpp_proto_auth_resp_missing(dev, 18, None, incompatible_roles=True)
3984 def test_dpp_proto_auth_resp_invalid_i_bootstrap_key(dev, apdev): argument
3986 …run_dpp_proto_auth_resp_missing(dev, 71, "Initiator Bootstrapping Key Hash attribute did not match…
3988 def test_dpp_proto_auth_resp_status_invalid_i_bootstrap_key(dev, apdev): argument
3990 run_dpp_proto_auth_resp_missing(dev, 71,
3994 def test_dpp_proto_auth_resp_no_r_proto_key(dev, apdev): argument
3996 run_dpp_proto_auth_resp_missing(dev, 19, "Missing required Responder Protocol Key attribute")
3998 def test_dpp_proto_auth_resp_invalid_r_proto_key(dev, apdev): argument
4000 run_dpp_proto_auth_resp_missing(dev, 67, "Invalid Responder Protocol Key")
4002 def test_dpp_proto_auth_resp_no_r_nonce(dev, apdev): argument
4004 run_dpp_proto_auth_resp_missing(dev, 20, "Missing or invalid R-nonce")
4006 def test_dpp_proto_auth_resp_no_i_nonce(dev, apdev): argument
4008 run_dpp_proto_auth_resp_missing(dev, 21, "Missing or invalid I-nonce")
4010 def test_dpp_proto_auth_resp_status_no_i_nonce(dev, apdev): argument
4012 run_dpp_proto_auth_resp_missing(dev, 21, "Missing or invalid I-nonce",
4015 def test_dpp_proto_auth_resp_no_r_capab(dev, apdev): argument
4017 run_dpp_proto_auth_resp_missing(dev, 22, "Missing or invalid R-capabilities")
4019 def test_dpp_proto_auth_resp_no_r_auth(dev, apdev): argument
4021 run_dpp_proto_auth_resp_missing(dev, 23, "Missing or invalid Secondary Wrapped Data")
4023 def test_dpp_proto_auth_resp_no_wrapped_data(dev, apdev): argument
4025 run_dpp_proto_auth_resp_missing(dev, 24, "Missing or invalid required Wrapped Data attribute")
4027 def test_dpp_proto_auth_resp_i_nonce_mismatch(dev, apdev): argument
4029 run_dpp_proto_init(dev, 0, 30, mutual=True)
4030 wait_dpp_fail(dev[1], "I-nonce mismatch")
4031 ev = dev[0].wait_event(["DPP-RX"], timeout=1)
4034 ev = dev[0].wait_event(["DPP-RX"], timeout=0.1)
4038 def test_dpp_proto_auth_resp_incompatible_r_capab(dev, apdev): argument
4040 run_dpp_proto_init(dev, 0, 31, mutual=True)
4041 wait_dpp_fail(dev[1], "Unexpected role in R-capabilities 0x02")
4042 wait_dpp_fail(dev[0], "Peer reported incompatible R-capab role")
4044 def test_dpp_proto_auth_resp_r_auth_mismatch(dev, apdev): argument
4046 run_dpp_proto_init(dev, 0, 32, mutual=True)
4047 wait_dpp_fail(dev[1], "Mismatching Responder Authenticating Tag")
4048 wait_dpp_fail(dev[0], "Peer reported authentication failure")
4050 def test_dpp_proto_auth_resp_r_auth_mismatch_failure(dev, apdev): argument
4052 with alloc_fail(dev[0], 1, "dpp_auth_conf_rx_failure"):
4053 run_dpp_proto_init(dev, 0, 32, mutual=True)
4054 wait_dpp_fail(dev[0], "Authentication failed")
4056 def test_dpp_proto_auth_resp_r_auth_mismatch_failure2(dev, apdev): argument
4058 with fail_test(dev[0], 1, "dpp_auth_conf_rx_failure"):
4059 run_dpp_proto_init(dev, 0, 32, mutual=True)
4060 wait_dpp_fail(dev[0], "AES-SIV decryption failed")
4062 def run_dpp_proto_auth_conf_missing(dev, test, reason): argument
4063 run_dpp_proto_init(dev, 1, test, mutual=True)
4067 wait_dpp_fail(dev[0], reason)
4069 def test_dpp_proto_auth_conf_no_status(dev, apdev): argument
4071 run_dpp_proto_auth_conf_missing(dev, 25, "Missing or invalid required DPP Status attribute")
4073 def test_dpp_proto_auth_conf_invalid_status(dev, apdev): argument
4075 run_dpp_proto_auth_conf_missing(dev, 75, "Authentication failed")
4077 def test_dpp_proto_auth_conf_no_r_bootstrap_key(dev, apdev): argument
4079 …run_dpp_proto_auth_conf_missing(dev, 26, "Missing or invalid required Responder Bootstrapping Key …
4081 def test_dpp_proto_auth_conf_invalid_r_bootstrap_key(dev, apdev): argument
4083 run_dpp_proto_auth_conf_missing(dev, 72, "Responder Bootstrapping Key Hash mismatch")
4085 def test_dpp_proto_auth_conf_no_i_bootstrap_key(dev, apdev): argument
4087 run_dpp_proto_auth_conf_missing(dev, 27, "Missing Initiator Bootstrapping Key Hash attribute")
4089 def test_dpp_proto_auth_conf_invalid_i_bootstrap_key(dev, apdev): argument
4091 run_dpp_proto_auth_conf_missing(dev, 73, "Initiator Bootstrapping Key Hash mismatch")
4093 def test_dpp_proto_auth_conf_no_i_auth(dev, apdev): argument
4095 run_dpp_proto_auth_conf_missing(dev, 28, "Missing or invalid Initiator Authenticating Tag")
4097 def test_dpp_proto_auth_conf_no_wrapped_data(dev, apdev): argument
4099 run_dpp_proto_auth_conf_missing(dev, 29, "Missing or invalid required Wrapped Data attribute")
4101 def test_dpp_proto_auth_conf_i_auth_mismatch(dev, apdev): argument
4103 run_dpp_proto_init(dev, 1, 33, mutual=True)
4104 wait_dpp_fail(dev[0], "Mismatching Initiator Authenticating Tag")
4106 def test_dpp_proto_auth_conf_replaced_by_resp(dev, apdev): argument
4108 run_dpp_proto_init(dev, 1, 65, mutual=True)
4109 wait_dpp_fail(dev[0], "Unexpected Authentication Response")
4111 def run_dpp_proto_conf_req_missing(dev, test, reason): argument
4112 res = run_dpp_proto_init(dev, 0, test)
4113 wait_dpp_fail(dev[1], reason)
4116 def test_dpp_proto_conf_req_no_e_nonce(dev, apdev): argument
4118 res = run_dpp_proto_conf_req_missing(dev, 51,
4122 dev[0].set("dpp_test", "0")
4123 dev[1].dpp_listen(freq=2412)
4124 id0 = dev[1].dpp_bootstrap_gen(chan="81/1", mac=True)
4125 uri0 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
4126 dev[0].dpp_auth_init(uri=uri0)
4127 wait_auth_success(dev[1], dev[0])
4129 def test_dpp_proto_conf_req_invalid_e_nonce(dev, apdev): argument
4131 run_dpp_proto_conf_req_missing(dev, 83,
4134 def test_dpp_proto_conf_req_no_config_attr_obj(dev, apdev): argument
4136 run_dpp_proto_conf_req_missing(dev, 52,
4139 def test_dpp_proto_conf_req_invalid_config_attr_obj(dev, apdev): argument
4141 run_dpp_proto_conf_req_missing(dev, 76,
4144 def test_dpp_proto_conf_req_no_wrapped_data(dev, apdev): argument
4146 run_dpp_proto_conf_req_missing(dev, 53,
4149 def run_dpp_proto_conf_resp_missing(dev, test, reason): argument
4150 run_dpp_proto_init(dev, 1, test)
4151 wait_dpp_fail(dev[0], reason)
4153 def test_dpp_proto_conf_resp_no_e_nonce(dev, apdev): argument
4155 run_dpp_proto_conf_resp_missing(dev, 54,
4158 def test_dpp_proto_conf_resp_no_config_obj(dev, apdev): argument
4160 run_dpp_proto_conf_resp_missing(dev, 55,
4163 def test_dpp_proto_conf_resp_no_status(dev, apdev): argument
4165 run_dpp_proto_conf_resp_missing(dev, 56,
4168 def test_dpp_proto_conf_resp_no_wrapped_data(dev, apdev): argument
4170 run_dpp_proto_conf_resp_missing(dev, 57,
4173 def test_dpp_proto_conf_resp_invalid_status(dev, apdev): argument
4175 run_dpp_proto_conf_resp_missing(dev, 58,
4178 def test_dpp_proto_conf_resp_e_nonce_mismatch(dev, apdev): argument
4180 run_dpp_proto_conf_resp_missing(dev, 59,
4183 def test_dpp_proto_stop_at_auth_req(dev, apdev): argument
4185 run_dpp_proto_init(dev, 0, 87)
4186 ev = dev[1].wait_event(["DPP-AUTH-INIT-FAILED"], timeout=5)
4190 def test_dpp_proto_stop_at_auth_resp(dev, apdev): argument
4192 uri0, role, configurator, conf, own = run_dpp_proto_init(dev, 1, 88)
4194 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4198 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
4202 ev = dev[1].wait_event(["DPP-TX "], timeout=0.1)
4206 ev = dev[0].wait_event(["DPP-FAIL"], timeout=2)
4213 dev[1].set("dpp_test", "0")
4214 dev[1].dpp_auth_init(uri=uri0, role=role, configurator=configurator,
4216 wait_auth_success(dev[0], dev[1])
4218 def test_dpp_proto_stop_at_auth_conf(dev, apdev): argument
4220 run_dpp_proto_init(dev, 0, 89, init_enrollee=True)
4221 ev = dev[1].wait_event(["GAS-QUERY-START"], timeout=10)
4224 ev = dev[1].wait_event(["GAS-QUERY-DONE"], timeout=10)
4230 def test_dpp_proto_stop_at_auth_conf_tx(dev, apdev): argument
4232 run_dpp_proto_init(dev, 1, 89, init_enrollee=True)
4233 wait_auth_success(dev[0], dev[1], timeout=10)
4234 ev = dev[1].wait_event(["GAS-QUERY-START"], timeout=0.1)
4241 def test_dpp_proto_stop_at_auth_conf_tx2(dev, apdev): argument
4243 run_dpp_proto_init(dev, 1, 89)
4244 wait_auth_success(dev[0], dev[1], timeout=10)
4246 ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=5)
4250 def test_dpp_proto_stop_at_conf_req(dev, apdev): argument
4252 run_dpp_proto_init(dev, 1, 90)
4253 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=10)
4256 ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=10)
4262 def run_dpp_proto_init_pkex(dev, test_dev, test): argument
4263 check_dpp_capab(dev[0])
4264 check_dpp_capab(dev[1])
4265 dev[test_dev].set("dpp_test", str(test))
4266 dev[0].dpp_pkex_resp(2437, identifier="test", code="secret")
4267 dev[1].dpp_pkex_init(identifier="test", code="secret")
4269 def test_dpp_proto_after_wrapped_data_pkex_cr_req(dev, apdev): argument
4271 run_dpp_proto_init_pkex(dev, 1, 4)
4272 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
4275 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
4281 def test_dpp_proto_after_wrapped_data_pkex_cr_resp(dev, apdev): argument
4283 run_dpp_proto_init_pkex(dev, 0, 5)
4284 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
4287 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
4293 def run_dpp_proto_pkex_req_missing(dev, test, reason): argument
4294 run_dpp_proto_init_pkex(dev, 1, test)
4295 wait_dpp_fail(dev[0], reason)
4297 def run_dpp_proto_pkex_resp_missing(dev, test, reason): argument
4298 run_dpp_proto_init_pkex(dev, 0, test)
4299 wait_dpp_fail(dev[1], reason)
4301 def test_dpp_proto_pkex_exchange_req_no_finite_cyclic_group(dev, apdev): argument
4303 run_dpp_proto_pkex_req_missing(dev, 34,
4306 def test_dpp_proto_pkex_exchange_req_no_encrypted_key(dev, apdev): argument
4308 run_dpp_proto_pkex_req_missing(dev, 35,
4311 def test_dpp_proto_pkex_exchange_resp_no_status(dev, apdev): argument
4313 run_dpp_proto_pkex_resp_missing(dev, 36, "No DPP Status attribute")
4315 def test_dpp_proto_pkex_exchange_resp_no_encrypted_key(dev, apdev): argument
4317 run_dpp_proto_pkex_resp_missing(dev, 37, "Missing Encrypted Key attribute")
4319 def test_dpp_proto_pkex_cr_req_no_bootstrap_key(dev, apdev): argument
4321 run_dpp_proto_pkex_req_missing(dev, 38,
4324 def test_dpp_proto_pkex_cr_req_no_i_auth_tag(dev, apdev): argument
4326 run_dpp_proto_pkex_req_missing(dev, 39, "No valid u (I-Auth tag) found")
4328 def test_dpp_proto_pkex_cr_req_no_wrapped_data(dev, apdev): argument
4330 run_dpp_proto_pkex_req_missing(dev, 40, "Missing or invalid required Wrapped Data attribute")
4332 def test_dpp_proto_pkex_cr_resp_no_bootstrap_key(dev, apdev): argument
4334 run_dpp_proto_pkex_resp_missing(dev, 41,
4337 def test_dpp_proto_pkex_cr_resp_no_r_auth_tag(dev, apdev): argument
4339 run_dpp_proto_pkex_resp_missing(dev, 42, "No valid v (R-Auth tag) found")
4341 def test_dpp_proto_pkex_cr_resp_no_wrapped_data(dev, apdev): argument
4343 run_dpp_proto_pkex_resp_missing(dev, 43, "Missing or invalid required Wrapped Data attribute")
4345 def test_dpp_proto_pkex_exchange_req_invalid_encrypted_key(dev, apdev): argument
4347 run_dpp_proto_pkex_req_missing(dev, 44,
4350 def test_dpp_proto_pkex_exchange_resp_invalid_encrypted_key(dev, apdev): argument
4352 run_dpp_proto_pkex_resp_missing(dev, 45,
4355 def test_dpp_proto_pkex_exchange_resp_invalid_status(dev, apdev): argument
4357 run_dpp_proto_pkex_resp_missing(dev, 46,
4360 def test_dpp_proto_pkex_cr_req_invalid_bootstrap_key(dev, apdev): argument
4362 run_dpp_proto_pkex_req_missing(dev, 47,
4365 def test_dpp_proto_pkex_cr_resp_invalid_bootstrap_key(dev, apdev): argument
4367 run_dpp_proto_pkex_resp_missing(dev, 48,
4370 def test_dpp_proto_pkex_cr_req_i_auth_tag_mismatch(dev, apdev): argument
4372 run_dpp_proto_pkex_req_missing(dev, 49, "No valid u (I-Auth tag) found")
4374 def test_dpp_proto_pkex_cr_resp_r_auth_tag_mismatch(dev, apdev): argument
4376 run_dpp_proto_pkex_resp_missing(dev, 50, "No valid v (R-Auth tag) found")
4378 def test_dpp_proto_stop_at_pkex_exchange_resp(dev, apdev): argument
4380 run_dpp_proto_init_pkex(dev, 1, 84)
4382 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4386 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
4390 ev = dev[1].wait_event(["DPP-TX "], timeout=0.1)
4394 def test_dpp_proto_stop_at_pkex_cr_req(dev, apdev): argument
4396 run_dpp_proto_init_pkex(dev, 0, 85)
4398 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4402 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
4406 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4410 ev = dev[0].wait_event(["DPP-TX "], timeout=0.1)
4414 def test_dpp_proto_stop_at_pkex_cr_resp(dev, apdev): argument
4416 run_dpp_proto_init_pkex(dev, 1, 86)
4418 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4422 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
4426 ev = dev[1].wait_event(["DPP-TX "], timeout=5)
4430 ev = dev[0].wait_event(["DPP-TX "], timeout=5)
4434 ev = dev[1].wait_event(["DPP-TX "], timeout=0.1)
4438 def test_dpp_proto_network_introduction(dev, apdev): argument
4440 check_dpp_capab(dev[0])
4441 check_dpp_capab(dev[1])
4457 dev[0].set("dpp_test", str(test))
4458 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2",
4464 ev = dev[0].wait_event(["DPP-TX "], timeout=10)
4467 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=2)
4476 ev = dev[0].wait_event(["DPP-INTRO"], timeout=10)
4482 dev[0].request("REMOVE_NETWORK all")
4483 dev[0].dump_monitor()
4485 dev[0].set("dpp_test", "0")
4489 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2",
4495 ev = dev[0].wait_event(["DPP-INTRO"], timeout=10)
4510 dev[0].request("REMOVE_NETWORK all")
4511 dev[0].dump_monitor()
4515 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412", ieee80211w="2",
4519 def test_dpp_hostapd_auth_conf_timeout(dev, apdev): argument
4521 check_dpp_capab(dev[0])
4527 dev[0].set("dpp_test", "88")
4528 dev[0].dpp_auth_init(uri=uri_h)
4535 def test_dpp_hostapd_auth_resp_retries(dev, apdev): argument
4537 check_dpp_capab(dev[0])
4546 id0b = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
4547 uri0b = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0b)
4549 dev[0].dpp_auth_init(uri=uri_h, own=id0b)
4551 ev = dev[0].wait_event(["DPP-RESPONSE-PENDING"], timeout=5)
4560 dev[0].request("DPP_STOP_LISTEN")
4568 dev[0].dump_monitor()
4585 def test_dpp_qr_code_no_chan_list_unicast(dev, apdev): argument
4587 run_dpp_qr_code_chan_list(dev, apdev, True, 2417, None)
4589 def test_dpp_qr_code_chan_list_unicast(dev, apdev): argument
4591 run_dpp_qr_code_chan_list(dev, apdev, True, 2417,
4594 def test_dpp_qr_code_chan_list_unicast2(dev, apdev): argument
4596 run_dpp_qr_code_chan_list(dev, apdev, True, 2417,
4599 def test_dpp_qr_code_chan_list_no_peer_unicast(dev, apdev): argument
4601 run_dpp_qr_code_chan_list(dev, apdev, True, 2417, "81/1,81/6,81/11",
4603 ev = dev[1].wait_event(["DPP-AUTH-INIT-FAILED"], timeout=5)
4607 def test_dpp_qr_code_no_chan_list_broadcast(dev, apdev): argument
4609 run_dpp_qr_code_chan_list(dev, apdev, False, 2412, None, timeout=20)
4611 def test_dpp_qr_code_chan_list_broadcast(dev, apdev): argument
4613 run_dpp_qr_code_chan_list(dev, apdev, False, 2412, "81/1,81/6,81/11",
4616 def run_dpp_qr_code_chan_list(dev, apdev, unicast, listen_freq, chanlist, argument
4618 check_dpp_capab(dev[0])
4619 check_dpp_capab(dev[1])
4620 dev[1].set("dpp_init_max_tries", "3")
4621 dev[1].set("dpp_init_retry_time", "100")
4622 dev[1].set("dpp_resp_wait_time", "1000")
4625 id0 = dev[0].dpp_bootstrap_gen(chan=chanlist, mac=unicast)
4626 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
4628 dev[0].dpp_listen(listen_freq)
4629 dev[1].dpp_auth_init(uri=uri0)
4632 wait_auth_success(dev[0], dev[1], timeout=timeout, configurator=dev[1],
4633 enrollee=dev[0], allow_enrollee_failure=True,
4636 def test_dpp_qr_code_chan_list_no_match(dev, apdev): argument
4638 check_dpp_capab(dev[0])
4639 check_dpp_capab(dev[1])
4640 id0 = dev[0].dpp_bootstrap_gen(chan="123/123")
4641 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
4642 dev[1].dpp_auth_init(uri=uri0, expect_fail=True)
4644 def test_dpp_pkex_alloc_fail(dev, apdev): argument
4646 check_dpp_capab(dev[0])
4647 check_dpp_capab(dev[1])
4652 with alloc_fail(dev[1], count, func):
4654 res = dev[1].request(cmd)
4658 conf_id = dev[1].dpp_configurator_add()
4698 dev[0].request("DPP_STOP_LISTEN")
4699 dev[1].request("DPP_STOP_LISTEN")
4700 dev[0].dump_monitor()
4701 dev[1].dump_monitor()
4702 id0 = dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
4705 with alloc_fail(dev[1], count, func):
4706 id1 = dev[1].dpp_pkex_init(identifier="test", code="secret",
4710 wait_fail_trigger(dev[1], "GET_ALLOC_FAIL", max_iter=100)
4711 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=0.01)
4713 dev[0].request("DPP_STOP_LISTEN")
4714 dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
4748 dev[0].request("DPP_STOP_LISTEN")
4749 dev[1].request("DPP_STOP_LISTEN")
4750 dev[0].dump_monitor()
4751 dev[1].dump_monitor()
4752 id0 = dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
4755 with alloc_fail(dev[0], count, func):
4756 id1 = dev[1].dpp_pkex_init(identifier="test", code="secret",
4759 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL", max_iter=100)
4760 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=0.01)
4762 dev[0].request("DPP_STOP_LISTEN")
4763 dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
4765 def test_dpp_pkex_test_fail(dev, apdev): argument
4767 check_dpp_capab(dev[0])
4768 check_dpp_capab(dev[1])
4772 with fail_test(dev[1], count, func):
4774 res = dev[1].request(cmd)
4780 with fail_test(dev[1], count, func):
4782 res = dev[1].request(cmd)
4786 conf_id = dev[1].dpp_configurator_add()
4811 dev[0].request("DPP_STOP_LISTEN")
4812 dev[1].request("DPP_STOP_LISTEN")
4813 dev[0].dump_monitor()
4814 dev[1].dump_monitor()
4815 id0 = dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
4818 with fail_test(dev[1], count, func):
4819 id1 = dev[1].dpp_pkex_init(identifier="test", code="secret",
4823 wait_fail_trigger(dev[1], "GET_FAIL", max_iter=100)
4824 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=0.01)
4826 dev[0].request("DPP_STOP_LISTEN")
4827 dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
4853 dev[0].request("DPP_STOP_LISTEN")
4854 dev[1].request("DPP_STOP_LISTEN")
4855 dev[0].dump_monitor()
4856 dev[1].dump_monitor()
4857 id0 = dev[0].dpp_pkex_resp(2437, identifier="test", code="secret",
4860 with fail_test(dev[0], count, func):
4861 id1 = dev[1].dpp_pkex_init(identifier="test", code="secret",
4864 wait_fail_trigger(dev[0], "GET_FAIL", max_iter=100)
4865 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=0.01)
4867 dev[0].request("DPP_STOP_LISTEN")
4868 dev[0].wait_event(["GAS-QUERY-DONE"], timeout=3)
4870 def test_dpp_keygen_configurator_error(dev, apdev): argument
4872 check_dpp_capab(dev[0])
4873 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD curve=unknown"):
4876 def rx_process_frame(dev, msg=None): argument
4878 msg = dev.mgmt_rx()
4881 if "OK" not in dev.request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(
4946 def start_dpp(dev): argument
4947 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
4948 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
4951 dev[0].set("dpp_config_obj_override", conf)
4953 dev[0].set("ext_mgmt_frame_handling", "1")
4954 dev[0].dpp_listen(2412)
4955 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
4957 def test_dpp_gas_timeout_handling(dev, apdev): argument
4959 check_dpp_capab(dev[0])
4960 check_dpp_capab(dev[1])
4961 start_dpp(dev)
4964 rx_process_frame(dev[0])
4967 rx_process_frame(dev[0])
4969 res = wait_auth_success(dev[0], dev[1])
4971 msg = dev[0].mgmt_rx_parse(res['responder-mgmt-rx'])
4976 rx_process_frame(dev[0], msg)
4979 rx_process_frame(dev[0])
4982 ev = dev[1].wait_event(["DPP-CONF-FAILED"], timeout=5)
4986 def test_dpp_gas_comeback_after_failure(dev, apdev): argument
4988 check_dpp_capab(dev[0])
4989 check_dpp_capab(dev[1])
4990 start_dpp(dev)
4993 rx_process_frame(dev[0])
4996 rx_process_frame(dev[0])
4998 res = wait_auth_success(dev[0], dev[1])
5000 msg = dev[0].mgmt_rx_parse(res['responder-mgmt-rx'])
5005 rx_process_frame(dev[0], msg)
5008 msg = dev[0].mgmt_rx()
5010 with alloc_fail(dev[0], 1, "gas_build_comeback_resp;gas_server_handle_rx_comeback_req"):
5011 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5013 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
5016 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5020 msg = dev[0].mgmt_rx()
5022 def test_dpp_gas(dev, apdev): argument
5024 ver0 = check_dpp_capab(dev[0])
5025 ver1 = check_dpp_capab(dev[1])
5026 start_dpp(dev)
5029 rx_process_frame(dev[0])
5032 rx_process_frame(dev[0])
5034 res = wait_auth_success(dev[0], dev[1])
5038 msg = dev[0].mgmt_rx_parse(res['responder-mgmt-rx'])
5040 msg = dev[0].mgmt_rx()
5048 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5051 with alloc_fail(dev[0], 1, "gas_server_send_resp"):
5053 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5055 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
5057 with alloc_fail(dev[0], 1, "gas_build_initial_resp;gas_server_send_resp"):
5059 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5061 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
5066 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5070 rx_process_frame(dev[0])
5073 rx_process_frame(dev[0])
5076 rx_process_frame(dev[0])
5080 rx_process_frame(dev[0])
5082 wait_conf_completion(dev[0], dev[1])
5084 def test_dpp_truncated_attr(dev, apdev): argument
5086 check_dpp_capab(dev[0])
5087 check_dpp_capab(dev[1])
5088 start_dpp(dev)
5091 msg = dev[0].mgmt_rx()
5096 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5098 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
5104 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5106 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
5110 def test_dpp_bootstrap_key_autogen_issues(dev, apdev): argument
5112 check_dpp_capab(dev[0])
5113 check_dpp_capab(dev[1])
5116 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5117 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5120 id1 = dev[1].dpp_qr_code(uri0)
5123 dev[0].dpp_listen(2412)
5124 with alloc_fail(dev[1], 1, "dpp_autogen_bootstrap_key"):
5125 dev[1].dpp_auth_init(peer=id1, expect_fail=True)
5126 with alloc_fail(dev[1], 1, "dpp_gen_uri;dpp_autogen_bootstrap_key"):
5127 dev[1].dpp_auth_init(peer=id1, expect_fail=True)
5128 with fail_test(dev[1], 1, "dpp_keygen;dpp_autogen_bootstrap_key"):
5129 dev[1].dpp_auth_init(peer=id1, expect_fail=True)
5130 dev[0].request("DPP_STOP_LISTEN")
5132 def test_dpp_auth_resp_status_failure(dev, apdev): argument
5134 with alloc_fail(dev[0], 1, "dpp_auth_build_resp"):
5135 run_dpp_proto_auth_resp_missing(dev, 99999, None,
5138 def test_dpp_auth_resp_aes_siv_issue(dev, apdev): argument
5140 check_dpp_capab(dev[0])
5141 check_dpp_capab(dev[1])
5143 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5144 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5146 dev[0].dpp_listen(2412)
5147 with fail_test(dev[1], 1, "aes_siv_decrypt;dpp_auth_resp_rx"):
5148 dev[1].dpp_auth_init(uri=uri0)
5149 wait_dpp_fail(dev[1], "AES-SIV decryption failed")
5150 dev[0].request("DPP_STOP_LISTEN")
5152 def test_dpp_invalid_legacy_params(dev, apdev): argument
5154 check_dpp_capab(dev[0])
5155 check_dpp_capab(dev[1])
5156 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5157 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5159 dev[1].dpp_auth_init(uri=uri0, conf="sta-psk", ssid="dpp-legacy",
5162 def test_dpp_invalid_legacy_params2(dev, apdev): argument
5164 check_dpp_capab(dev[0])
5165 check_dpp_capab(dev[1])
5166 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5167 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5168 dev[0].set("dpp_configurator_params",
5170 dev[0].dpp_listen(2412, role="configurator")
5171 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
5173 ev = dev[0].wait_event(["DPP: Failed to set configurator parameters"],
5178 def test_dpp_legacy_params_failure(dev, apdev): argument
5180 check_dpp_capab(dev[0])
5181 check_dpp_capab(dev[1])
5182 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5183 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5184 dev[0].dpp_listen(2412)
5185 with alloc_fail(dev[1], 1, "dpp_build_conf_obj_legacy"):
5186 dev[1].dpp_auth_init(uri=uri0, conf="sta-psk", passphrase="passphrase",
5188 ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=5)
5192 def test_dpp_invalid_configurator_key(dev, apdev): argument
5194 check_dpp_capab(dev[0])
5196 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD key=aa"):
5199 with alloc_fail(dev[0], 1, "dpp_keygen_configurator"):
5200 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD key=" + dpp_key_p256):
5203 with alloc_fail(dev[0], 1,
5205 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD key=" + dpp_key_p256):
5208 with alloc_fail(dev[0], 1, "base64_gen_encode;dpp_keygen_configurator"):
5209 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD key=" + dpp_key_p256):
5212 with fail_test(dev[0], 1, "dpp_keygen_configurator"):
5213 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_ADD key=" + dpp_key_p256):
5216 def test_dpp_own_config_sign_fail(dev, apdev): argument
5218 check_dpp_capab(dev[0])
5219 conf_id = dev[0].dpp_configurator_add()
5226 if "FAIL" not in dev[0].request("DPP_CONFIGURATOR_SIGN " + t):
5229 def test_dpp_peer_intro_failures(dev, apdev): argument
5232 run_dpp_peer_intro_failures(dev, apdev)
5234 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5236 def run_dpp_peer_intro_failures(dev, apdev): argument
5237 check_dpp_capab(dev[0])
5246 conf_id2 = dev[0].dpp_configurator_add(key=csign)
5247 csign2 = dev[0].request("DPP_CONFIGURATOR_GET_KEY %d" % conf_id2)
5258 dev[0].set("dpp_config_processing", "1")
5260 res = dev[0].request(cmd)
5263 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
5267 dev[0].select_network(id, freq=2412)
5268 dev[0].wait_connected()
5269 dev[0].request("DISCONNECT")
5270 dev[0].wait_disconnected()
5271 dev[0].dump_monitor()
5277 dev[0].set_network_quoted(id, "dpp_connector", t)
5278 dev[0].select_network(id, freq=2412)
5279 ev = dev[0].wait_event(["DPP-INTRO"], timeout=5)
5282 dev[0].request("DISCONNECT")
5283 dev[0].dump_monitor()
5285 def test_dpp_peer_intro_local_failures(dev, apdev): argument
5287 check_dpp_capab(dev[0])
5288 check_dpp_capab(dev[1])
5307 with fail_test(dev[0], 1, func):
5308 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
5314 ev = dev[0].wait_event(["DPP-INTRO"], timeout=10)
5317 dev[0].request("REMOVE_NETWORK all")
5318 dev[0].dump_monitor()
5326 with alloc_fail(dev[0], count, func):
5327 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
5333 ev = dev[0].wait_event(["DPP-INTRO"], timeout=10)
5336 dev[0].request("REMOVE_NETWORK all")
5337 dev[0].dump_monitor()
5342 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
5348 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=10)
5351 dev[0].request("REMOVE_NETWORK all")
5352 dev[0].dump_monitor()
5355 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
5361 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=10)
5364 dev[0].request("REMOVE_NETWORK all")
5365 dev[0].dump_monitor()
5368 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
5374 ev = dev[0].wait_event(["DPP-TX-STATUS"], timeout=10)
5377 dev[0].request("REMOVE_NETWORK all")
5379 def run_dpp_configurator_id_unknown(dev): argument
5380 check_dpp_capab(dev)
5381 conf_id = dev.dpp_configurator_add()
5382 if "FAIL" not in dev.request("DPP_CONFIGURATOR_GET_KEY %d" % (conf_id + 1)):
5386 if "FAIL" not in dev.request(cmd):
5389 def test_dpp_configurator_id_unknown(dev, apdev): argument
5391 run_dpp_configurator_id_unknown(dev[0])
5395 def run_dpp_bootstrap_gen_failures(dev): argument
5396 check_dpp_capab(dev)
5405 if "FAIL" not in dev.request("DPP_BOOTSTRAP_GEN " + t):
5408 id = dev.dpp_bootstrap_gen()
5409 uri = dev.request("DPP_BOOTSTRAP_GET_URI %d" % id)
5412 if "FAIL" not in dev.request("DPP_BOOTSTRAP_GET_URI 0"):
5414 info = dev.request("DPP_BOOTSTRAP_INFO %d" % id)
5417 if "FAIL" not in dev.request("DPP_BOOTSTRAP_REMOVE 0"):
5419 if "FAIL" in dev.request("DPP_BOOTSTRAP_REMOVE *"):
5421 if "FAIL" not in dev.request("DPP_BOOTSTRAP_GET_URI %d" % id):
5423 if "FAIL" not in dev.request("DPP_BOOTSTRAP_INFO %d" % id):
5427 with alloc_fail(dev, 1, "=" + func):
5428 if "FAIL" not in dev.request("DPP_BOOTSTRAP_GEN type=qrcode"):
5431 with alloc_fail(dev, 1, "dpp_gen_uri;dpp_bootstrap_gen"):
5432 if "FAIL" not in dev.request("DPP_BOOTSTRAP_GEN type=qrcode"):
5435 with alloc_fail(dev, 1, "get_param"):
5436 dev.request("DPP_BOOTSTRAP_GEN type=qrcode curve=foo")
5438 def test_dpp_bootstrap_gen_failures(dev, apdev): argument
5440 run_dpp_bootstrap_gen_failures(dev[0])
5444 def test_dpp_listen_continue(dev, apdev): argument
5446 check_dpp_capab(dev[0])
5447 check_dpp_capab(dev[1])
5448 id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5449 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
5450 dev[0].dpp_listen(2412)
5452 dev[1].dpp_auth_init(uri=uri)
5453 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
5457 def test_dpp_network_addition_failure(dev, apdev): argument
5460 run_dpp_network_addition_failure(dev, apdev)
5462 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5464 def run_dpp_network_addition_failure(dev, apdev): argument
5465 check_dpp_capab(dev[0])
5466 conf_id = dev[0].dpp_configurator_add()
5467 dev[0].set("dpp_config_processing", "1")
5475 with alloc_fail(dev[0], count, func):
5476 res = dev[0].request(cmd)
5478 ev = dev[0].wait_event(["DPP-NET-ACCESS-KEY"], timeout=2)
5481 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
5482 dev[0].dump_monitor()
5487 with alloc_fail(dev[0], count, func):
5488 res = dev[0].request(cmd)
5490 ev = dev[0].wait_event(["DPP-NET-ACCESS-KEY"], timeout=2)
5493 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
5494 dev[0].dump_monitor()
5496 def test_dpp_two_initiators(dev, apdev): argument
5498 check_dpp_capab(dev[0])
5499 check_dpp_capab(dev[1])
5500 check_dpp_capab(dev[2])
5501 id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5502 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
5503 dev[0].dpp_listen(2412)
5504 peer = dev[2].dpp_qr_code(uri)
5505 dev[1].dpp_auth_init(uri=uri)
5506 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
5509 dev[2].dpp_auth_init(uri=uri, peer=peer)
5510 ev = dev[0].wait_event(["DPP-FAIL"], timeout=5)
5520 ev = dev[0].wait_event(["DPP-CONF-FAILED"], timeout=2)
5523 ev = dev[1].wait_event(["DPP-CONF-SENT"], timeout=2)
5527 dev[0].request("DPP_STOP_LISTEN")
5528 dev[1].request("DPP_STOP_LISTEN")
5529 dev[2].request("DPP_STOP_LISTEN")
5534 def test_dpp_conf_file_update(dev, apdev, params): argument
5543 run_dpp_qr_code_auth_unicast([wpas, dev[1]], apdev, None,
5560 def test_dpp_duplicated_auth_resp(dev, apdev): argument
5562 check_dpp_capab(dev[0])
5563 check_dpp_capab(dev[1])
5564 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5565 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5566 dev[0].set("ext_mgmt_frame_handling", "1")
5567 dev[1].set("ext_mgmt_frame_handling", "1")
5568 dev[0].dpp_listen(2412)
5569 dev[1].dpp_auth_init(uri=uri0)
5572 rx_process_frame(dev[0])
5575 msg = rx_process_frame(dev[1])
5578 …if "OK" not in dev[1].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5584 …if "OK" not in dev[1].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5587 …if "OK" not in dev[1].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5591 rx_process_frame(dev[0])
5593 wait_auth_success(dev[0], dev[1])
5596 rx_process_frame(dev[1])
5599 rx_process_frame(dev[0])
5601 wait_conf_completion(dev[1], dev[0])
5603 def test_dpp_duplicated_auth_conf(dev, apdev): argument
5605 check_dpp_capab(dev[0])
5606 check_dpp_capab(dev[1])
5607 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5608 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5609 dev[0].set("ext_mgmt_frame_handling", "1")
5610 dev[1].set("ext_mgmt_frame_handling", "1")
5611 dev[0].dpp_listen(2412)
5612 dev[1].dpp_auth_init(uri=uri0)
5615 rx_process_frame(dev[0])
5618 rx_process_frame(dev[1])
5621 msg = rx_process_frame(dev[0])
5623 …if "OK" not in dev[0].request("MGMT_RX_PROCESS freq={} datarate={} ssi_signal={} frame={}".format(…
5626 wait_auth_success(dev[0], dev[1])
5629 rx_process_frame(dev[1])
5632 rx_process_frame(dev[0])
5634 wait_conf_completion(dev[1], dev[0])
5636 def test_dpp_enrollee_reject_config(dev, apdev): argument
5638 check_dpp_capab(dev[0])
5639 check_dpp_capab(dev[1])
5640 dev[0].set("dpp_test", "91")
5641 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5642 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5643 dev[0].dpp_listen(2412)
5644 dev[1].dpp_auth_init(uri=uri0, conf="sta-sae", ssid="dpp-legacy",
5646 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
5650 def test_dpp_enrollee_ap_reject_config(dev, apdev): argument
5652 check_dpp_capab(dev[0])
5653 check_dpp_capab(dev[1])
5657 conf_id = dev[0].dpp_configurator_add()
5660 dev[0].dpp_auth_init(uri=uri, conf="ap-dpp", configurator=conf_id)
5661 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
5665 def test_dpp_legacy_and_dpp_akm(dev, apdev): argument
5668 run_dpp_legacy_and_dpp_akm(dev, apdev)
5670 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5672 def run_dpp_legacy_and_dpp_akm(dev, apdev): argument
5673 check_dpp_capab(dev[0], min_ver=2)
5674 check_dpp_capab(dev[1], min_ver=2)
5698 dev[0].request("SET sae_groups ")
5699 conf_id = dev[1].dpp_configurator_add(key=csign)
5700 dev[0].set("dpp_config_processing", "1")
5701 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
5702 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
5703 dev[0].dpp_listen(2412)
5704 dev[1].dpp_auth_init(uri=uri0, conf="sta-psk-sae-dpp", ssid=ssid,
5706 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0],
5709 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
5714 key_mgmt = dev[0].get_network(id0, "key_mgmt").split(' ')
5719 dev[0].scan_for_bss(hapd.own_addr(), freq=2412)
5720 dev[0].select_network(id0, freq=2412)
5721 dev[0].wait_connected()
5723 dev[0].request("DISCONNECT")
5724 dev[0].wait_disconnected()
5736 dev[0].request("BSS_FLUSH 0")
5737 dev[0].scan_for_bss(hapd2.own_addr(), freq=2412, force_scan=True,
5739 dev[0].select_network(id0, freq=2412)
5740 dev[0].wait_connected()
5742 dev[0].request("DISCONNECT")
5743 dev[0].wait_disconnected()
5745 def test_dpp_controller_relay(dev, apdev, params): argument
5748 run_dpp_controller_relay(dev, apdev, params)
5750 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5751 dev[1].request("DPP_CONTROLLER_STOP")
5753 def test_dpp_controller_relay_chirp(dev, apdev, params): argument
5756 run_dpp_controller_relay(dev, apdev, params, chirp=True)
5758 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5759 dev[1].request("DPP_CONTROLLER_STOP")
5761 def test_dpp_controller_relay_chirp_duplicate(dev, apdev, params): argument
5764 run_dpp_controller_relay(dev, apdev, params, chirp=True,
5767 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5768 dev[1].request("DPP_CONTROLLER_STOP")
5770 def test_dpp_controller_relay_discover(dev, apdev, params): argument
5773 run_dpp_controller_relay(dev, apdev, params, chirp=True, discover=True)
5775 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5776 dev[1].request("DPP_CONTROLLER_STOP")
5778 def run_dpp_controller_relay(dev, apdev, params, chirp=False, discover=False, argument
5780 check_dpp_capab(dev[0], min_ver=2)
5781 check_dpp_capab(dev[1], min_ver=2)
5785 run_dpp_controller_relay2(dev, apdev, params, chirp, discover,
5788 def run_dpp_controller_relay2(dev, apdev, params, chirp=False, discover=False, argument
5791 conf_id = dev[1].dpp_configurator_add()
5792 dev[1].set("dpp_configurator_params",
5794 id_c = dev[1].dpp_bootstrap_gen()
5795 uri_c = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id_c)
5796 res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
5805 if "OK" not in dev[1].request("DPP_CONTROLLER_START"):
5828 dev[1].dpp_auth_init(uri=uri_r, conf="ap-dpp", configurator=conf_id)
5829 wait_auth_success(relay, dev[1], configurator=dev[1], enrollee=relay)
5832 dev[0].flush_scan_cache()
5836 dev[0].set("dpp_config_processing", "2")
5838 id1 = dev[0].dpp_bootstrap_gen()
5839 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
5840 idc = dev[1].dpp_qr_code(uri)
5841 dev[1].dpp_bootstrap_set(idc, conf="sta-dpp", configurator=conf_id)
5844 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=5" % id1):
5863 dev[0].dpp_auth_init(uri=uri_c, role="enrollee")
5872 wait_auth_success(dev[1], dev[0], configurator=dev[1], enrollee=dev[0],
5876 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
5880 dev[0].wait_connected()
5882 dev[0].dump_monitor()
5883 dev[0].request("DISCONNECT")
5884 dev[0].wait_disconnected()
5885 dev[0].dump_monitor()
5888 if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
5890 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
5896 dev[0].wait_connected()
5899 def test_dpp_controller_init_through_relay(dev, apdev, params): argument
5902 run_dpp_controller_init_through_relay(dev, apdev, params)
5904 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5905 dev[1].request("DPP_CONTROLLER_STOP")
5907 def test_dpp_controller_init_through_relay_dynamic(dev, apdev, params): argument
5910 run_dpp_controller_init_through_relay(dev, apdev, params, dynamic=True)
5912 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5913 dev[1].request("DPP_CONTROLLER_STOP")
5915 def test_dpp_controller_init_through_relay_add(dev, apdev, params): argument
5918 run_dpp_controller_init_through_relay(dev, apdev, params, add=True)
5920 dev[0].set("dpp_config_processing", "0", allow_fail=True)
5921 dev[1].request("DPP_CONTROLLER_STOP")
5923 def run_dpp_controller_init_through_relay(dev, apdev, params, dynamic=False, argument
5925 check_dpp_capab(dev[0], min_ver=2)
5926 check_dpp_capab(dev[1], min_ver=2)
5930 run_dpp_controller_init_through_relay2(dev, apdev, params, dynamic,
5933 def run_dpp_controller_init_through_relay2(dev, apdev, params, dynamic=False, argument
5936 conf_id = dev[1].dpp_configurator_add()
5937 dev[1].set("dpp_configurator_params",
5940 id_c = dev[1].dpp_bootstrap_gen()
5941 res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
5950 if "OK" not in dev[1].request("DPP_CONTROLLER_START"):
5967 dev[1].dpp_auth_init(uri=uri_r, conf="ap-dpp", configurator=conf_id)
5968 wait_auth_success(relay, dev[1], configurator=dev[1], enrollee=relay)
5971 dev[0].flush_scan_cache()
5974 dev[0].set("dpp_config_processing", "2")
5975 dev[0].dpp_listen(2437)
5976 id_e = dev[0].dpp_bootstrap_gen()
5977 uri_e = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id_e)
5978 dev[1].dpp_auth_init(uri=uri_e, conf="sta-dpp", configurator=conf_id,
5980 wait_auth_success(dev[1], dev[0], configurator=dev[1], enrollee=dev[0],
5983 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
5987 dev[0].wait_connected()
5989 dev[0].dump_monitor()
5990 dev[0].request("DISCONNECT")
5991 dev[0].wait_disconnected()
5993 dev[0].dump_monitor()
6000 if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
6002 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
6008 dev[0].wait_connected()
6022 def test_dpp_relay_incomplete_connections(dev, apdev): argument
6024 check_dpp_capab(dev[0], min_ver=2)
6025 check_dpp_capab(dev[1], min_ver=2)
6027 id_c = dev[1].dpp_bootstrap_gen()
6028 uri_c = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id_c)
6029 res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
6049 dev[0].dpp_auth_init(uri=uri_c, role="enrollee")
6053 dev[0].request("DPP_STOP_LISTEN")
6067 def test_dpp_tcp(dev, apdev, params): argument
6072 run_dpp_tcp(dev[0], dev[1], cap_lo)
6074 dev[1].request("DPP_CONTROLLER_STOP")
6076 def test_dpp_tcp_port(dev, apdev, params): argument
6081 run_dpp_tcp(dev[0], dev[1], cap_lo, port="23456")
6083 dev[1].request("DPP_CONTROLLER_STOP")
6085 def test_dpp_tcp_mutual(dev, apdev, params): argument
6089 run_dpp_tcp(dev[0], dev[1], cap_lo, mutual=True)
6091 dev[1].request("DPP_CONTROLLER_STOP")
6093 def test_dpp_tcp_mutual_hostapd_conf(dev, apdev, params): argument
6097 run_dpp_tcp(dev[0], hapd, cap_lo, mutual=True)
6161 def test_dpp_tcp_conf_init(dev, apdev, params): argument
6165 run_dpp_tcp_conf_init(dev[0], dev[1], cap_lo)
6167 dev[1].request("DPP_CONTROLLER_STOP")
6169 def test_dpp_tcp_conf_init_hostapd_enrollee(dev, apdev, params): argument
6173 run_dpp_tcp_conf_init(dev[0], hapd, cap_lo, conf="ap-dpp")
6200 def test_dpp_tcp_controller_management_hostapd(dev, apdev, params): argument
6214 def test_dpp_tcp_controller_management_hostapd2(dev, apdev, params): argument
6216 check_dpp_capab(dev[0], min_ver=2)
6226 conf_id = dev[0].dpp_configurator_add()
6227 dev[0].dpp_auth_init(uri=uri_c, role="configurator", conf="sta-dpp",
6229 ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5)
6232 ev = dev[0].wait_event(["DPP-CONF-SENT"], timeout=5)
6239 dev[0].dpp_auth_init(uri=uri_c, role="configurator", conf="sta-dpp",
6241 ev = dev[0].wait_event(["DPP-AUTH-SUCCESS"], timeout=5)
6245 def test_dpp_tcp_controller_start_failure(dev, apdev, params): argument
6247 check_dpp_capab(dev[0])
6250 if "OK" not in dev[0].request("DPP_CONTROLLER_START"):
6252 if "OK" in dev[0].request("DPP_CONTROLLER_START"):
6255 dev[0].request("DPP_CONTROLLER_STOP")
6260 with alloc_fail(dev[0], 1, func):
6261 if "FAIL" not in dev[0].request("DPP_CONTROLLER_START"):
6264 def test_dpp_tcp_init_failure(dev, apdev, params): argument
6266 check_dpp_capab(dev[0])
6267 check_dpp_capab(dev[1])
6268 id_c = dev[1].dpp_bootstrap_gen()
6269 uri_c = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id_c)
6270 peer = dev[0].dpp_qr_code(uri_c)
6276 with alloc_fail(dev[0], 1, func):
6277 if "FAIL" not in dev[0].request(cmd):
6280 def test_dpp_controller_rx_failure(dev, apdev, params): argument
6282 check_dpp_capab(dev[0])
6283 check_dpp_capab(dev[1])
6285 run_dpp_controller_rx_failure(dev, apdev)
6287 dev[0].request("DPP_CONTROLLER_STOP")
6289 def run_dpp_controller_rx_failure(dev, apdev): argument
6290 if "OK" not in dev[0].request("DPP_CONTROLLER_START"):
6292 id_c = dev[0].dpp_bootstrap_gen()
6293 uri_c = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id_c)
6294 peer = dev[1].dpp_qr_code(uri_c)
6302 with alloc_fail(dev[0], 1, func):
6303 if "OK" not in dev[1].request(cmd):
6305 wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
6307 def test_dpp_controller_rx_errors(dev, apdev, params): argument
6309 check_dpp_capab(dev[0])
6310 check_dpp_capab(dev[1])
6312 run_dpp_controller_rx_errors(dev, apdev)
6314 dev[0].request("DPP_CONTROLLER_STOP")
6316 def run_dpp_controller_rx_errors(dev, apdev): argument
6317 if "OK" not in dev[0].request("DPP_CONTROLLER_START"):
6358 def test_dpp_conn_status_success(dev, apdev): argument
6361 run_dpp_conn_status(dev, apdev)
6363 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6365 def test_dpp_conn_status_wrong_passphrase(dev, apdev): argument
6368 run_dpp_conn_status(dev, apdev, result=2)
6370 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6372 def test_dpp_conn_status_no_ap(dev, apdev): argument
6375 run_dpp_conn_status(dev, apdev, result=10)
6377 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6379 def test_dpp_conn_status_connector_mismatch(dev, apdev): argument
6382 run_dpp_conn_status(dev, apdev, result=8)
6384 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6386 def test_dpp_conn_status_assoc_reject(dev, apdev): argument
6389 dev[0].request("TEST_ASSOC_IE 30020000")
6390 run_dpp_conn_status(dev, apdev, assoc_reject=True)
6392 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6394 def run_dpp_conn_status(dev, apdev, result=0, assoc_reject=False): argument
6395 check_dpp_capab(dev[0], min_ver=2)
6396 check_dpp_capab(dev[1], min_ver=2)
6420 dev[0].request("SET sae_groups ")
6421 dev[0].set("dpp_config_processing", "2")
6422 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
6423 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
6425 dev[0].dpp_listen(2412)
6429 configurator = dev[1].dpp_configurator_add()
6434 dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid="dpp-status",
6437 res = wait_auth_success(dev[0], dev[1], configurator=dev[1],
6438 enrollee=dev[0])
6444 ev = dev[1].wait_event(["DPP-CONN-STATUS-RESULT"], timeout=20)
6455 dev[0].wait_connected()
6459 def test_dpp_conn_status_success_hostapd_configurator(dev, apdev): argument
6462 run_dpp_conn_status_hostapd_configurator(dev, apdev)
6464 dev[0].set("dpp_config_processing", "0", allow_fail=True)
6466 def run_dpp_conn_status_hostapd_configurator(dev, apdev): argument
6467 check_dpp_capab(dev[0])
6479 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
6480 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
6487 if "mac_addr=" + dev[0].own_addr() not in res:
6489 dev[0].set("dpp_config_processing", "2")
6490 dev[0].dpp_listen(2412)
6493 res = wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0])
6502 def test_dpp_mud_url(dev, apdev): argument
6504 check_dpp_capab(dev[0])
6506 dev[0].set("dpp_name", "Test Enrollee")
6507 dev[0].set("dpp_mud_url", "https://example.com/mud")
6508 run_dpp_qr_code_auth_unicast(dev, apdev, None)
6510 dev[0].set("dpp_mud_url", "")
6511 dev[0].set("dpp_name", "Test")
6513 def test_dpp_mud_url_hostapd(dev, apdev): argument
6515 check_dpp_capab(dev[0])
6516 check_dpp_capab(dev[1])
6526 conf_id = dev[0].dpp_configurator_add()
6527 dev[0].dpp_auth_init(uri=uri, conf="ap-dpp", configurator=conf_id)
6528 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd)
6531 def test_dpp_config_save(dev, apdev, params): argument
6534 run_dpp_config_save(dev, apdev, config, "test", '"test"')
6536 def test_dpp_config_save2(dev, apdev, params): argument
6539 run_dpp_config_save(dev, apdev, config, "\\u0001*", '012a')
6541 def test_dpp_config_save3(dev, apdev, params): argument
6544 …run_dpp_config_save(dev, apdev, config, "\\u0001*\\u00c2\\u00bc\\u00c3\\u009e\\u00c3\\u00bf", '012…
6546 def run_dpp_config_save(dev, apdev, config, conf_ssid, exp_ssid): argument
6547 check_dpp_capab(dev[1])
6555 dev[1].set("dpp_config_obj_override", conf)
6556 dpp_dev = [wpas, dev[1]]
6569 def test_dpp_nfc_uri(dev, apdev): argument
6571 check_dpp_capab(dev[0])
6572 check_dpp_capab(dev[1])
6574 id = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/1", mac=True)
6575 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
6577 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
6582 dev[0].dpp_listen(2412)
6583 conf_id = dev[1].dpp_configurator_add()
6584 dev[1].dpp_auth_init(nfc_uri=uri, configurator=conf_id, conf="sta-dpp")
6585 wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])
6587 def test_dpp_nfc_uri_hostapd(dev, apdev): argument
6589 check_dpp_capab(dev[0])
6603 conf_id = dev[0].dpp_configurator_add()
6604 dev[0].dpp_auth_init(nfc_uri=uri, configurator=conf_id, conf="ap-dpp")
6605 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd)
6607 def test_dpp_nfc_uri_hostapd_tag_read(dev, apdev): argument
6609 check_dpp_capab(dev[0])
6614 id = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/1", mac=True)
6615 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
6616 info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
6617 conf_id = dev[0].dpp_configurator_add()
6618 dev[0].set("dpp_configurator_params",
6620 dev[0].dpp_listen(2412)
6623 wait_auth_success(dev[0], hapd, configurator=dev[0], enrollee=hapd)
6625 def test_dpp_nfc_negotiated_handover(dev, apdev): argument
6627 run_dpp_nfc_negotiated_handover(dev)
6629 def test_dpp_nfc_negotiated_handover_diff_curve(dev, apdev): argument
6631 run_dpp_nfc_negotiated_handover(dev, curve0="prime256v1",
6634 def test_dpp_nfc_negotiated_handover_hostapd_sel(dev, apdev): argument
6639 run_dpp_nfc_negotiated_handover([dev[0], hapd], conf="ap-dpp")
6641 def test_dpp_nfc_negotiated_handover_hostapd_req(dev, apdev): argument
6646 run_dpp_nfc_negotiated_handover([hapd, dev[0]])
6648 def run_dpp_nfc_negotiated_handover(dev, curve0=None, curve1=None, argument
6650 check_dpp_capab(dev[0])
6651 check_dpp_capab(dev[1])
6653 id0 = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/6,11", mac=True,
6655 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
6657 id1 = dev[1].dpp_bootstrap_gen(type="nfc-uri", chan="81/1,6,11", mac=True,
6659 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6664 res = dev[1].request("DPP_NFC_HANDOVER_REQ own=%d uri=%s" % (id1, uri0))
6667 info = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id1)
6675 uri1 = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6677 dev[1].dpp_listen(freq)
6678 res = dev[0].request("DPP_NFC_HANDOVER_SEL own=%d uri=%s" % (id0, uri1))
6683 conf_id = dev[0].dpp_configurator_add()
6684 dev[0].dpp_auth_init(peer=peer, own=id0, configurator=conf_id,
6686 wait_auth_success(dev[1], dev[0], configurator=dev[0], enrollee=dev[1])
6688 def test_dpp_nfc_errors_hostapd(dev, apdev): argument
6690 check_dpp_capab(dev[0])
6691 check_dpp_capab(dev[1])
6693 id0 = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/11", mac=True,
6695 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
6722 def test_dpp_with_p2p_device(dev, apdev): argument
6724 check_dpp_capab(dev[0])
6733 dev[0].dpp_auth_init(uri=uri1)
6734 wait_auth_success(wpas, dev[0], configurator=dev[0], enrollee=wpas,
6738 def test_dpp_chirp(dev, apdev): argument
6740 check_dpp_capab(dev[0])
6741 dev[0].flush_scan_cache()
6749 id1 = dev[0].dpp_bootstrap_gen(chan="81/1")
6750 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=5" % id1):
6756 ev = dev[0].wait_event(["DPP-CHIRP-STOPPED",
6783 if "src=" + dev[0].own_addr() not in ev:
6787 def test_dpp_chirp_listen(dev, apdev): argument
6789 check_dpp_capab(dev[0])
6790 check_dpp_capab(dev[1])
6792 id1 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
6793 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6795 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2 listen=2412" % id1):
6798 ev = dev[0].wait_event(["DPP-CHIRP-STOPPED",
6805 def test_dpp_chirp_configurator(dev, apdev): argument
6807 check_dpp_capab(dev[0])
6808 check_dpp_capab(dev[1])
6810 id1 = dev[0].dpp_bootstrap_gen(chan="81/1")
6811 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6813 conf_id = dev[1].dpp_configurator_add()
6814 idc = dev[1].dpp_qr_code(uri)
6815 dev[1].dpp_bootstrap_set(idc, conf="sta-dpp", configurator=conf_id)
6816 dev[1].dpp_listen(2437)
6818 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2" % id1):
6821 ev = dev[1].wait_event(["DPP-RX"], timeout=10)
6827 ev = dev[1].wait_event(["DPP-TX"], timeout=10)
6832 if "dst=" + dev[0].own_addr() not in ev:
6835 wait_auth_success(dev[0], dev[1], dev[1], dev[0])
6837 def test_dpp_chirp_ap_as_configurator(dev, apdev): argument
6839 check_dpp_capab(dev[0], min_ver=2)
6844 id1 = dev[0].dpp_bootstrap_gen(chan="81/1")
6845 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6852 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2" % id1):
6855 wait_auth_success(dev[0], hapd, hapd, dev[0])
6857 def test_dpp_chirp_configurator_inits(dev, apdev): argument
6859 check_dpp_capab(dev[0])
6860 check_dpp_capab(dev[1])
6862 id1 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
6863 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
6865 conf_id = dev[1].dpp_configurator_add()
6866 idc = dev[1].dpp_qr_code(uri)
6868 if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2 listen=2412" % id1):
6871 ev = dev[0].wait_event(["DPP-TX "], timeout=10)
6875 dev[1].dpp_auth_init(uri=uri, conf="sta-dpp", configurator=conf_id)
6876 wait_auth_success(dev[0], dev[1], dev[1], dev[0], timeout=10)
6878 def test_dpp_chirp_ap(dev, apdev): argument
6880 check_dpp_capab(dev[0], min_ver=2)
6889 conf_id = dev[0].dpp_configurator_add()
6890 idc = dev[0].dpp_qr_code(uri)
6891 dev[0].dpp_bootstrap_set(idc, conf="ap-dpp", configurator=conf_id)
6892 dev[0].dpp_listen(2437)
6895 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
6900 def test_dpp_chirp_ap_5g(dev, apdev): argument
6902 check_dpp_capab(dev[0], min_ver=2)
6955 conf_id = dev[0].dpp_configurator_add()
6956 idc = dev[0].dpp_qr_code(uri)
6957 dev[0].dpp_bootstrap_set(idc, conf="ap-dpp", configurator=conf_id)
6958 dev[0].dpp_listen(5200)
6965 wait_auth_success(hapd, dev[0], configurator=dev[0], enrollee=hapd,
6969 clear_regdom(hapd, dev)
6972 def test_dpp_chirp_ap_errors(dev, apdev): argument
7011 def run_dpp_pfs_sta(dev, pfs, fail=False, pfs_expected=None, sae=False): argument
7014 dev.connect("dpp", key_mgmt=key_mgmt, scan_freq="2412",
7023 ev = dev.wait_event(["CTRL-EVENT-ASSOC-REJECT",
7029 dev.request("REMOVE_NETWORK all")
7032 res = dev.get_status_field("dpp_pfs")
7036 dev.request("REMOVE_NETWORK all")
7037 dev.wait_disconnected()
7038 dev.dump_monitor()
7040 def test_dpp_pfs_ap_0(dev, apdev): argument
7042 check_dpp_capab(dev[0])
7044 run_dpp_pfs_sta(dev[0], 0, pfs_expected=True)
7045 run_dpp_pfs_sta(dev[0], 1, pfs_expected=True)
7046 run_dpp_pfs_sta(dev[0], 2, pfs_expected=False)
7048 def test_dpp_pfs_ap_1(dev, apdev): argument
7050 check_dpp_capab(dev[0])
7052 run_dpp_pfs_sta(dev[0], 0, pfs_expected=True)
7053 run_dpp_pfs_sta(dev[0], 1, pfs_expected=True)
7054 run_dpp_pfs_sta(dev[0], 2, fail=True)
7056 def test_dpp_pfs_ap_2(dev, apdev): argument
7058 check_dpp_capab(dev[0])
7060 run_dpp_pfs_sta(dev[0], 0, pfs_expected=False)
7061 run_dpp_pfs_sta(dev[0], 1, fail=True)
7062 run_dpp_pfs_sta(dev[0], 2, pfs_expected=False)
7064 def test_dpp_pfs_connect_cmd(dev, apdev): argument
7074 def test_dpp_pfs_connect_cmd_ap_2(dev, apdev): argument
7084 def test_dpp_pfs_connect_cmd_ap_2_sae(dev, apdev): argument
7095 def test_dpp_pfs_ap_0_sta_ver1(dev, apdev): argument
7097 check_dpp_capab(dev[0])
7098 dev[0].set("dpp_version_override", "1")
7100 run_dpp_pfs_sta(dev[0], 0, pfs_expected=False)
7102 def test_dpp_pfs_errors(dev, apdev): argument
7104 check_dpp_capab(dev[0], min_ver=2)
7110 with alloc_fail(dev[0], count, func):
7111 dev[0].connect("dpp", key_mgmt="DPP", scan_freq="2412",
7116 dev[0].request("REMOVE_NETWORK all")
7117 dev[0].wait_disconnected()
7118 dev[0].dump_monitor()
7121 def test_dpp_reconfig_connector(dev, apdev): argument
7124 run_dpp_reconfig_connector(dev, apdev)
7126 dev[0].set("dpp_config_processing", "0", allow_fail=True)
7128 def test_dpp_reconfig_connector_different_groups(dev, apdev): argument
7131 run_dpp_reconfig_connector(dev, apdev, conf_curve="secp384r1")
7133 dev[0].set("dpp_config_processing", "0", allow_fail=True)
7136 def test_dpp_reconfig_retries(dev, apdev): argument
7139 run_dpp_reconfig_connector(dev, apdev, test_retries=True)
7141 ev = dev[0].wait_event(["DPP-TX "], timeout=120)
7144 dev[0].request("DPP_STOP_LISTEN")
7146 dev[0].set("dpp_config_processing", "0", allow_fail=True)
7148 def run_dpp_reconfig_connector(dev, apdev, conf_curve=None, argument
7150 check_dpp_capab(dev[0], min_ver=2)
7151 check_dpp_capab(dev[1], min_ver=2)
7159 dev[0].set("dpp_config_processing", "2")
7160 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7161 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7162 dev[0].dpp_listen(2412)
7163 configurator = dev[1].dpp_configurator_add(curve=conf_curve)
7165 dev[1].dpp_auth_init(uri=uri0, conf=conf, ssid=ssid,
7168 res = wait_auth_success(dev[0], dev[1], configurator=dev[1],
7169 enrollee=dev[0])
7172 ev = dev[1].wait_event(["DPP-CONN-STATUS-RESULT"], timeout=20)
7175 dev[1].dump_monitor()
7177 ev = dev[0].wait_event(["DPP-CONFOBJ-SSID"], timeout=1)
7184 ev = dev[0].wait_event(["DPP-CONNECTOR"], timeout=1)
7189 ev = dev[0].wait_event(["DPP-C-SIGN-KEY"], timeout=1)
7195 ev = dev[0].wait_event(["DPP-NET-ACCESS-KEY"], timeout=1)
7202 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
7207 dev[0].wait_connected()
7209 n_key_mgmt = dev[0].get_network(id, "key_mgmt")
7212 n_connector = dev[0].get_network(id, "dpp_connector")
7215 n_csign = dev[0].get_network(id, "dpp_csign")
7218 n_net_access_key = dev[0].get_network(id, "dpp_netaccesskey")
7223 dev[0].request("DISCONNECT")
7224 dev[0].wait_disconnected()
7231 dev[0].dump_monitor()
7232 dev[1].dump_monitor()
7235 dev[1].request("DPP_STOP_LISTEN")
7236 if "OK" not in dev[0].request("DPP_RECONFIG %s iter=10" % id):
7240 dev[1].set("dpp_configurator_params",
7242 dev[1].dpp_listen(2437)
7244 if "OK" not in dev[0].request("DPP_RECONFIG %s" % id):
7246 ev = dev[0].wait_event(["DPP-TX "], timeout=10)
7250 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
7256 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
7260 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
7264 ev = dev[0].wait_event(["DPP-RX"], timeout=5)
7268 ev = dev[0].wait_event(["GAS-QUERY-START"], timeout=5)
7272 ev = dev[1].wait_event(["DPP-CONF-REQ-RX"], timeout=5)
7276 ev = dev[0].wait_event(["GAS-QUERY-DONE"], timeout=5)
7280 ev = dev[1].wait_event(["DPP-RX"], timeout=5)
7284 ev = dev[1].wait_event(["DPP-CONF-SENT"], timeout=5)
7288 ev = dev[0].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"], timeout=5)
7294 dev[0].wait_connected()
7296 ev = dev[1].wait_event(["DPP-CONN-STATUS-RESULT"], timeout=20)
7300 def test_dpp_reconfig_hostapd_configurator(dev, apdev): argument
7303 run_dpp_reconfig_hostapd_configurator(dev, apdev)
7305 dev[0].set("dpp_config_processing", "0", allow_fail=True)
7307 def run_dpp_reconfig_hostapd_configurator(dev, apdev): argument
7309 check_dpp_capab(dev[0], min_ver=2)
7321 id = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7322 uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
7323 dev[0].set("dpp_config_processing", "2")
7324 dev[0].dpp_listen(2412)
7327 wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0])
7328 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
7332 dev[0].wait_connected()
7334 dev[0].request("DISCONNECT")
7335 dev[0].wait_disconnected()
7337 dev[0].dump_monitor()
7339 if "FAIL" in dev[0].request("PMKSA_FLUSH"):
7341 dev[0].request("RECONNECT")
7342 ev = dev[0].wait_event(["DPP-MISSING-CONNECTOR", "CTRL-EVENT-CONNECTED"],
7348 dev[0].request("DISCONNECT")
7349 dev[0].dump_monitor()
7354 if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
7356 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
7362 dev[0].wait_connected()
7365 def test_dpp_qr_code_auth_rand_mac_addr(dev, apdev): argument
7367 flags = int(dev[0].get_driver_status_field('capa.flags'), 16)
7372 dev[0].set("gas_rand_mac_addr", "1")
7373 run_dpp_qr_code_auth_unicast(dev, apdev, None)
7375 dev[0].set("gas_rand_mac_addr", "0")
7400 def test_dpp_enterprise(dev, apdev, params): argument
7402 check_dpp_capab(dev[0], min_ver=2)
7404 dev[0].set("dpp_config_processing", "2")
7405 run_dpp_enterprise(dev, apdev, params)
7407 dev[0].set("dpp_config_processing", "0", allow_fail=True)
7409 def run_dpp_enterprise(dev, apdev, params): argument
7412 check_dpp_capab(dev[0])
7413 check_dpp_capab(dev[1])
7439 conf_id = dev[1].dpp_configurator_add()
7440 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7441 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7442 dev[0].dpp_listen(2412)
7444 id1 = dev[1].dpp_auth_init(uri=uri0, configurator=conf_id, conf="sta-dot1x",
7447 ev = dev[1].wait_event(["DPP-CSR"], timeout=10)
7475 res = dev[1].request("DPP_CA_SET peer=%d name=trustedEapServerName value=%s" % (id1, name))
7482 res = dev[1].request("DPP_CA_SET peer=%d name=certBag value=%s" % (id1, certbag))
7486 ev = dev[1].wait_event(["DPP-CONF-SENT", "DPP-CONF-FAILED"], timeout=5)
7492 ev = dev[0].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"],
7499 ev = dev[0].wait_event(["DPP-CERTBAG"], timeout=1)
7510 ev = dev[0].wait_event(["DPP-SERVER-NAME"], timeout=1)
7516 ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=1)
7521 dev[0].wait_connected()
7523 def test_dpp_enterprise_reject(dev, apdev, params): argument
7525 check_dpp_capab(dev[0])
7526 check_dpp_capab(dev[1])
7528 conf_id = dev[1].dpp_configurator_add()
7529 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7530 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7531 dev[0].dpp_listen(2412)
7533 id1 = dev[1].dpp_auth_init(uri=uri0, configurator=conf_id, conf="sta-dot1x",
7536 ev = dev[1].wait_event(["DPP-CSR"], timeout=10)
7540 res = dev[1].request("DPP_CA_SET peer=%d name=status value=5" % id1)
7544 ev = dev[1].wait_event(["DPP-CONF-SENT", "DPP-CONF-FAILED"], timeout=5)
7550 ev = dev[0].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"],
7557 def test_dpp_enterprise_tcp(dev, apdev, params): argument
7563 run_dpp_enterprise_tcp(dev, apdev, params)
7565 dev[1].request("DPP_CONTROLLER_STOP")
7567 def run_dpp_enterprise_tcp(dev, apdev, params): argument
7568 check_dpp_capab(dev[0])
7569 check_dpp_capab(dev[1])
7574 _run_dpp_enterprise_tcp(dev, apdev, params, wt)
7576 def _run_dpp_enterprise_tcp(dev, apdev, params, wt): argument
7578 conf_id = dev[1].dpp_configurator_add()
7580 dev[1].set("dpp_configurator_params",
7582 id_c = dev[1].dpp_bootstrap_gen()
7583 uri_c = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id_c)
7584 res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
7586 if "OK" not in dev[1].request(req):
7589 dev[0].dpp_auth_init(uri=uri_c, role="enrollee", tcp_addr="127.0.0.1")
7590 run_dpp_enterprise_tcp_end(params, dev, wt)
7592 def run_dpp_enterprise_tcp_end(params, dev, wt): argument
7605 ev = dev[1].wait_event(["DPP-CSR"], timeout=10)
7628 res = dev[1].request("DPP_CA_SET peer=%d name=certBag value=%s" % (id1_csr, certbag))
7632 ev = dev[1].wait_event(["DPP-CONF-SENT", "DPP-CONF-FAILED"], timeout=5)
7638 ev = dev[0].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"],
7645 def test_dpp_enterprise_tcp2(dev, apdev, params): argument
7651 run_dpp_enterprise_tcp2(dev, apdev, params)
7653 dev[0].request("DPP_CONTROLLER_STOP")
7654 dev[1].request("DPP_CONTROLLER_STOP")
7656 def run_dpp_enterprise_tcp2(dev, apdev, params): argument
7657 check_dpp_capab(dev[0])
7658 check_dpp_capab(dev[1])
7663 _run_dpp_enterprise_tcp2(dev, apdev, params, wt)
7665 def _run_dpp_enterprise_tcp2(dev, apdev, params, wt): argument
7667 id_e = dev[0].dpp_bootstrap_gen()
7668 uri_e = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id_e)
7670 if "OK" not in dev[0].request(req):
7674 conf_id = dev[1].dpp_configurator_add()
7676 dev[1].dpp_auth_init(uri=uri_e, role="configurator", configurator=conf_id,
7680 run_dpp_enterprise_tcp_end(params, dev, wt)
7682 def test_dpp_qr_code_config_event_initiator(dev, apdev): argument
7684 run_dpp_qr_code_config_event_initiator(dev, apdev)
7686 def test_dpp_qr_code_config_event_initiator_set_comeback(dev, apdev): argument
7688 run_dpp_qr_code_config_event_initiator(dev, apdev, set_comeback=True)
7690 def test_dpp_qr_code_config_event_initiator_slow(dev, apdev): argument
7692 run_dpp_qr_code_config_event_initiator(dev, apdev, slow=True)
7694 def test_dpp_qr_code_config_event_initiator_failure(dev, apdev): argument
7696 run_dpp_qr_code_config_event_initiator(dev, apdev, failure=True)
7698 def test_dpp_qr_code_config_event_initiator_no_response(dev, apdev): argument
7700 run_dpp_qr_code_config_event_initiator(dev, apdev, failure=True,
7703 def run_dpp_qr_code_config_event_initiator(dev, apdev, set_comeback=False, argument
7706 check_dpp_capab(dev[0])
7707 check_dpp_capab(dev[1])
7708 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7709 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7710 dev[0].dpp_listen(2412)
7711 id1 = dev[1].dpp_auth_init(uri=uri0, conf="query")
7712 wait_auth_success(dev[0], dev[1])
7713 ev = dev[1].wait_event(["DPP-CONF-NEEDED"])
7722 if "OK" not in dev[1].request(("DPP_CONF_SET peer=%d comeback=123" % id1)):
7737 if "OK" not in dev[1].request(("DPP_CONF_SET peer=%d " % id1) + conf):
7740 ev = dev[0].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"], timeout=65)
7748 dev[0].dump_monitor()
7749 dev[1].dump_monitor()
7751 def test_dpp_qr_code_config_event_initiator_both(dev, apdev): argument
7753 check_dpp_capab(dev[0])
7754 check_dpp_capab(dev[1])
7755 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7756 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7759 dev[0].set("dpp_configurator_params",
7761 dev[0].dpp_listen(2412, role="configurator")
7762 id1 = dev[1].dpp_auth_init(uri=uri0, conf="query", role="either")
7763 wait_auth_success(dev[0], dev[1], configurator=dev[0], enrollee=dev[1])
7765 dev[0].dump_monitor()
7766 dev[1].dump_monitor()
7768 def test_dpp_tcp_qr_code_config_event_initiator(dev, apdev, params): argument
7771 run_dpp_tcp_qr_code_config_event_initiator(dev[0], dev[1])
7773 dev[1].request("DPP_CONTROLLER_STOP")
7815 def test_dpp_qr_code_config_event_responder(dev, apdev): argument
7817 check_dpp_capab(dev[0])
7818 check_dpp_capab(dev[1])
7819 id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
7820 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7821 dev[0].set("dpp_configurator_params", "conf=query")
7822 dev[0].dpp_listen(2412, role="configurator")
7823 dev[1].dpp_auth_init(uri=uri0, role="enrollee")
7824 wait_auth_success(dev[0], dev[1])
7825 ev = dev[0].wait_event(["DPP-CONF-NEEDED"])
7837 if "OK" not in dev[0].request(("DPP_CONF_SET peer=%d " % peer_id) + conf):
7840 ev = dev[1].wait_event(["DPP-CONF-RECEIVED", "DPP-CONF-FAILED"], timeout=15)
7846 dev[0].dump_monitor()
7847 dev[1].dump_monitor()
7849 def test_dpp_discard_public_action(dev, apdev): argument
7851 check_dpp_capab(dev[0])
7852 check_dpp_capab(dev[1])
7853 id0 = dev[0].dpp_bootstrap_gen(chan="81/1")
7854 uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
7855 dev[0].dpp_listen(2412)
7856 dev[1].set("dpp_discard_public_action", "1")
7857 dev[1].dpp_auth_init(uri=uri0)
7858 ev = dev[0].wait_event(["DPP-FAIL"], timeout=5)