diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2021-08-26 14:57:06 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-31 17:06:06 +0000 |
commit | 8ddc58e3ce801e2ce72e78fc28bf026436dc22b2 (patch) | |
tree | 2547ea394f34b70c81b9470475998a7e1d04d9ca /board/cr50/board.c | |
parent | 6b7b22bc5abf09c823451f12b50559c197ed6c32 (diff) | |
download | chrome-ec-8ddc58e3ce801e2ce72e78fc28bf026436dc22b2.tar.gz |
cr50: merge crypto_enabled() and fips_crypto_allowed()
We need to block access to all crypto in case of FIPS errors. There are
multiple steps to implement, this is one of few.
There is common API crypto_enabled() which is used by nvmem and some
other functions to check wherever access to crypto is possible.
This is same intent as fips_crypto_allowed(), though the latter checks
for FIPS KAT errors, while the former checks only key ladder status.
Here we make all FIPS errors to revoke access from key ladder, and
fips_crypto_allowed() to check key ladder status. This way we also
ensure that in case of FIPS errors access to device secrets will be
blocked.
We moved crypto_api.c from chip/g to board/cr50 to move crypto_enabled()
into fips.c and alias it to fips_crypto_enabled().
crypto_api.h is no longer included from dcrypto.h, and compile time
assert for cipher salt size is moved to proper place.
Since crypto is used by nvmem_init(), move FIPS power-up tests earlier
to ensure nvmem_init() can access crypto.
BUG=b:197893750
TEST=make CRYPTO_TEST=1; tpm_test; check nvmem is properly initialized
on board_init().
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Change-Id: If70c2a21d61348bd97a47e26db5d8eec08bbf8ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3123836
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>
Diffstat (limited to 'board/cr50/board.c')
-rw-r--r-- | board/cr50/board.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 25768d15af..2679af3d86 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -890,6 +890,9 @@ static void board_init(void) (GREG32(KEYMGR, HKEY_RWR7) == 0xaa66150f); init_runlevel(PERMISSION_MEDIUM); + + /* Run FIPS power-on tests to enable crypto. */ + fips_power_on(); /* Initialize NvMem partitions */ nvmem_init(); |