SPM: Implement version check for stateless service
Encode the service version and stateless indicator into
stateless handle, validate the stateless handle indicator,
version and index before using.
Change-Id: Id5f388f938a758803863958dfbb0c0011c2e1f04
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 0a32695..3c20fed 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -753,14 +753,14 @@
/* Populate the p_service of stateless_service_ref[] */
if (service_db[i].connection_based == false) {
- for (j = 0; j < STATIC_HANDLE_VALUE_LIMIT; j++) {
+ for (j = 0; j < STATIC_HANDLE_NUM_LIMIT; j++) {
if (stateless_service_ref[j].sid == service_db[i].sid) {
stateless_service_ref[j].p_service = &service[i];
break;
}
}
/* Stateless service not found in tracking table */
- if (j >= STATIC_HANDLE_VALUE_LIMIT) {
+ if (j >= STATIC_HANDLE_NUM_LIMIT) {
tfm_core_panic();
}
}