Samsung Internal API reference  2.0
Miscellaneous extensions

Data Structures

struct  TEES_ClientCredentials
 Client credentials structure. Used by TEES_GetClientCredentials(). More...
 

Functions

int TEES_GetTaskDataSize (size_t *data_size)
 Get used size of data memory of the current Trusted Application instance. More...
 
void * TEES_DupIwshmem (void *address, uint32_t size)
 Make long-life duplicate of an Interworld Shared memory buffer. More...
 
TEE_Result TEES_IsREESharedMemory (uint32_t accessFlags, const void *buffer, size_t size)
 Check is buffer shared with REE. More...
 
TEE_Result TEES_GetClientCredentials (struct TEES_ClientCredentials *credentials)
 Get client credentials (pid, gid, uid) More...
 

Detailed Description

Provides set of miscellaneous Samsung's extension of TEE Internal API.


Data Structure Documentation

struct TEES_ClientCredentials

Client credentials structure. Used by TEES_GetClientCredentials().

Data Fields
int gid

Group ID of client caller

int pid

Process ID of client

int uid

User ID of client caller

Function Documentation

void* TEES_DupIwshmem ( void *  address,
uint32_t  size 
)

#include <tees_extension.h>

Make long-life duplicate of an Interworld Shared memory buffer.

The TEES_DupIwshmem will make a copy of Interworld Shared memory buffer, that was passed in TEE_Param[] on TA entry. This copy became accessible by current Trusted Application instance during current and all the following TA entries, even if the buffer is not passed in TEE_Param[] anymore or TA entry have no TEE_Param argument at all. If buffer became not needed, TA may release it by calling munmap().

Parameters
[in]addressInterworld Shared memory buffer.
[in]sizeBuffer size.
Returns
Pointer to a copied buffer or NULL on error.
TEE_Result TEES_GetClientCredentials ( struct TEES_ClientCredentials credentials)

#include <tees_extension.h>

Get client credentials (pid, gid, uid)

TEES_GetClientCredentials fills struct pointed to by a parameter credentials with client's credentials. The client can be a CA employing TEE Client API or TA using Internal Client API. For full list of values see definition of struct TEES_ClientCredentials.

Parameters
[out]credentialsStructure to fill with values of client credentials
Return values
TEE_SUCCESSOn success.
TEE_ERROR_BAD_PARAMETERSWhen called with credentials == NULL.
TEE_RESULT_NOT_READYIf called when client session does not exist, i.e. in TA_CreateEntryPoint() or TA_DestroyEntryPoint().

Example:

TEE_Result res;
if ((res = TEES_GetClientCredentials(&creds)) == TEE_SUCCESS) {
printf("CA pid = %d, ...\n", creds.pid);
} else {
// handle error
}
int TEES_GetTaskDataSize ( size_t *  data_size)

#include <tees_extension.h>

Get used size of data memory of the current Trusted Application instance.

Parameters
[out]data_sizeOutput data memory size.
Return values
0On success.
-1On error. In this case errno is set with appropriate error code.
TEE_Result TEES_IsREESharedMemory ( uint32_t  accessFlags,
const void *  buffer,
size_t  size 
)

#include <tees_extension.h>

Check is buffer shared with REE.

The TEES_IsREESharedMemory examines memory buffer passed in a parameters buffer and size to determine whether Trusted Application instance can access buffer accordingly to requested accessFlags and buffer can be accessed by REE. If the characteristics of the buffer are compatible with accessFlags and REE can access this buffer, then the function returns TEE_SUCCESS. Otherwise, it returns TEE_ERROR_ACCESS_DENIED. Function should be used only to determine whether buffer shared. To determine whether buffer accessible exclusively by Trusted Application (not shared) use the TEE_CheckMemoryAccessRights.

The parameter accessFlags can contain one or more of the following flags:

  • TEE_MEMORY_ACCESS_READ: Check that the buffer is entirely readable by the current Trusted Application instance.
  • TEE_MEMORY_ACCESS_WRITE: Check that the buffer is entirely writable by the current Trusted Application instance. All other flags are reserved for future use and MUST be set to 0.

This function MUST NOT panic for any reason.

Parameters
[in]accessFlagsThe access flags to check.
[in]bufferPointer of the buffer to check.
[in]sizeSize of the buffer to check.
Return values
TEE_SUCCESSIf the entire buffer allows the requested accesses.
TEE_ERROR_ACCESS_DENIEDIf at least one byte in the buffer is not accessible with the requested accesses or REE may not access this buffer.
TEE_ERROR_BAD_PARAMETERSIf passed zero or unknown accessFlags.