https://github.com/linaro-swg/optee_examples/tree/master/acipher
普通进程可以通过:
uuid
决定要使用的 TA: TEEC_OpenSession
TEEC_InvokeCommand
决定要调用 TA 的哪个函数
TEEC_InvokeCommand
可以控制的输入是 param_types
和 TEE_Param params
optee_client/libteec
libteec: TEEC_InvokeCommand
linux kernel: tee_ioctl
从内核进入 TEE 的调用流程:
el3_entrypoint_common
: 将 runtime_exceptions
设置为 smc handler table (vbar_el3
)sync_exception_aarch64
找到真正的 handler: opteed_smc_handler
vector_std_smc_entry
一路调用下去,就会调用到 TA 对应的 command 处理函数entry_func
: 从这里开始进入 libutee
部分,属于 TEE 的 user spaceTEE_AsymmetricEncrypt
对 TEE syscall _utee_asymm_operate
的封装syscall_asymm_operate