Merge pull request #17 from andresag01/expose-ble-hash

Expose function in DM to calculate BLE hash
This commit is contained in:
Vincent Coubard 2016-01-11 17:30:32 +00:00
commit 60bfeb3065

View file

@ -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__ */