Skip to content

Commit

Permalink
Merge pull request #17 from andresag01/expose-ble-hash
Browse files Browse the repository at this point in the history
Expose function in DM to calculate BLE hash
  • Loading branch information
pan- committed Jan 11, 2016
2 parents 5a5f814 + c4ecce5 commit 60bfeb3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions source/nordic_sdk/components/ble/peer_manager/id_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,38 @@ ret_code_t im_wlist_create(pm_peer_id_t * p_peer_ids,
*/
bool im_address_resolve(ble_gap_addr_t const * p_addr, ble_gap_irk_t const * p_irk);

/**@brief Function for calculating the ah() hash function described in Bluetooth core specification
* 4.2 section 3.H.2.2.2.
*
* @detail BLE uses a hash function to calculate the first half of a resolvable address
* from the second half of the address and an irk. This function will use the ECB
* periferal to hash these data acording to the Bluetooth core specification.
*
* @note The ECB expect little endian input and output.
* This function expect big endian and will reverse the data as necessary.
*
* @param[in] p_k The key used in the hash function.
* For address resolution this is should be the irk.
* The array must have a length of 16.
* @param[in] p_r The rand used in the hash function. For generating a new address
* this would be a random number. For resolving a resolvable address
* this would be the last half of the address being resolved.
* The array must have a length of 3.
* @param[out] p_local_hash The result of the hash operation. For address resolution this
* will match the first half of the address being resolved if and only
* if the irk used in the hash function is the same one used to generate
* the address.
* The array must have a length of 16.
*
* @note ====IMPORTANT====
* This is a special modification to the original nRF51 SDK required by the mbed BLE API
* to be able to generate BLE private resolvable addresses. This function is used by
* the BLE API implementation for nRF5xSecurityManager::getAddressFromBondTable() in the
* ble-nrf51822 yotta module.
* =================
*/
void ah(uint8_t const * p_k, uint8_t const * p_r, uint8_t * p_local_hash);

/** @} */

#endif /* PEER_ID_MANAGER_H__ */

0 comments on commit 60bfeb3

Please sign in to comment.