Bluetooth: Make random number generation API public

Applications or higher level profiles that are not part of the core
Bluetooth stack may need an easy way to generate random numbers. Since
we already have an internal helper for this export it for others to
use as well.

Change-Id: I29af7cab30ad8f60d481bc847984e781eaecd6bf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-06-27 09:15:56 +03:00
commit fbb2fe8acf
3 changed files with 14 additions and 2 deletions

View file

@ -421,6 +421,19 @@ int bt_br_set_discoverable(bool enable);
*/
int bt_br_set_connectable(bool enable);
/** @brief Generate random data.
*
* A random number generation helper which utilizes the Bluetooth
* controller's own RNG.
*
* @param buf Buffer to insert the random data
* @param len Length of random data to generate
*
* @return Zero on success or error code otherwise, positive in case
* of protocol error or negative (POSIX) in case of stack internal error
*/
int bt_rand(void *buf, size_t len);
/**
* @}
*/

View file

@ -178,8 +178,6 @@ const char *bt_addr_str(const bt_addr_t *addr);
const char *bt_addr_le_str(const bt_addr_le_t *addr);
#endif
int bt_rand(void *buf, size_t len);
int bt_le_scan_update(bool fast_scan);
bool bt_addr_le_is_bonded(const bt_addr_le_t *addr);

View file

@ -26,6 +26,7 @@
#include <tinycrypt/utils.h>
#include <tinycrypt/ecc.h>
#include <tinycrypt/ecc_dh.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/log.h>
#include <bluetooth/hci.h>
#include <bluetooth/driver.h>