From 27e64a82b8d096b5e1d8a2531cec3fd92a266ce5 Mon Sep 17 00:00:00 2001 From: Yahya Tawil <77315661+16L-YT@users.noreply.github.com> Date: Sat, 22 May 2021 11:40:36 +0300 Subject: [PATCH 1/3] Add the missing mbed-storage libraries Refer to #14660 --- connectivity/FEATURE_BLE/source/generic/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/connectivity/FEATURE_BLE/source/generic/CMakeLists.txt b/connectivity/FEATURE_BLE/source/generic/CMakeLists.txt index 30fecfba2a3..085a8343808 100644 --- a/connectivity/FEATURE_BLE/source/generic/CMakeLists.txt +++ b/connectivity/FEATURE_BLE/source/generic/CMakeLists.txt @@ -17,3 +17,10 @@ target_sources(mbed-ble SecurityDb.cpp SecurityManagerImpl.cpp ) + +target_link_libraries(mbed-ble + INTERFACE + mbed-storage-kvstore + mbed-storage-tdbstore + mbed-storage-kv-global-api +) From 997b523284745362458406514e715835fc7c933f Mon Sep 17 00:00:00 2001 From: Yahya Tawil <77315661+16L-YT@users.noreply.github.com> Date: Sat, 22 May 2021 11:46:34 +0300 Subject: [PATCH 2/3] Add the missing definition for `as_entry` --- connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.h b/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.h index 49b6ed77ccc..80bad7be1b5 100644 --- a/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.h +++ b/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.h @@ -40,6 +40,8 @@ class KVStoreSecurityDb : public SecurityDb { sign_count_t peer_sign_counter; }; + static entry_t *as_entry(entry_handle_t db_handle); + static constexpr uint8_t KVSTORESECURITYDB_VERSION = 1; static constexpr size_t DB_PREFIX_SIZE = 7 + sizeof (STR(MBED_CONF_STORAGE_DEFAULT_KV)) - 1; From 6318e3a3b760f0f32bd18394b2e761c5ce63a8f5 Mon Sep 17 00:00:00 2001 From: Yahya Tawil <77315661+16L-YT@users.noreply.github.com> Date: Sat, 22 May 2021 11:49:49 +0300 Subject: [PATCH 3/3] Solve the type error in one of the tracing msgs Adapted from #14684 --- .../source/generic/KVStoreSecurityDb.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.cpp b/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.cpp index 68c5a16ff08..7a186203425 100644 --- a/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.cpp +++ b/connectivity/FEATURE_BLE/source/generic/KVStoreSecurityDb.cpp @@ -158,7 +158,7 @@ void KVStoreSecurityDb::set_entry_local_ltk( SecurityEntryKeys_t* current_entry = read_in_entry_local_keys(db_handle); current_entry->ltk = ltk; - tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), to_string(ltk)); + tr_info("Write DB entry %d: local ltk %s", get_index(entry), to_string(ltk)); db_write_entry(current_entry, DB_ENTRY_LOCAL_KEYS, get_index(entry)); } @@ -177,7 +177,7 @@ void KVStoreSecurityDb::set_entry_local_ediv_rand( current_entry->ediv = ediv; current_entry->rand = rand; - tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand)); + tr_info("Write DB entry %d: local ediv %s rand %s", get_index(entry), to_string(ediv), to_string(rand)); db_write_entry(current_entry, DB_ENTRY_LOCAL_KEYS, get_index(entry)); } @@ -200,7 +200,7 @@ void KVStoreSecurityDb::set_entry_peer_ltk( SecurityEntryKeys_t* current_entry = read_in_entry_peer_keys(db_handle); current_entry->ltk = ltk; - tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), to_string(ltk)); + tr_info("Write DB entry %d: peer ltk %s", get_index(entry), to_string(ltk)); db_write_entry(current_entry, DB_ENTRY_PEER_KEYS, get_index(entry)); } @@ -219,7 +219,7 @@ void KVStoreSecurityDb::set_entry_peer_ediv_rand( current_entry->ediv = ediv; current_entry->rand = rand; - tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand)); + tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(entry), to_string(ediv), to_string(rand)); db_write_entry(current_entry, DB_ENTRY_PEER_KEYS, get_index(entry)); } @@ -238,7 +238,7 @@ void KVStoreSecurityDb::set_entry_peer_irk( SecurityEntryIdentity_t* current_entry = read_in_entry_peer_identity(db_handle); current_entry->irk = irk; - tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), to_string(irk)); + tr_info("Write DB entry %d: peer irk %s", get_index(entry), to_string(irk)); db_write_entry(current_entry, DB_ENTRY_PEER_IDENTITY, get_index(entry)); } @@ -257,7 +257,7 @@ void KVStoreSecurityDb::set_entry_peer_bdaddr( current_entry->identity_address = peer_address; current_entry->identity_address_is_public = address_is_public; - tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", to_string(peer_address)); + tr_info("Write DB entry %d: %s peer address %s", get_index(entry), address_is_public? "public" : "private", to_string(peer_address)); db_write_entry(current_entry, DB_ENTRY_PEER_IDENTITY, get_index(entry)); } @@ -276,7 +276,7 @@ void KVStoreSecurityDb::set_entry_peer_csrk( SecurityEntrySigning_t* current_entry = read_in_entry_peer_signing(db_handle); current_entry->csrk = csrk; - tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), to_string(csrk)); + tr_info("Write DB entry %d: peer csrk %s", get_index(entry), to_string(csrk)); db_write_entry(current_entry, DB_ENTRY_PEER_SIGNING, get_index(entry)); }