diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2020-06-17 21:46:00 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-24 20:56:01 +0000 |
commit | 2d7cdfffa2fec56805406c50e8c3b58b6d0b617c (patch) | |
tree | a13a0970d6a3f221186ae25150cac189cdcc0146 /include | |
parent | 66bf0868e8bd55ba9e0d04671d164cfa1072173b (diff) | |
download | chrome-ec-2d7cdfffa2fec56805406c50e8c3b58b6d0b617c.tar.gz |
fips_rand: FIPS-compliant way to generate randoms
Add proper TRNG health tests and CR50-wide DRBG with reseeding
BUG=b:138578157
TEST=tpmtest.py -t1 fails after cr50 reboot.
rand_perf in console (kick-off FIPS TRNG test) and then
tpmtest.py -t1 and tpmtest.py -t2 should succeed.
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Change-Id: I94c2dbd7a00dedcf1a0f318539a3c73c0c8076ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251381
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h index a6de67e3d8..43d9a71992 100644 --- a/include/util.h +++ b/include/util.h @@ -66,6 +66,9 @@ extern "C" { #define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y)) #define DIV_ROUND_NEAREST(x, y) (((x) + ((y) / 2)) / (y)) +/* Convert number of bits to number of 32-bit words */ +#define BITS_TO_WORDS(x) (((x) + 31) / 32) + /* * Swap two variables (requires c99) * |