fix: correctly handle calls for GetRNG() when being made from nrf devices with SoftDevice enabled.

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2025-01-12 13:56:46 +01:00
committed by Ron Evans
parent 217f677bbe
commit 194438cdd6
3 changed files with 70 additions and 2 deletions
+2 -2
View File
@@ -318,9 +318,9 @@ func (i2c *I2C) signalStop() error {
var rngStarted = false
// GetRNG returns 32 bits of non-deterministic random data based on internal thermal noise.
// getRNG returns 32 bits of non-deterministic random data based on internal thermal noise.
// According to Nordic's documentation, the random output is suitable for cryptographic purposes.
func GetRNG() (ret uint32, err error) {
func getRNG() (ret uint32, err error) {
// There's no apparent way to check the status of the RNG peripheral's task, so simply start it
// to avoid deadlocking while waiting for output.
if !rngStarted {