Interface: Fix parameter mismatch between client & service
In RPC implementations of TF-M, the data model of the Client and Service
may be different. So, for C integer types with an implementation-defined
bit width, the type definition in the client library's environment may
not be equivalent to the one in the RoT Service environment.
The IPC protocols used in TF-M generally use fixed-width types to avoid
this kind of issue. However, there are a few PSA APIs that use size_t
parameters, which are then passed in iovecs.
To avoid passing parameters of an unexpected size to the service, this
change makes the definition of size_t in the RoT Service environment
visible to the client and converts parameters as required.
Change-Id: Ieb3577479ee42d4f7c7ea6189ea96d1638cbdf39
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/interface/include/psa/client.h b/interface/include/psa/client.h
index b4e8b09..967db72 100644
--- a/interface/include/psa/client.h
+++ b/interface/include/psa/client.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -21,6 +21,13 @@
#define IOVEC_LEN(arr) ((uint32_t)(sizeof(arr)/sizeof(arr[0])))
#endif
+/**
+ * Type definitions equivalent to size_t as defined in the RoT Service
+ * environment.
+ */
+typedef uint32_t rot_size_t;
+#define ROT_SIZE_MAX UINT32_MAX
+
/*********************** PSA Client Macros and Types *************************/
/**