From 2fcca12ffbd8f4ee6ab368bbd964b8f2a62387a7 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Mon, 30 Nov 2020 12:24:41 +0000 Subject: [PATCH] Generate DeviceKey RoT for all non-internal storage type All external TDB and filesystem storage types for KV global API are based on SecureStore, which depends on DeviceKey which requires a Root of Trust (RoT) being present. --- main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 2235c3c..cda5f3a 100644 --- a/main.cpp +++ b/main.cpp @@ -63,7 +63,9 @@ void kv_store_global_api_example() res = kv_reset("/kv/"); printf("kv_reset -> %d\n", err_code(res)); - if (strcmp(STR(MBED_CONF_STORAGE_STORAGE_TYPE), "TDB_EXTERNAL") == 0) { + if (strcmp(STR(MBED_CONF_STORAGE_STORAGE_TYPE), "TDB_INTERNAL") != 0) { + // Generate DeviceKey Root of Trust for non-internal storage types + // as SecureStore requires res = DeviceKey::get_instance().generate_root_of_trust(); printf("DeviceKey::get_instance().generate_root_of_trust() -> %d\n", res); }