mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(esp_tee): Snapshot input arguments in TEE memory before secure service execution
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user