summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-02-28 20:11:28 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-04-05 09:21:44 -0700
commit171578b67f40355528cbb5f34b78e8e8ed83e335 (patch)
tree2303b74da9487ca2d046b93ad04212feff6164ac /test
parent1d6c7bb9773f76aa70ce65822fa001ff72892cd2 (diff)
downloadchrome-ec-171578b67f40355528cbb5f34b78e8e8ed83e335.tar.gz
cr50: complete support of the new NVMEM structure
This patch eliminates unnecessary legacy nvmem.c and nvmem_vars.c code and brings the code base to the state where the new NVMEM layout is fully functional. BRANCH=cr50, cr50-mp BUG=b:69907320, b:129710256 CQ-DEPEND=CL:1450278 TEST=the following tests pass: - test cases in ./test/nvmem.c - TCG suite (passes on par with the existing Cr50 code with the reduced code footprint TPM2 library) - Chrome OS device migrates from legacy to new implementation with user account maintained. - Chrome OS user account is maintained over AP and H1 reboots and deep sleep cycles. Change-Id: If4bc2dd125873a79dbe0e268eb32100a8b8b352d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1496607 Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/nvmem.c2
-rw-r--r--test/pinweaver.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/test/nvmem.c b/test/nvmem.c
index 2b814251c9..dc5cde1eee 100644
--- a/test/nvmem.c
+++ b/test/nvmem.c
@@ -523,7 +523,7 @@ static int var_read_write_delete_helper(int do_write)
const void *value;
for (j = 0; j < ARRAY_SIZE(kv_pairs); j++) {
- struct tuple *t;
+ const struct tuple *t;
coverage_map |= 1;
diff --git a/test/pinweaver.c b/test/pinweaver.c
index 079fbe2b88..093443e49e 100644
--- a/test/pinweaver.c
+++ b/test/pinweaver.c
@@ -793,7 +793,7 @@ uint8_t get_current_pcr_digest(const uint8_t bitmask[2],
/******************************************************************************/
/* Mock implementations of nvmem_vars functionality.
*/
-struct tuple *getvar(const uint8_t *key, uint8_t key_len)
+const struct tuple *getvar(const uint8_t *key, uint8_t key_len)
{
struct tuple *var = NULL;
size_t i;
@@ -831,11 +831,13 @@ struct tuple *getvar(const uint8_t *key, uint8_t key_len)
return var;
}
-int freevar(struct tuple *var)
+void freevar(const struct tuple *var)
{
- free(var);
+ if (!var)
+ return;
- return EC_SUCCESS;
+ /* This typecast is OK because we know that 'var' came from malloc. */
+ free((void *)var);
}
const uint8_t *tuple_val(const struct tuple *tpl)
{