Bluetooth: Fix using uninitialized PRNG
PRNG needs to be initialized right at the begining so that it is safe to use it from initialization sequence. This fix a race when ECC emulation code was using uninitiliazed PRNG for public key generation. Change-Id: Ia396f964b915368cee39ea6be998ef5774062591 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
c6fdf09340
commit
6d3ddef1d0
1 changed files with 10 additions and 1 deletions
|
@ -2656,6 +2656,15 @@ static int common_init(void)
|
||||||
hci_reset_complete(rsp);
|
hci_reset_complete(rsp);
|
||||||
net_buf_unref(rsp);
|
net_buf_unref(rsp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* initialize PRNG right after reset so that it is safe to use it later
|
||||||
|
* on in initialization process
|
||||||
|
*/
|
||||||
|
err = prng_init(&prng);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/* Read Local Supported Features */
|
/* Read Local Supported Features */
|
||||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_LOCAL_FEATURES, NULL, &rsp);
|
err = bt_hci_cmd_send_sync(BT_HCI_OP_READ_LOCAL_FEATURES, NULL, &rsp);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2803,7 +2812,7 @@ static int le_init(void)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BLUETOOTH_SMP */
|
#endif /* CONFIG_BLUETOOTH_SMP */
|
||||||
|
|
||||||
return prng_init(&prng);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue