Merge pull request #14684 from AGlass0fMilk/fix-kvstore-security-db

Fix missing `as_entry` method in KVStoreSecurityDb
pull/14693/head^2
Anna Bridge 2021-05-24 13:22:31 +01:00 committed by GitHub
commit 77927d0c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -158,7 +158,7 @@ void KVStoreSecurityDb::set_entry_local_ltk(
SecurityEntryKeys_t* current_entry = read_in_entry_local_keys(db_handle); SecurityEntryKeys_t* current_entry = read_in_entry_local_keys(db_handle);
current_entry->ltk = ltk; 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)); 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->ediv = ediv;
current_entry->rand = rand; 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)); 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); SecurityEntryKeys_t* current_entry = read_in_entry_peer_keys(db_handle);
current_entry->ltk = ltk; 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)); 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->ediv = ediv;
current_entry->rand = rand; 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)); 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); SecurityEntryIdentity_t* current_entry = read_in_entry_peer_identity(db_handle);
current_entry->irk = irk; 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)); 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 = peer_address;
current_entry->identity_address_is_public = address_is_public; 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)); 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); SecurityEntrySigning_t* current_entry = read_in_entry_peer_signing(db_handle);
current_entry->csrk = csrk; 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)); db_write_entry(current_entry, DB_ENTRY_PEER_SIGNING, get_index(entry));
} }

View File

@ -40,6 +40,8 @@ private:
sign_count_t peer_sign_counter; 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 uint8_t KVSTORESECURITYDB_VERSION = 1;
static constexpr size_t DB_PREFIX_SIZE = 7 + sizeof (STR(MBED_CONF_STORAGE_DEFAULT_KV)) - 1; static constexpr size_t DB_PREFIX_SIZE = 7 + sizeof (STR(MBED_CONF_STORAGE_DEFAULT_KV)) - 1;