summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Dynowski <k.dynowski@samsung.com>2018-01-03 13:16:52 +0100
committerTomasz Swierczek <t.swierczek@samsung.com>2018-01-04 12:34:42 +0000
commit15af876c011436af06f616a110a2ee6c0c5f7677 (patch)
tree5b377e2b3a1c0eb72c34526e418db8ab646b8030
parent002445646d1818fc2e5d99d4a81b12f6426b7793 (diff)
downloadlibteec-15af876c011436af06f616a110a2ee6c0c5f7677.tar.gz
libteec-15af876c011436af06f616a110a2ee6c0c5f7677.tar.bz2
libteec-15af876c011436af06f616a110a2ee6c0c5f7677.zip
Change-Id: I26102a69a036122bde3bd65b4e27c4210700e60d
-rw-r--r--api/tef/tee_client_api.h4
-rw-r--r--src/optee/creators.c6
-rw-r--r--src/simulator/creators.c14
3 files changed, 8 insertions, 16 deletions
diff --git a/api/tef/tee_client_api.h b/api/tef/tee_client_api.h
index 6258375..7021b17 100644
--- a/api/tef/tee_client_api.h
+++ b/api/tef/tee_client_api.h
@@ -249,7 +249,7 @@ extern "C" {
* @param[in] p3 The fourth param type.
*/
#define TEEC_PARAM_TYPES(p0, p1, p2, p3) \
- ((p0) | ((p1) << 4) | ((p2) << 8) | ((p3) << 12))
+ ((p0) | ((p1) << 8) | ((p2) << 16) | ((p3) << 24))
/**
* @brief Get the i_th param type from the paramType.
@@ -259,7 +259,7 @@ extern "C" {
* @param p[in] The paramType.
* @param i[in] The i-th parameter to get the type for.
*/
-#define TEEC_PARAM_TYPE_GET(p, i) (((p) >> (i * 4)) & 0xF)
+#define TEEC_PARAM_TYPE_GET(p, i) (((p) >> (i * 8)) & 0xF)
/**
* @brief This type is used to contain return codes which are the results of invoking TEE Client API functions.
diff --git a/src/optee/creators.c b/src/optee/creators.c
index 94a2a83..bfb4a8d 100644
--- a/src/optee/creators.c
+++ b/src/optee/creators.c
@@ -37,5 +37,9 @@ void *optee_TEEC_SharedMemory()
}
uint32_t optee_paramTypes(uint32_t api_params)
{
- return api_params;
+ uint8_t p[4];
+ for (int i = 0; i < 4; ++i) {
+ p[i] = TEEC_PARAM_TYPE_GET(api_params, i);
+ }
+ return TEEC_PARAM_TYPES(p[0], p[1], p[2], p[3]);
}
diff --git a/src/simulator/creators.c b/src/simulator/creators.c
index 981176a..5e6e786 100644
--- a/src/simulator/creators.c
+++ b/src/simulator/creators.c
@@ -36,19 +36,7 @@ void *simulator_TEEC_SharedMemory()
return malloc(sizeof(TEEC_SharedMemory));
}
-/* copied from simulator tee_client_api.h
- */
-#define SIMULATOR_PARAM_TYPES(param0Type, param1Type, param2Type, param3Type) \
- (uint32_t)(((param0Type) & 0x7f) | \
- (((param1Type) & 0x7f) << 8) | \
- (((param2Type) & 0x7f) << 16) | \
- (((param3Type) & 0x7f) << 24))
-
uint32_t simulator_paramTypes(uint32_t api_params)
{
- uint8_t p[4];
- for (int i = 0; i < 4; ++i) {
- p[i] = TEEC_PARAM_TYPE_GET(api_params, i);
- }
- return SIMULATOR_PARAM_TYPES(p[0], p[1], p[2], p[3]);
+ return api_params;
}