Loading system/blueberry/tests/gd/cert/matchers.py +13 −13 Original line number Diff line number Diff line Loading @@ -147,55 +147,55 @@ class HciMatchers(object): @staticmethod def LinkKeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) return HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) @staticmethod def IoCapabilityRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_REQUEST) return HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_REQUEST) @staticmethod def IoCapabilityResponse(): return lambda event: HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_RESPONSE) return HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_RESPONSE) @staticmethod def UserPasskeyNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_PASSKEY_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.USER_PASSKEY_NOTIFICATION) @staticmethod def UserPasskeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_PASSKEY_REQUEST) return HciMatchers.EventWithCode(EventCode.USER_PASSKEY_REQUEST) @staticmethod def UserConfirmationRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_CONFIRMATION_REQUEST) return HciMatchers.EventWithCode(EventCode.USER_CONFIRMATION_REQUEST) @staticmethod def RemoteHostSupportedFeaturesNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION) @staticmethod def LinkKeyNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.LINK_KEY_NOTIFICATION) @staticmethod def SimplePairingComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.SIMPLE_PAIRING_COMPLETE) return HciMatchers.EventWithCode(EventCode.SIMPLE_PAIRING_COMPLETE) @staticmethod def Disconnect(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECT) return HciMatchers.EventWithCode(EventCode.DISCONNECT) @staticmethod def DisconnectionComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) return HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) @staticmethod def RemoteOobDataRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) return HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) @staticmethod def PinCodeRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.PIN_CODE_REQUEST) return HciMatchers.EventWithCode(EventCode.PIN_CODE_REQUEST) @staticmethod def LoopbackOf(packet): Loading system/blueberry/tests/gd/security/cert_security.py +12 −9 Original line number Diff line number Diff line Loading @@ -288,14 +288,12 @@ class CertSecurity(PySecurity): hci_packets.IoCapabilityRequestReplyBuilder( address.decode('utf8'), self._io_caps, oob_data_present, self._auth_reqs), True) def accept_pairing(self, dut_address, reply_boolean): def accept_pairing(self, dut_address, reply_boolean, expect_to_fail, on_responder_reply): """ Here we handle the pairing events at the HCI level """ logging.info("Cert: Waiting for LINK_KEY_REQUEST") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyRequest()) logging.info("Cert: Sending LINK_KEY_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command(hci_packets.LinkKeyRequestNegativeReplyBuilder(dut_address.decode('utf8')), True) logging.info("Cert: Waiting for IO_CAPABILITY_RESPONSE") assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityResponse()) self.send_io_caps(dut_address) logging.info("Cert: Waiting for USER_CONFIRMATION_REQUEST") assertThat(self._hci_event_stream).emits(HciMatchers.UserConfirmationRequest()) Loading @@ -303,14 +301,17 @@ class CertSecurity(PySecurity): if reply_boolean: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_REPLY") self._enqueue_hci_command(hci_packets.UserConfirmationRequestReplyBuilder(dut_address.decode('utf8')), True) on_responder_reply() logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) if not expect_to_fail: logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) else: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command( hci_packets.UserConfirmationRequestNegativeReplyBuilder(dut_address.decode('utf8')), True) on_responder_reply() logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) Loading Loading @@ -356,8 +357,10 @@ class CertSecurity(PySecurity): """ Cert side needs to pass """ logging.info("Cert: Waiting for DISCONNECT_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.DisconnectionComplete()) pass # FIXME: Gabeldorsche facade don't allow us to register for an DISCONNECT_COMPLETE event # logging.info("Cert: Waiting for DISCONNECT_COMPLETE") # assertThat(self._hci_event_stream).emits(HciMatchers.DisconnectionComplete()) def close(self): safeClose(self._hci) system/blueberry/tests/gd/security/security_test.py +5 −2 Original line number Diff line number Diff line Loading @@ -130,8 +130,11 @@ class SecurityTest(gd_base_test.GdBaseTestClass): def _verify_ssp_numeric_comparison(self, initiator, responder, init_ui_response, resp_ui_response, expected_init_ui_event, expected_resp_ui_event, expected_init_bond_event, expected_resp_bond_event): responder.accept_pairing(initiator.get_address(), resp_ui_response) def on_responder_reply(): initiator.on_user_input(responder.get_address(), init_ui_response, expected_init_ui_event) responder.accept_pairing(initiator.get_address(), resp_ui_response, init_ui_response, on_responder_reply) initiator.wait_for_bond_event(expected_init_bond_event) responder.wait_for_bond_event(expected_resp_bond_event) Loading system/gd/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -574,6 +574,7 @@ rust_library { crate_name: "bt_packets", srcs: ["rust/packets/lib.rs", ":BluetoothGeneratedPackets_rust"], edition: "2018", vendor_available : true, host_supported: true, proc_macros: ["libnum_derive"], rustlibs: [ Loading tools/rootcanal/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ cc_defaults { "-Wextra", "-Werror", "-fvisibility=hidden", "-DROOTCANAL_LMP", ], local_include_dirs: [ "include", Loading Loading @@ -95,6 +96,9 @@ cc_library_static { shared_libs: [ "liblog", ], whole_static_libs: [ "liblmp", ], static_libs: [ "libjsoncpp", "libscriptedbeaconpayload-protos-lite", Loading Loading
system/blueberry/tests/gd/cert/matchers.py +13 −13 Original line number Diff line number Diff line Loading @@ -147,55 +147,55 @@ class HciMatchers(object): @staticmethod def LinkKeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) return HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) @staticmethod def IoCapabilityRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_REQUEST) return HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_REQUEST) @staticmethod def IoCapabilityResponse(): return lambda event: HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_RESPONSE) return HciMatchers.EventWithCode(EventCode.IO_CAPABILITY_RESPONSE) @staticmethod def UserPasskeyNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_PASSKEY_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.USER_PASSKEY_NOTIFICATION) @staticmethod def UserPasskeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_PASSKEY_REQUEST) return HciMatchers.EventWithCode(EventCode.USER_PASSKEY_REQUEST) @staticmethod def UserConfirmationRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.USER_CONFIRMATION_REQUEST) return HciMatchers.EventWithCode(EventCode.USER_CONFIRMATION_REQUEST) @staticmethod def RemoteHostSupportedFeaturesNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION) @staticmethod def LinkKeyNotification(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_NOTIFICATION) return HciMatchers.EventWithCode(EventCode.LINK_KEY_NOTIFICATION) @staticmethod def SimplePairingComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.SIMPLE_PAIRING_COMPLETE) return HciMatchers.EventWithCode(EventCode.SIMPLE_PAIRING_COMPLETE) @staticmethod def Disconnect(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECT) return HciMatchers.EventWithCode(EventCode.DISCONNECT) @staticmethod def DisconnectionComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) return HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) @staticmethod def RemoteOobDataRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) return HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) @staticmethod def PinCodeRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.PIN_CODE_REQUEST) return HciMatchers.EventWithCode(EventCode.PIN_CODE_REQUEST) @staticmethod def LoopbackOf(packet): Loading
system/blueberry/tests/gd/security/cert_security.py +12 −9 Original line number Diff line number Diff line Loading @@ -288,14 +288,12 @@ class CertSecurity(PySecurity): hci_packets.IoCapabilityRequestReplyBuilder( address.decode('utf8'), self._io_caps, oob_data_present, self._auth_reqs), True) def accept_pairing(self, dut_address, reply_boolean): def accept_pairing(self, dut_address, reply_boolean, expect_to_fail, on_responder_reply): """ Here we handle the pairing events at the HCI level """ logging.info("Cert: Waiting for LINK_KEY_REQUEST") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyRequest()) logging.info("Cert: Sending LINK_KEY_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command(hci_packets.LinkKeyRequestNegativeReplyBuilder(dut_address.decode('utf8')), True) logging.info("Cert: Waiting for IO_CAPABILITY_RESPONSE") assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityResponse()) self.send_io_caps(dut_address) logging.info("Cert: Waiting for USER_CONFIRMATION_REQUEST") assertThat(self._hci_event_stream).emits(HciMatchers.UserConfirmationRequest()) Loading @@ -303,14 +301,17 @@ class CertSecurity(PySecurity): if reply_boolean: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_REPLY") self._enqueue_hci_command(hci_packets.UserConfirmationRequestReplyBuilder(dut_address.decode('utf8')), True) on_responder_reply() logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) if not expect_to_fail: logging.info("Cert: Waiting for LINK_KEY_NOTIFICATION") assertThat(self._hci_event_stream).emits(HciMatchers.LinkKeyNotification()) else: logging.info("Cert: Sending USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY") self._enqueue_hci_command( hci_packets.UserConfirmationRequestNegativeReplyBuilder(dut_address.decode('utf8')), True) on_responder_reply() logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) Loading Loading @@ -356,8 +357,10 @@ class CertSecurity(PySecurity): """ Cert side needs to pass """ logging.info("Cert: Waiting for DISCONNECT_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.DisconnectionComplete()) pass # FIXME: Gabeldorsche facade don't allow us to register for an DISCONNECT_COMPLETE event # logging.info("Cert: Waiting for DISCONNECT_COMPLETE") # assertThat(self._hci_event_stream).emits(HciMatchers.DisconnectionComplete()) def close(self): safeClose(self._hci)
system/blueberry/tests/gd/security/security_test.py +5 −2 Original line number Diff line number Diff line Loading @@ -130,8 +130,11 @@ class SecurityTest(gd_base_test.GdBaseTestClass): def _verify_ssp_numeric_comparison(self, initiator, responder, init_ui_response, resp_ui_response, expected_init_ui_event, expected_resp_ui_event, expected_init_bond_event, expected_resp_bond_event): responder.accept_pairing(initiator.get_address(), resp_ui_response) def on_responder_reply(): initiator.on_user_input(responder.get_address(), init_ui_response, expected_init_ui_event) responder.accept_pairing(initiator.get_address(), resp_ui_response, init_ui_response, on_responder_reply) initiator.wait_for_bond_event(expected_init_bond_event) responder.wait_for_bond_event(expected_resp_bond_event) Loading
system/gd/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -574,6 +574,7 @@ rust_library { crate_name: "bt_packets", srcs: ["rust/packets/lib.rs", ":BluetoothGeneratedPackets_rust"], edition: "2018", vendor_available : true, host_supported: true, proc_macros: ["libnum_derive"], rustlibs: [ Loading
tools/rootcanal/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ cc_defaults { "-Wextra", "-Werror", "-fvisibility=hidden", "-DROOTCANAL_LMP", ], local_include_dirs: [ "include", Loading Loading @@ -95,6 +96,9 @@ cc_library_static { shared_libs: [ "liblog", ], whole_static_libs: [ "liblmp", ], static_libs: [ "libjsoncpp", "libscriptedbeaconpayload-protos-lite", Loading