get identity list function argument needs to have its own memory allocated

pull/6932/head
paul-szczepanek-arm 2018-05-11 19:52:12 +01:00
parent a63f38e767
commit 3af4d0b50f
4 changed files with 12 additions and 12 deletions

View File

@ -130,7 +130,7 @@ private:
private:
entry_t _entries[MAX_ENTRIES];
FILE *_db_file;
static uint8_t _buffer[sizeof(SecurityEntryKeys_t)];
uint8_t _buffer[sizeof(SecurityEntryKeys_t)];
};
} /* namespace pal */

View File

@ -421,7 +421,7 @@ private:
* @param count Number of identities entries retrieved.
*/
void on_identity_list_retrieved(
ble::ArrayView<SecurityEntryIdentity_t*>& identity_list,
ble::ArrayView<SecurityEntryIdentity_t>& identity_list,
size_t count
);

View File

@ -124,7 +124,7 @@ public:
SecurityEntrySigningDbCb_t;
typedef mbed::Callback<void(entry_handle_t, const SecurityEntryIdentity_t*)>
SecurityEntryIdentityDbCb_t;
typedef mbed::Callback<void(ArrayView<SecurityEntryIdentity_t*>&, size_t count)>
typedef mbed::Callback<void(ArrayView<SecurityEntryIdentity_t>&, size_t count)>
IdentitylistDbCb_t;
typedef mbed::Callback<void(::Gap::Whitelist_t*)>
WhitelistDbCb_t;
@ -343,7 +343,7 @@ public:
*/
virtual void get_identity_list(
IdentitylistDbCb_t cb,
ArrayView<SecurityEntryIdentity_t*>& identity_list
ArrayView<SecurityEntryIdentity_t>& identity_list
) {
size_t count = 0;
for (size_t i = 0; i < get_entry_count() && count < identity_list.size(); ++i) {
@ -700,7 +700,7 @@ private:
virtual SecurityEntryKeys_t* read_in_entry_local_keys(entry_handle_t db_handle) = 0;
virtual SecurityEntrySigning_t* read_in_entry_peer_signing(entry_handle_t db_handle) = 0;
private:
protected:
SecurityEntryIdentity_t _local_identity;
csrk_t _local_csrk;
sign_count_t _local_sign_counter;

View File

@ -90,11 +90,11 @@ ble_error_t GenericSecurityManager::init(
_pal.set_event_handler(this);
uint8_t resolving_list_capacity = _pal.read_resolving_list_capacity();
SecurityEntryIdentity_t** identity_list_p =
new (std::nothrow) SecurityEntryIdentity_t*[resolving_list_capacity];
SecurityEntryIdentity_t* identity_list_p =
new (std::nothrow) SecurityEntryIdentity_t[resolving_list_capacity];
if (identity_list_p) {
ArrayView<SecurityEntryIdentity_t*> identity_list(
ArrayView<SecurityEntryIdentity_t> identity_list(
identity_list_p,
resolving_list_capacity
);
@ -925,7 +925,7 @@ void GenericSecurityManager::on_security_entry_retrieved(
}
void GenericSecurityManager::on_identity_list_retrieved(
ble::ArrayView<SecurityEntryIdentity_t*>& identity_list,
ble::ArrayView<SecurityEntryIdentity_t>& identity_list,
size_t count
) {
typedef advertising_peer_address_type_t address_type_t;
@ -933,11 +933,11 @@ void GenericSecurityManager::on_identity_list_retrieved(
_pal.clear_resolving_list();
for (size_t i = 0; i < count; ++i) {
_pal.add_device_to_resolving_list(
identity_list[i]->identity_address_is_public ?
identity_list[i].identity_address_is_public ?
address_type_t::PUBLIC_ADDRESS :
address_type_t::RANDOM_ADDRESS,
identity_list[i]->identity_address,
identity_list[i]->irk
identity_list[i].identity_address,
identity_list[i].irk
);
}