@@ -8882,6 +8882,8 @@ static void new_csrk_callback(uint16_t index, uint16_t length,
return;
}
+ device_set_csrk(device, key->val, key->type & 0x01);
+
if (!ev->store_hint)
return;
@@ -1955,6 +1955,22 @@ bool btd_device_get_ltk(struct btd_device *device, uint8_t key[16],
return true;
}
+void device_set_csrk(struct btd_device *device, const uint8_t val[16],
+ bool remote)
+{
+ if (remote) {
+ g_free(device->remote_csrk);
+ device->remote_csrk = g_new0(struct csrk_info, 1);
+ memcpy(device->remote_csrk->key, val,
+ sizeof(device->remote_csrk->key));
+ } else {
+ g_free(device->local_csrk);
+ device->local_csrk = g_new0(struct csrk_info, 1);
+ memcpy(device->local_csrk->key, val,
+ sizeof(device->local_csrk->key));
+ }
+}
+
static bool match_sirk(const void *data, const void *match_data)
{
const struct sirk_info *sirk = data;
@@ -134,6 +134,8 @@ 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);
+void device_set_csrk(struct btd_device *device, const uint8_t val[16],
+ bool remote);
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,