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-23 21:31:48 +0000
commit2ec3f05cb79ee3ec00ec2a3e3a70cbecd5f1382b (patch)
treef20e00aae4ca302224d9f720c86f5aa9fd8a57a0
parent61a441d69bb53c73c70cfffce690569c6f738235 (diff)
downloadchrome-ec-2ec3f05cb79ee3ec00ec2a3e3a70cbecd5f1382b.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> (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
-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)
{