Bluetooth: Controller: Implement LE_RAND command
The LE_RAND HCI command was not filling in the rand array with 8 random numbers as required by the spec. Please note that the while() loop inside the command's implementation can take up to hundreds of ms to execute. Jira: ZEP-726 Change-Id: If27ff861ee5fa7842cd469e99d5bfa8ac47ac2fa Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
ef10baa235
commit
90871a5e98
1 changed files with 9 additions and 1 deletions
|
@ -25,6 +25,8 @@
|
|||
#include "defines.h"
|
||||
#include "ticker.h"
|
||||
#include "mem.h"
|
||||
#include "rand.h"
|
||||
#include "cpu.h"
|
||||
#include "ecb.h"
|
||||
#include "ccm.h"
|
||||
#include "radio.h"
|
||||
|
@ -554,13 +556,19 @@ static void le_encrypt(uint8_t *cp, struct bt_hci_evt_hdr *evt)
|
|||
static void le_rand(uint8_t *cp, struct bt_hci_evt_hdr *evt)
|
||||
{
|
||||
struct bt_hci_rp_le_rand *rp = HCI_CC_RP(evt);
|
||||
uint8_t count = sizeof(rp->rand);
|
||||
|
||||
evt->evt = BT_HCI_EVT_CMD_COMPLETE;
|
||||
evt->len = HCI_CC_LEN(*rp);
|
||||
|
||||
rp->status = 0x00;
|
||||
|
||||
/** TODO fill rand */
|
||||
while (count) {
|
||||
count = rand_get(count, rp->rand);
|
||||
if (count) {
|
||||
cpu_sleep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void le_start_encryption(uint8_t *cp, struct bt_hci_evt_hdr *evt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue