From b44708c1c842a9e1ebb63c7f6b43774795669c7a Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Mon, 18 Apr 2016 09:35:34 +0200 Subject: core: secure storage: dual filesystems support Adds support for multiple filesystems by keeping a pointer to tee_file_operations in the tee_pobj and tee_storage_enum structures. Two identifiers are added to the API to be used as the storage_id parameter, so that TAs may dynamically choose the filesystem: - TEE_STORAGE_PRIVATE_REE (requires CFG_REE_FS=y) - TEE_STORAGE_PRIVATE_RPMB (requires CFG_RPMB_FS=y) The value TEE_STORAGE_PRIVATE will select the REE FS if available, otherwise RPMB. At least one FS has to be enabled at build time. Only the REE filesystem is enabled by default. Signed-off-by: Jerome Forissier Reviewed-by: Jens Wiklander Reviewed-by: Pascal Brand --- core/tee/tee_pobj.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/tee/tee_pobj.c') diff --git a/core/tee/tee_pobj.c b/core/tee/tee_pobj.c index 574b66b3..e25ce1eb 100644 --- a/core/tee/tee_pobj.c +++ b/core/tee/tee_pobj.c @@ -79,7 +79,8 @@ static TEE_Result tee_pobj_check_access(uint32_t oflags, uint32_t nflags) } TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, - uint32_t flags, struct tee_pobj **obj) + uint32_t flags, const struct tee_file_operations *fops, + struct tee_pobj **obj) { struct tee_pobj *o; TEE_Result res; @@ -90,7 +91,8 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, TAILQ_FOREACH(o, &tee_pobjs, link) { if ((obj_id_len == o->obj_id_len) && (memcmp(obj_id, o->obj_id, obj_id_len) == 0) && - (memcmp(uuid, &o->uuid, sizeof(TEE_UUID)) == 0)) { + (memcmp(uuid, &o->uuid, sizeof(TEE_UUID)) == 0) && + (fops == o->fops)) { *obj = o; } } @@ -115,6 +117,7 @@ TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, o->refcnt = 1; memcpy(&o->uuid, uuid, sizeof(TEE_UUID)); o->flags = flags; + o->fops = fops; o->obj_id = malloc(obj_id_len); if (o->obj_id == NULL) { -- cgit v1.2.3