@@ -1938,6 +1938,23 @@ void device_set_ltk(struct btd_device *device, const uint8_t val[16],
queue_foreach(device->sirks, add_set, device);
}
+bool btd_device_get_ltk(struct btd_device *device, uint8_t key[16],
+ bool *central, uint8_t *enc_size)
+{
+ if (!device || !device->ltk || !key)
+ return false;
+
+ memcpy(key, device->ltk->key, sizeof(device->ltk->key));
+
+ if (central)
+ *central = device->ltk->central;
+
+ if (enc_size)
+ *enc_size = device->ltk->enc_size;
+
+ return true;
+}
+
static bool match_sirk(const void *data, const void *match_data)
{
const struct sirk_info *sirk = data;
@@ -132,6 +132,8 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
bool device_is_disconnecting(struct btd_device *device);
void device_set_ltk(struct btd_device *device, const uint8_t val[16],
bool central, uint8_t enc_size);
+bool btd_device_get_ltk(struct btd_device *device, uint8_t val[16],
+ bool *central, uint8_t *enc_size);
bool btd_device_add_set(struct btd_device *device, bool encrypted,
uint8_t sirk[16], uint8_t size, uint8_t rank);
void device_store_svc_chng_ccc(struct btd_device *device, uint8_t bdaddr_type,
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> This adds btd_device_get_ltk function which can be used by plugins to access the LTK key. --- src/device.c | 17 +++++++++++++++++ src/device.h | 2 ++ 2 files changed, 19 insertions(+)