diff options
author | Mary Ruthven <mruthven@chromium.org> | 2021-01-21 14:55:58 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-09 01:44:05 +0000 |
commit | c03ba7e63aac30fbe448108d25b7a31086e1a696 (patch) | |
tree | c5ee3b97b5a6db5b7f22ca4340e899f584f6965e | |
parent | d2da43730ea961abe8a9f2bbc834523026be318c (diff) | |
download | chrome-ec-1.9311_70_mp.tar.gz |
trng: change TRNG_EMPTY_COUNT to 0x7ffv1.9311_70_mp
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
(cherry picked from commit 2ec3f05cb79ee3ec00ec2a3e3a70cbecd5f1382b)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2880140
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | chip/g/trng.c | 9 |
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) { |