fix(esp_tee): Snapshot input arguments in TEE memory before secure service execution

This commit is contained in:
Laukik Hase
2026-08-28 10:20:55 +05:30
parent 427dc875b9
commit 1fbeea3393
5 changed files with 317 additions and 219 deletions
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "esp_attr.h"
#include "soc/soc.h"
#include "soc/ext_mem_defs.h"
@@ -42,6 +43,20 @@ FORCE_INLINE_ATTR bool esp_tee_ptr_in_ree(const void *p)
return esp_tee_buf_in_ree(p, 4);
}
/* NOTE: re-points a REE string argument at a TEE-resident copy */
FORCE_INLINE_ATTR void tee_snapshot_ree_str(const char **name, char *buf, size_t buf_len)
{
const char *src = *name;
if (src == NULL || buf_len == 0) {
return;
}
memcpy(buf, src, buf_len);
buf[buf_len - 1] = '\0';
*name = buf;
}
#ifdef __cplusplus
}
#endif