diff options
Diffstat (limited to 'core/tee/tee_svc_storage.c')
-rw-r--r-- | core/tee/tee_svc_storage.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/tee/tee_svc_storage.c b/core/tee/tee_svc_storage.c index 6a3a00a2..048011fc 100644 --- a/core/tee/tee_svc_storage.c +++ b/core/tee/tee_svc_storage.c @@ -4,6 +4,8 @@ * Copyright (c) 2020, Linaro Limited */ +#include <config.h> +#include <crypto/crypto.h> #include <kernel/mutex.h> #include <kernel/tee_misc.h> #include <kernel/tee_ta_manager.h> @@ -515,6 +517,8 @@ TEE_Result syscall_storage_obj_del(unsigned long obj) struct user_ta_ctx *utc = to_user_ta_ctx(sess->ctx); TEE_Result res = TEE_SUCCESS; struct tee_obj *o = NULL; + uint8_t *data = NULL; + size_t len = 0; res = tee_obj_get(utc, uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) @@ -526,6 +530,19 @@ TEE_Result syscall_storage_obj_del(unsigned long obj) if (o->pobj == NULL || o->pobj->obj_id == NULL) return TEE_ERROR_BAD_STATE; + if (IS_ENABLED(CFG_NXP_SE05X)) { + len = o->info.dataSize; + data = calloc(1, len); + if (!data) + return TEE_ERROR_OUT_OF_MEMORY; + + res = o->pobj->fops->read(o->fh, o->info.dataPosition, + data, &len); + if (res == TEE_SUCCESS) + crypto_storage_obj_del(data, len); + free(data); + } + res = o->pobj->fops->remove(o->pobj); tee_obj_close(utc, o); |