BLE: Change nRF5xSecurityManager::resolve_address signature

Return the resolving list entry instead of accepting in parameters.
pull/6932/head
Vincent Coubard 2018-04-16 18:16:36 +01:00
parent a18283d897
commit 2a9d80c5f0
2 changed files with 10 additions and 16 deletions

View File

@ -208,11 +208,8 @@ nRF5xSecurityManager::get_resolving_list() {
);
}
bool nRF5xSecurityManager::resolve_address(
const address_t& resolvable_address,
advertising_peer_address_type_t& resolved_address_type,
address_t& resolved_address
) {
const nRF5xSecurityManager::resolving_list_entry_t*
nRF5xSecurityManager::resolve_address(const address_t& resolvable_address) {
typedef byte_array_t<CryptoToolbox::hash_size_> hash_t;
for (size_t i = 0; i < resolving_list_entry_count; ++i) {
@ -233,14 +230,14 @@ bool nRF5xSecurityManager::resolve_address(
// parameter. If they are equal then the IRK of the entry has been used
// to generate the resolvable address.
if (memcmp(hash_generated.data(), resolvable_address.data(), CryptoToolbox::hash_size_) == 0) {
resolved_address_type = entry.peer_identity_address_type;
resolved_address = entry.peer_identity_address;
return true;
return &entry;
}
}
return false;
return NULL;
}
////////////////////////////////////////////////////////////////////////////
// Pairing
//

View File

@ -109,14 +109,11 @@ public:
* Try to resolve a private resolvable address.
*
* @param resolvable_address The address to resolve.
* @param resolved_address_type The type of the identity address resolved.
* @param resolved_address The identity address resolved.
* @return True if the address has been resolved and false otherwise.
*
* @return Pointer to the entry found if any.
*/
bool resolve_address(
const address_t& resolvable_address,
advertising_peer_address_type_t& resolved_address_type,
address_t& resolved_address
const resolving_list_entry_t* resolve_address(
const address_t& resolvable_address
);