Skip to contentSkip to conversation

drivers: tee: sandbox: Fix SCP03 control emulator

PATCH Superseded Jorge Ramirez-Ortiz 1 participant 1 message Apr 5, 2023 TEE

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: tee: sandbox: Fix SCP03 control emulator

Fix and document the Secure Channel Protocol03 emulator.

Fixes 5a8783c80c39 ("drivers: tee: sandbox: SCP03 control emulator")
---
 drivers/tee/sandbox.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/tee/sandbox.c +10 -3
index 35e8542fa3..8e32b69f5b 100644
@@ -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 provision;
 
 	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 SCP03 was not provisioned, provision new keys */
 		if (params[0].u.value.a)
+			provision = true;
+
+		/*
+		 * Either way, we asume both operations succeeded and that
+		 * the communication channel has now been stablished
+		 */
 
 		return TEE_SUCCESS;
 	default:
Signature · 1 line
2.34.1