mirror of
https://github.com/google/bumble.git
synced 2026-05-06 03:38:01 +00:00
smp: emit enough information on pairing complete to deduce security level
This commit is contained in:
@@ -413,6 +413,8 @@ class Connection(CompositeEventEmitter):
|
|||||||
self.parameters = parameters
|
self.parameters = parameters
|
||||||
self.encryption = 0
|
self.encryption = 0
|
||||||
self.authenticated = False
|
self.authenticated = False
|
||||||
|
self.sc = False
|
||||||
|
self.link_key_type = None
|
||||||
self.phy = phy
|
self.phy = phy
|
||||||
self.att_mtu = ATT_DEFAULT_MTU
|
self.att_mtu = ATT_DEFAULT_MTU
|
||||||
self.data_length = DEVICE_DEFAULT_DATA_LENGTH
|
self.data_length = DEVICE_DEFAULT_DATA_LENGTH
|
||||||
@@ -1404,7 +1406,7 @@ class Device(CompositeEventEmitter):
|
|||||||
Notes:
|
Notes:
|
||||||
* A `connect` to the same peer will also complete this call.
|
* A `connect` to the same peer will also complete this call.
|
||||||
* The `timeout` parameter is only handled while waiting for the connection request,
|
* The `timeout` parameter is only handled while waiting for the connection request,
|
||||||
once received and accepeted, the controller shall issue a connection complete event.
|
once received and accepted, the controller shall issue a connection complete event.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if type(peer_address) is str:
|
if type(peer_address) is str:
|
||||||
@@ -1848,6 +1850,9 @@ class Device(CompositeEventEmitter):
|
|||||||
|
|
||||||
asyncio.create_task(store_keys())
|
asyncio.create_task(store_keys())
|
||||||
|
|
||||||
|
if (connection := self.find_connection_by_bd_addr(bd_addr, transport=BT_BR_EDR_TRANSPORT)):
|
||||||
|
connection.link_key_type = key_type
|
||||||
|
|
||||||
def add_service(self, service):
|
def add_service(self, service):
|
||||||
self.gatt_server.add_service(service)
|
self.gatt_server.add_service(service)
|
||||||
|
|
||||||
@@ -2273,7 +2278,9 @@ class Device(CompositeEventEmitter):
|
|||||||
connection.emit('pairing_start')
|
connection.emit('pairing_start')
|
||||||
|
|
||||||
@with_connection_from_handle
|
@with_connection_from_handle
|
||||||
def on_pairing(self, connection, keys):
|
def on_pairing(self, connection, keys, sc):
|
||||||
|
connection.sc = sc
|
||||||
|
connection.authenticated = True
|
||||||
connection.emit('pairing', keys)
|
connection.emit('pairing', keys)
|
||||||
|
|
||||||
@with_connection_from_handle
|
@with_connection_from_handle
|
||||||
|
|||||||
@@ -1583,7 +1583,7 @@ class Manager(EventEmitter):
|
|||||||
asyncio.create_task(store_keys())
|
asyncio.create_task(store_keys())
|
||||||
|
|
||||||
# Notify the device
|
# Notify the device
|
||||||
self.device.on_pairing(session.connection.handle, keys)
|
self.device.on_pairing(session.connection.handle, keys, session.sc)
|
||||||
|
|
||||||
def on_pairing_failure(self, session, reason):
|
def on_pairing_failure(self, session, reason):
|
||||||
self.device.on_pairing_failure(session.connection.handle, reason)
|
self.device.on_pairing_failure(session.connection.handle, reason)
|
||||||
|
|||||||
Reference in New Issue
Block a user