Lines Matching full:keys

42 /* Tracking of what storage changes are pending for Net Keys. We track this in
45 * and may be reused for other keys.
108 memcpy(&key.val[0], &sub->keys[0].net, sizeof(struct bt_mesh_key)); in store_subnet()
109 memcpy(&key.val[1], &sub->keys[1].net, sizeof(struct bt_mesh_key)); in store_subnet()
216 /* Added second set of keys */ in key_refresh()
221 /* Now using new keys for TX */ in key_refresh()
226 /* Revoking keys */ in key_refresh()
234 subnet_keys_destroy(&sub->keys[0]); in key_refresh()
235 memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0])); in key_refresh()
236 sub->keys[1].valid = 0U; in key_refresh()
288 for (int i = 0; i < ARRAY_SIZE(sub->keys); i++) { in subnet_del()
289 if (sub->keys[i].valid) { in subnet_del()
290 subnet_keys_destroy(&sub->keys[i]); in subnet_del()
307 static int net_keys_create(struct bt_mesh_subnet_keys *keys, bool import, const uint8_t key[16]) in net_keys_create() argument
312 err = msg_cred_create(&keys->msg, &p, 1, key); in net_keys_create()
319 err = bt_mesh_key_import(BT_MESH_KEY_TYPE_NET, key, &keys->net); in net_keys_create()
326 LOG_DBG("NID 0x%02x EncKey %s", keys->msg.nid, in net_keys_create()
327 bt_hex(&keys->msg.enc, sizeof(struct bt_mesh_key))); in net_keys_create()
328 LOG_DBG("PrivacyKey %s", bt_hex(&keys->msg.privacy, sizeof(struct bt_mesh_key))); in net_keys_create()
330 err = bt_mesh_k3(key, keys->net_id); in net_keys_create()
336 LOG_DBG("NetID %s", bt_hex(keys->net_id, 8)); in net_keys_create()
339 err = bt_mesh_identity_key(key, &keys->identity); in net_keys_create()
345 LOG_DBG("IdentityKey %s", bt_hex(&keys->identity, sizeof(struct bt_mesh_key))); in net_keys_create()
348 err = bt_mesh_beacon_key(key, &keys->beacon); in net_keys_create()
354 LOG_DBG("BeaconKey %s", bt_hex(&keys->beacon, sizeof(struct bt_mesh_key))); in net_keys_create()
357 err = bt_mesh_private_beacon_key(key, &keys->priv_beacon); in net_keys_create()
363 LOG_DBG("PrivateBeaconKey %s", bt_hex(&keys->priv_beacon, sizeof(struct bt_mesh_key))); in net_keys_create()
366 keys->valid = 1U; in net_keys_create()
384 if (bt_mesh_key_compare(key, &sub->keys[0].net)) { in bt_mesh_subnet_add()
391 err = net_keys_create(&sub->keys[0], true, key); in bt_mesh_subnet_add()
440 if (!bt_mesh_key_compare(key, &sub->keys[0].net)) { in bt_mesh_subnet_update()
445 if (!bt_mesh_key_compare(key, &sub->keys[1].net)) { in bt_mesh_subnet_update()
454 err = net_keys_create(&sub->keys[1], true, key); in bt_mesh_subnet_update()
759 bt_mesh_key_assign(&sub->keys[key_idx].net, key); in subnet_key_set()
760 err = net_keys_create(&sub->keys[key_idx], false, raw_key); in subnet_key_set()
870 /* Delete all net keys, which also takes care of all app keys which in bt_mesh_net_keys_reset()
898 if (!rx->sub->keys[j].valid) { in bt_mesh_net_cred_find()
929 if (!rx->sub->keys[j].valid) { in bt_mesh_net_cred_find()
949 for (j = 0; j < ARRAY_SIZE(rx->sub->keys); j++) { in bt_mesh_net_cred_find()
950 if (!rx->sub->keys[j].valid) { in bt_mesh_net_cred_find()
954 if (cb(rx, in, out, &rx->sub->keys[j].msg)) { in bt_mesh_net_cred_find()