summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-01-21 14:55:58 +1100
committerCommit Bot <commit-bot@chromium.org>2021-02-02 17:11:39 +0000
commit88b7c50e717211fbced47709e78a9e95c91ce533 (patch)
treef229072dc075fda5ba01e2ec0aee4d29826e7ceb
parent8b79ea5638d5986155a5fccc8ca94628c8814919 (diff)
downloadchrome-ec-88b7c50e717211fbced47709e78a9e95c91ce533.tar.gz
trng: change TRNG_EMPTY_COUNT to 0x7ff
Increase TRNG_EMPTY_COUNT, so boards with slow TRNG have enough time to generate a sample. BUG=b:172542178,b:178116958 TEST=generate RSA keys 50 times on the hatch with slow TRNG. Verify the average time is around 6 seconds. Change-Id: I1b821286e1e4b5da8baa59caeda907ab3fe49f81 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2641744 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--chip/g/trng.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/chip/g/trng.c b/chip/g/trng.c
index e817034937..94363b29c4 100644
--- a/chip/g/trng.c
+++ b/chip/g/trng.c
@@ -32,11 +32,12 @@
#endif
/**
- * Attempts to read TRNG_EMPTY before reporting a stall.
- * Practically data should be available in less than 777
- * cycles under normal conditions.
+ * Attempts to read TRNG_EMPTY before reporting a stall. Practically data should
+ * be available in less than 0x7ff cycles under normal conditions. 0x7ff was
+ * chosen to match the hardware TRNG TIMEOUT_COUNTER. Test on boards with slow
+ * TRNG before reducing this number.
*/
-#define TRNG_EMPTY_COUNT 777
+#define TRNG_EMPTY_COUNT 0x7ff
void init_trng(void)
{