subsys: random: xoroshiro128: Use entropy get isr during init
Current implementation of the xoroshiro depends on the ISR being triggered when the interrupts is locked. This patch proposes implementing the init with entropy_get_isr. This implementation can be called at PRE_KERNEL_2 stage, even when the interrupts are locked. Fixes: GH-8199 Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
d3bdc85112
commit
984ce023cc
1 changed files with 11 additions and 1 deletions
|
@ -58,7 +58,17 @@ static int xoroshiro128_initialize(struct device *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (entropy_get_entropy(dev, (uint8_t *)&state, sizeof(state)) < 0) {
|
||||
s32_t rc = entropy_get_entropy_isr(dev, (uint8_t *)&state,
|
||||
sizeof(state), ENTROPY_BUSYWAIT);
|
||||
|
||||
if (rc == -ENOTSUP) {
|
||||
/* Driver does not provide an ISR-specific API, assume it can
|
||||
* be called from ISR context
|
||||
*/
|
||||
rc = entropy_get_entropy(dev, (u8_t *)&state, sizeof(state));
|
||||
}
|
||||
|
||||
if (rc < 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue