Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optee ftpm: CFG_TA_FTPM_RPMB_STORAGE selects RPMB storage #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions platform/NVMem.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
#include <tee_internal_api.h>
#include <tee_internal_api_extensions.h>

#ifdef CFG_TA_FTPM_RPMB_STORAGE
#define CHOOSEN_TEE_STORAGE TEE_STORAGE_PRIVATE_RPMB
#else
#define CHOOSEN_TEE_STORAGE TEE_STORAGE_PRIVATE
#endif

//
// Overall size of NV, not just the TPM's NV storage
//
Expand Down Expand Up @@ -157,7 +163,7 @@ _plat__NvInitFromStorage()
objID = s_StorageObjectID + i;

// Attempt to open TEE persistent storage object.
Result = TEE_OpenPersistentObject(TEE_STORAGE_PRIVATE,
Result = TEE_OpenPersistentObject(CHOOSEN_TEE_STORAGE,
(void *)&objID,
sizeof(objID),
TA_STORAGE_FLAGS,
Expand All @@ -175,7 +181,7 @@ _plat__NvInitFromStorage()
}

// Storage object was not found, create it.
Result = TEE_CreatePersistentObject(TEE_STORAGE_PRIVATE,
Result = TEE_CreatePersistentObject(CHOOSEN_TEE_STORAGE,
(void *)&objID,
sizeof(objID),
TA_STORAGE_FLAGS,
Expand Down Expand Up @@ -313,7 +319,7 @@ _plat__NvWriteBack()
// Force storage stack to update its backing store
TEE_CloseObject(s_NVStore[i]);

Result = TEE_OpenPersistentObject(TEE_STORAGE_PRIVATE,
Result = TEE_OpenPersistentObject(CHOOSEN_TEE_STORAGE,
(void *)&objID,
sizeof(objID),
TA_STORAGE_FLAGS,
Expand Down
3 changes: 3 additions & 0 deletions sub.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CFG_FTPM_EMULATE_PPI ?= n
CFG_TA_FTPM_RPMB_STORAGE ?= n
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the configuration should get the storage ID instead of a a boolean value that selects between TEE_STORAGE_PRIVATE and TEE_STORAGE_PRIVATE_RPMB. Here:

CFG_FTPM_TA_TEE_STORAGE_ID ?= TEE_STORAGE_PRIVATE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.


#
# The fTPM needs to overwrite some of the header files used in the
Expand Down Expand Up @@ -95,6 +96,8 @@ srcs-y += platform/fTPM_helpers.c

srcs-y += fTPM.c

cflags-$(CFG_TA_FTPM_RPMB_STORAGE) += -DCFG_TA_FTPM_RPMB_STORAGE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/cflags/cppflags/


ifeq ($(CFG_TA_MEASURED_BOOT),y)
CFG_TA_EVENT_LOG_SIZE ?= 1024
# Support for Trusted Firmware Measured Boot.
Expand Down