summaryrefslogtreecommitdiffstats
path: root/src/dbus-hci.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-02-04 14:06:42 -0800
committerJohan Hedberg <johan.hedberg@nokia.com>2009-02-04 14:06:42 -0800
commit134fbe4c0410416e779667748eab0f89c04243ec (patch)
tree7e54196b0743e5ef00d2dd7ca870f8d48d290e7a /src/dbus-hci.c
parent6eb9d732835c1ea393692fb9e9318b7198829da8 (diff)
Move link key writing from security.c to dbus-hci.c
This refactoring is preparation for more fine-grained link key writing control with e.g. SSP "no bonding" use cases.
Diffstat (limited to 'src/dbus-hci.c')
-rw-r--r--src/dbus-hci.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index e7d2c78e..562609e0 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -896,14 +896,22 @@ proceed:
adapter_set_state(adapter, state);
}
-void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer,
- uint8_t key_type, uint8_t old_key_type)
+int hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer,
+ uint8_t *key, uint8_t key_type,
+ int pin_length, uint8_t old_key_type)
{
struct btd_device *device;
struct btd_adapter *adapter;
+ int err;
if (!get_adapter_and_device(local, peer, &adapter, &device, TRUE))
- return;
+ return -ENODEV;
+
+ err = write_link_key(local, peer, key, key_type, pin_length);
+ if (err < 0) {
+ error("write_link_key: %s (%d)", strerror(-err), -err);
+ return err;
+ }
/* If this is not the first link key set a flag so a subsequent auth
* complete event doesn't trigger SDP */
@@ -916,6 +924,8 @@ void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer,
device_set_secmode3_conn(device, TRUE);
else if (!device_is_bonding(device, NULL) && old_key_type == 0xFF)
hcid_dbus_bonding_process_complete(local, peer, 0);
+
+ return 0;
}
void hcid_dbus_conn_complete(bdaddr_t *local, uint8_t status, uint16_t handle,