diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2020-06-22 16:29:35 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-26 02:40:45 +0000 |
commit | a12d9f33ec06e33e25337e24979722baf2f3956f (patch) | |
tree | 8fa9e86060bcab6936ff70f31c25094bd6b1a1f6 /board/cr50/tpm_nvmem_ops.c | |
parent | 8196d442a20bac595e5befb01f155419163c8eda (diff) | |
download | chrome-ec-stabilize-13310.99.B-cr50_stab.tar.gz |
tpm_nvmem_ops.c: add function to get size of nvmem hidden objectstabilize-quickfix-13310.91.B-cr50_stabstabilize-quickfix-13310.76.B-cr50_stabstabilize-quickfix-13310.73.B-cr50_stabstabilize-13310.99.B-cr50_stabstabilize-13310.94.B-cr50_stabstabilize-13310.83.B-cr50_stabstabilize-13310.74.B-cr50_stabstabilize-13310.72.B-cr50_stabrelease-R85-13310.B-cr50_stab
Added service function read_tpm_nvmem_size() to return size of hidden
nvmem object, which is needed in FIPS framework code, but can't be
implemented locally due to conflicting headers between TPM2 library
and Cryptoc library, and util.h
BUG=none
TEST=make BOARD=cr50; meaningul test will be added in upcoming CLs
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Change-Id: Iab9520170cfdcd754f1fe2e79143f75766284921
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2258534
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/tpm_nvmem_ops.c')
-rw-r--r-- | board/cr50/tpm_nvmem_ops.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/board/cr50/tpm_nvmem_ops.c b/board/cr50/tpm_nvmem_ops.c index 23a8ead1cf..ed5d438204 100644 --- a/board/cr50/tpm_nvmem_ops.c +++ b/board/cr50/tpm_nvmem_ops.c @@ -4,6 +4,8 @@ * found in the LICENSE file. */ +#include <stddef.h> + #include "common.h" #include "console.h" #include "tpm_nvmem_ops.h" @@ -95,3 +97,21 @@ enum tpm_write_rv write_tpm_nvmem_hidden(uint16_t object_index, return ret; } + +size_t read_tpm_nvmem_size(uint16_t obj_index) +{ + TPM_HANDLE object_handle; + NV_INDEX nvIndex; + uint32_t handle_addr; + + object_handle = HR_NV_INDEX | obj_index; + + handle_addr = NvEarlyStageFindHandle(object_handle); + if (!handle_addr) + return 0; + + /* Get properties of this index as stored in nvmem. */ + NvReadIndexInfo(object_handle, handle_addr, &nvIndex); + + return nvIndex.publicArea.dataSize; +} |