aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMingyang Sun <mingyang.sun@arm.com>2021-03-17 17:58:33 +0800
committerMingyang Sun <mingyang.sun@arm.com>2021-03-22 15:05:16 +0800
commit453ad40c80eb64c6c9f86ddcf2b513a3ed372291 (patch)
tree4d22d820f17877a3f0a37eb7b7091f029ef66804 /tools
parent062594f65de20bc8c1878cbd530af27030735da8 (diff)
downloadtrusted-firmware-m-453ad40c80eb64c6c9f86ddcf2b513a3ed372291.tar.gz
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/tfm_parse_manifest_list.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index d4a0d80ec..cfc6bfcbd 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -231,12 +231,23 @@ def process_stateless_services(partitions, static_handle_max_num):
# Auto-allocate stateless handle
for i in range(0, static_handle_max_num):
- if reordered_stateless_list[i] == None:
+ if reordered_stateless_list[i] == None and len(stateless_services) > 0:
service = stateless_services.pop(0)
service['stateless_handle'] = i + 1
reordered_stateless_list[i] = service
- if len(stateless_services) == 0:
- break
+ """
+ Encode stateless flag and version into stateless handle
+ bit 30: stateless handle indicator
+ bit 15-8: stateless service version
+ bit 7-0: stateless handle index
+ """
+ if reordered_stateless_list[i] != None:
+ stateless_handle_value = reordered_stateless_list[i]['stateless_handle']
+ stateless_flag = 1 << 30
+ stateless_handle_value |= stateless_flag
+ stateless_version = (reordered_stateless_list[i]['version'] & 0xFF) << 8
+ stateless_handle_value |= stateless_version
+ reordered_stateless_list[i]['stateless_handle'] = '0x%08x' % stateless_handle_value
return reordered_stateless_list