Skip to content

Commit acc752f

Browse files
alxelaxkartben
authored andcommitted
Bluetooth: Mesh: remove weak attribute and rename functions
Commit removes weak attribute and renames some functions in crypto_psa.c since there is no centralized distribution of the PSA key ID in bsim tests and no necessity to reimplement native mesh approach. Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
1 parent 6a9802e commit acc752f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

subsys/bluetooth/mesh/crypto_psa.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ int bt_mesh_dhkey_gen(const uint8_t *pub_key, const uint8_t *priv_key, uint8_t *
353353
return err;
354354
}
355355

356-
__weak psa_key_id_t bt_mesh_user_keyid_alloc(void)
356+
static psa_key_id_t bt_mesh_psa_keyid_alloc(void)
357357
{
358358
for (int i = 0; i < BT_MESH_PSA_KEY_ID_RANGE_SIZE; i++) {
359359
if (!atomic_test_bit(pst_keys, i)) {
@@ -365,7 +365,7 @@ __weak psa_key_id_t bt_mesh_user_keyid_alloc(void)
365365
return PSA_KEY_ID_NULL;
366366
}
367367

368-
__weak int bt_mesh_user_keyid_free(psa_key_id_t key_id)
368+
static int bt_mesh_psa_keyid_free(psa_key_id_t key_id)
369369
{
370370
if (IN_RANGE(key_id, BT_MESH_PSA_KEY_ID_MIN,
371371
BT_MESH_PSA_KEY_ID_MIN + BT_MESH_PSA_KEY_ID_RANGE_SIZE - 1)) {
@@ -376,7 +376,7 @@ __weak int bt_mesh_user_keyid_free(psa_key_id_t key_id)
376376
return -EIO;
377377
}
378378

379-
__weak void bt_mesh_user_keyid_assign(psa_key_id_t key_id)
379+
static void bt_mesh_psa_keyid_assign(psa_key_id_t key_id)
380380
{
381381
if (IN_RANGE(key_id, BT_MESH_PSA_KEY_ID_MIN,
382382
BT_MESH_PSA_KEY_ID_MIN + BT_MESH_PSA_KEY_ID_RANGE_SIZE - 1)) {
@@ -412,7 +412,7 @@ int bt_mesh_key_import(enum bt_mesh_key_type type, const uint8_t in[16], struct
412412
break;
413413
case BT_MESH_KEY_TYPE_NET:
414414
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
415-
key_id = bt_mesh_user_keyid_alloc();
415+
key_id = bt_mesh_psa_keyid_alloc();
416416

417417
if (key_id == PSA_KEY_ID_NULL) {
418418
return -ENOMEM;
@@ -428,7 +428,7 @@ int bt_mesh_key_import(enum bt_mesh_key_type type, const uint8_t in[16], struct
428428
case BT_MESH_KEY_TYPE_APP:
429429
case BT_MESH_KEY_TYPE_DEV:
430430
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
431-
key_id = bt_mesh_user_keyid_alloc();
431+
key_id = bt_mesh_psa_keyid_alloc();
432432

433433
if (key_id == PSA_KEY_ID_NULL) {
434434
return -ENOMEM;
@@ -456,7 +456,7 @@ int bt_mesh_key_import(enum bt_mesh_key_type type, const uint8_t in[16], struct
456456
status == PSA_ERROR_ALREADY_EXISTS ? -EALREADY : -EIO;
457457

458458
if (err && key_id != PSA_KEY_ID_NULL) {
459-
bt_mesh_user_keyid_free(key_id);
459+
bt_mesh_psa_keyid_free(key_id);
460460
}
461461

462462
psa_reset_key_attributes(&key_attributes);
@@ -483,7 +483,7 @@ void bt_mesh_key_assign(struct bt_mesh_key *dst, const struct bt_mesh_key *src)
483483
{
484484
memcpy(dst, src, sizeof(struct bt_mesh_key));
485485
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
486-
bt_mesh_user_keyid_assign(dst->key);
486+
bt_mesh_psa_keyid_assign(dst->key);
487487
}
488488
}
489489

@@ -494,7 +494,7 @@ int bt_mesh_key_destroy(const struct bt_mesh_key *key)
494494
}
495495

496496
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
497-
return bt_mesh_user_keyid_free(key->key);
497+
return bt_mesh_psa_keyid_free(key->key);
498498
}
499499

500500
return 0;

0 commit comments

Comments
 (0)