Fix missing `as_entry` method in KVStoreSecurityDb

This commit introduces changes to fix a missing method, `as_entry`, and traces that were not updated properly to work with this new method.

Prior to this fix, it was not possible to use KVStoreSecurityDb as the build would fail since the `as_entry` method was not declared in the class header file.

This bug was introduced with commit 957486e0eb in PR ARMmbed/mbed-os#14198
pull/14684/head
George Beckstein 2021-05-19 16:27:53 -04:00
parent 14e5d307bb
commit 2578c5356b
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);
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));
}

View File

@ -40,6 +40,8 @@ private:
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;