Bluetooth: controller: Use NRF RNG entropy device
Use the NRF RNG entropy device as the entropy device for bt_rand and controller internal functions when LLL is Nordic. Using an entropy source with a significant increase in stack usage will invalidate all stack size configurations in the system and lead to stack overflow issues. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
406a33682a
commit
f756b79124
15 changed files with 65 additions and 57 deletions
|
@ -7,7 +7,6 @@
|
|||
#include <stddef.h>
|
||||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
#include <drivers/entropy.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
|
@ -169,8 +168,6 @@ static struct ll_conn conn_pool[CONFIG_BT_MAX_CONN];
|
|||
static struct ll_conn *conn_upd_curr;
|
||||
static void *conn_free;
|
||||
|
||||
static struct device *entropy;
|
||||
|
||||
struct ll_conn *ll_conn_acquire(void)
|
||||
{
|
||||
return mem_acquire(&conn_free);
|
||||
|
@ -607,11 +604,6 @@ int ull_conn_init(void)
|
|||
{
|
||||
int err;
|
||||
|
||||
entropy = device_get_binding(DT_CHOSEN_ZEPHYR_ENTROPY_LABEL);
|
||||
if (!entropy) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = init_reset();
|
||||
if (err) {
|
||||
return err;
|
||||
|
@ -3850,9 +3842,9 @@ static void enc_req_reused_send(struct ll_conn *conn, struct node_tx **tx)
|
|||
sizeof(pdu_ctrl_tx->llctrl.enc_req.skdm)));
|
||||
|
||||
/* NOTE: if not sufficient random numbers, ignore waiting */
|
||||
entropy_get_entropy_isr(entropy, pdu_ctrl_tx->llctrl.enc_req.skdm,
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_req.skdm) +
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_req.ivm), 0);
|
||||
lll_csrand_isr_get(pdu_ctrl_tx->llctrl.enc_req.skdm,
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_req.skdm) +
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_req.ivm));
|
||||
|
||||
ctrl_tx_enqueue(conn, *tx);
|
||||
|
||||
|
@ -3887,9 +3879,9 @@ static int enc_rsp_send(struct ll_conn *conn)
|
|||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.skds)));
|
||||
|
||||
/* NOTE: if not sufficient random numbers, ignore waiting */
|
||||
entropy_get_entropy_isr(entropy, pdu_ctrl_tx->llctrl.enc_rsp.skds,
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.skds) +
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.ivs), 0);
|
||||
lll_csrand_isr_get(pdu_ctrl_tx->llctrl.enc_rsp.skds,
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.skds) +
|
||||
sizeof(pdu_ctrl_tx->llctrl.enc_rsp.ivs));
|
||||
|
||||
/* things from slave stored for session key calculation */
|
||||
memcpy(&conn->llcp.encryption.skd[8],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue