diff options
author | Jorge Ramirez-Ortiz <jorge@foundries.io> | 2023-04-08 17:35:31 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-04-28 11:30:17 -0600 |
commit | 7f1a4c9dd89b5bd5203988609fe3f9f9c0c0e4e8 (patch) | |
tree | 88c3b321b62cc44f97c556a2d58c990d5c39bf70 | |
parent | 1a07d395210cc0e9a114826e0b42106fd4336f46 (diff) | |
download | u-boot-7f1a4c9dd89b5bd5203988609fe3f9f9c0c0e4e8.zip u-boot-7f1a4c9dd89b5bd5203988609fe3f9f9c0c0e4e8.tar.gz u-boot-7f1a4c9dd89b5bd5203988609fe3f9f9c0c0e4e8.tar.bz2 |
drivers: tee: sandbox: Fix SCP03 control emulator
Fix and document the Secure Channel Protocol03 emulator.
Fixes: 5a8783c80c39 ("drivers: tee: sandbox: SCP03 control emulator")
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r-- | drivers/tee/sandbox.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c index 35e8542..86219a9 100644 --- a/drivers/tee/sandbox.c +++ b/drivers/tee/sandbox.c @@ -119,6 +119,7 @@ static u32 pta_scp03_invoke_func(struct udevice *dev, u32 func, uint num_params, { u32 res; static bool enabled; + static bool provisioned; switch (func) { case PTA_CMD_ENABLE_SCP03: @@ -130,12 +131,18 @@ static u32 pta_scp03_invoke_func(struct udevice *dev, u32 func, uint num_params, if (res) return res; - if (!enabled) { + /* If SCP03 was not enabled, enable it */ + if (!enabled) enabled = true; - } else { - } - if (params[0].u.value.a) + /* If SCP03 was not provisioned, provision new keys */ + if (params[0].u.value.a && !provisioned) + provisioned = true; + + /* + * Either way, we asume both operations succeeded and that + * the communication channel has now been stablished + */ return TEE_SUCCESS; default: |