Merge pull request #740 from barbibulle/gbg/fix-735

This commit is contained in:
Gilles Boccon-Gibod
2025-08-04 20:57:04 -07:00
committed by GitHub
2 changed files with 12 additions and 7 deletions

View File

@@ -946,7 +946,9 @@ class Session:
self.tk = self.passkey.to_bytes(16, byteorder='little') self.tk = self.passkey.to_bytes(16, byteorder='little')
logger.debug(f'TK from passkey = {self.tk.hex()}') logger.debug(f'TK from passkey = {self.tk.hex()}')
await self.pairing_config.delegate.display_number(self.passkey, digits=6) self.connection.cancel_on_disconnection(
self.pairing_config.delegate.display_number(self.passkey, digits=6)
)
def input_passkey(self, next_steps: Optional[Callable[[], None]] = None) -> None: def input_passkey(self, next_steps: Optional[Callable[[], None]] = None) -> None:
# Prompt the user for the passkey displayed on the peer # Prompt the user for the passkey displayed on the peer
@@ -1569,11 +1571,12 @@ class Session:
if self.pairing_method == PairingMethod.CTKD_OVER_CLASSIC: if self.pairing_method == PairingMethod.CTKD_OVER_CLASSIC:
# Authentication is already done in SMP, so remote shall start keys distribution immediately # Authentication is already done in SMP, so remote shall start keys distribution immediately
return return
elif self.sc:
if self.sc:
self.send_public_key_command()
if self.pairing_method == PairingMethod.PASSKEY: if self.pairing_method == PairingMethod.PASSKEY:
self.display_or_input_passkey() self.display_or_input_passkey()
self.send_public_key_command()
else: else:
if self.pairing_method == PairingMethod.PASSKEY: if self.pairing_method == PairingMethod.PASSKEY:
self.display_or_input_passkey(self.send_pairing_confirm_command) self.display_or_input_passkey(self.send_pairing_confirm_command)
@@ -1846,10 +1849,10 @@ class Session:
elif self.pairing_method == PairingMethod.PASSKEY: elif self.pairing_method == PairingMethod.PASSKEY:
self.send_pairing_confirm_command() self.send_pairing_confirm_command()
else: else:
# Send our public key back to the initiator
self.send_public_key_command()
def next_steps() -> None: def next_steps() -> None:
# Send our public key back to the initiator
self.send_public_key_command()
if self.pairing_method in ( if self.pairing_method in (
PairingMethod.JUST_WORKS, PairingMethod.JUST_WORKS,

View File

@@ -322,7 +322,9 @@ async def test_self_smp(io_caps, sc, mitm, key_dist):
return 0 return 0
else: else:
if ( if (
self.peer_delegate.io_capability self.io_capability
== PairingDelegate.IoCapability.KEYBOARD_INPUT_ONLY
and self.peer_delegate.io_capability
== PairingDelegate.IoCapability.KEYBOARD_INPUT_ONLY == PairingDelegate.IoCapability.KEYBOARD_INPUT_ONLY
): ):
peer_number = 6789 peer_number = 6789