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-25 16:58:28 +0000
commit9776cb83b194adf8571be16da0ec6b51f67d54d8 (patch)
treeb8dbca3259b6c198c46f577bc6a9bdcad644cf20
parentc95db213003ef75c5c0cce9a00b7fdb36565e84e (diff)
downloadchrome-ec-9776cb83b194adf8571be16da0ec6b51f67d54d8.tar.gz
Reland "trng: change TRNG_EMPTY_COUNT to 0x7ff"
This is a reland of 2ec3f05cb79ee3ec00ec2a3e3a70cbecd5f1382b Original change's description: > 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> > (cherry picked from commit 88b7c50e717211fbced47709e78a9e95c91ce533) > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2669410 > (cherry picked from commit 1d41ad204955874b96248ace0d288535d86b2495) > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2713839 Bug: b:172542178 Bug: b:178116958 Change-Id: Ia9062b217420a41b9dce067fa9e3f305ef037e75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718508 Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Mary Ruthven <mruthven@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)
{