summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2021-02-17 16:50:49 -0600
committerJeff Epler <jepler@gmail.com>2021-02-17 17:49:25 -0600
commitab5eb86118f5b446d9cb1996b07cae56e3f45643 (patch)
tree81719641005b2207e7a6b9018b22eab23860d575 /extmod
parent261b077209bc668de843015e4f5c26e474214769 (diff)
raspberrypi: implement os.urandom
Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit", I use the SHA256 hash function to create a high quality random seed from random values of uncertain entropy, as well as to generate a sequence of random values from that seed using SHA256 as a cryptographically-secure random number generator. In practice, it produces over 100kB/s of random data which does not have any gross problems according to _PractRand_.
Diffstat (limited to 'extmod')
-rw-r--r--extmod/crypto-algorithms/sha256.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/extmod/crypto-algorithms/sha256.c b/extmod/crypto-algorithms/sha256.c
index 276611cfd..9b5e45d23 100644
--- a/extmod/crypto-algorithms/sha256.c
+++ b/extmod/crypto-algorithms/sha256.c
@@ -14,6 +14,7 @@
/*************************** HEADER FILES ***************************/
#include <stdlib.h>
+#include <string.h>
#include "sha256.h"
/****************************** MACROS ******************************/