drivers: tee: sandbox: Fix SCP03 control emulator
Fix and document the Secure Channel Protocol03 emulator.
Fixes: 5a8783c80c
("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>
This commit is contained in:
parent
1a07d39521
commit
7f1a4c9dd8
1 changed files with 11 additions and 4 deletions
|
@ -119,6 +119,7 @@ static u32 pta_scp03_invoke_func(struct udevice *dev, u32 func, uint num_params,
|
||||||
{
|
{
|
||||||
u32 res;
|
u32 res;
|
||||||
static bool enabled;
|
static bool enabled;
|
||||||
|
static bool provisioned;
|
||||||
|
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case PTA_CMD_ENABLE_SCP03:
|
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)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if (!enabled) {
|
/* If SCP03 was not enabled, enable it */
|
||||||
|
if (!enabled)
|
||||||
enabled = true;
|
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;
|
return TEE_SUCCESS;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue