xref: /utopia/UTPA2-700.0.x/modules/sys/drv/sys/tee_client_api.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 /*
2  * Copyright (c) 2014, STMicroelectronics International N.V.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef TEE_CLIENT_API_H
28 #define TEE_CLIENT_API_H
29 
30 #ifndef __KERNEL__
31 #include <stdint.h>
32 #include <stddef.h>
33 #endif /* __KERNEL__ */
34 
35 /*
36  * Defines the number of available memory references in an open session or
37  * invoke command operation payload.
38  */
39 #define TEEC_CONFIG_PAYLOAD_REF_COUNT 4
40 
41 /**
42  * Defines the maximum size of a single shared memory block, in bytes, of both
43  * API allocated and API registered memory. The size is currently set to
44  * 512 * kB (512 * 1024).
45  */
46 #define TEEC_CONFIG_SHAREDMEM_MAX_SIZE 0x8000
47 
48 /**
49  * Flag constants indicating the type of parameters encoded inside the
50  * operation payload (TEEC_Operation), Type is uint32_t.
51  *
52  * TEEC_NONE                   The Parameter is not used
53  *
54  * TEEC_VALUE_INPUT            The Parameter is a TEEC_Value tagged as input.
55  *
56  * TEEC_VALUE_OUTPUT           The Parameter is a TEEC_Value tagged as output.
57  *
58  * TEEC_VALUE_INOUT            The Parameter is a TEEC_Value tagged as both as
59  *                             input and output, i.e., for which both the
60  *                             behaviors of TEEC_VALUE_INPUT and
61  *                             TEEC_VALUE_OUTPUT apply.
62  *
63  * TEEC_MEMREF_TEMP_INPUT      The Parameter is a TEEC_TempMemoryReference
64  *                             describing a region of memory which needs to be
65  *                             temporarily registered for the duration of the
66  *                             Operation and is tagged as input.
67  *
68  * TEEC_MEMREF_TEMP_OUTPUT     Same as TEEC_MEMREF_TEMP_INPUT, but the Memory
69  *                             Reference is tagged as output. The
70  *                             Implementation may update the size field to
71  *                             reflect the required output size in some use
72  *                             cases.
73  *
74  * TEEC_MEMREF_TEMP_INOUT      A Temporary Memory Reference tagged as both
75  *                             input and output, i.e., for which both the
76  *                             behaviors of TEEC_MEMREF_TEMP_INPUT and
77  *                             TEEC_MEMREF_TEMP_OUTPUT apply.
78  *
79  * TEEC_MEMREF_WHOLE           The Parameter is a Registered Memory Reference
80  *                             that refers to the entirety of its parent Shared
81  *                             Memory block. The parameter structure is a
82  *                             TEEC_MemoryReference. In this structure, the
83  *                             Implementation MUST read only the parent field
84  *                             and MAY update the size field when the operation
85  *                             completes.
86  *
87  * TEEC_MEMREF_PARTIAL_INPUT   A Registered Memory Reference structure that
88  *                             refers to a partial region of its parent Shared
89  *                             Memory block and is tagged as input.
90  *
91  * TEEC_MEMREF_PARTIAL_OUTPUT  Registered Memory Reference structure that
92  *                             refers to a partial region of its parent Shared
93  *                             Memory block and is tagged as output.
94  *
95  * TEEC_MEMREF_PARTIAL_INOUT   The Registered Memory Reference structure that
96  *                             refers to a partial region of its parent Shared
97  *                             Memory block and is tagged as both input and
98  *                             output, i.e., for which both the behaviors of
99  *                             TEEC_MEMREF_PARTIAL_INPUT and
100  *                             TEEC_MEMREF_PARTIAL_OUTPUT apply.
101  */
102 #define TEEC_NONE                   0x00000000
103 #define TEEC_VALUE_INPUT            0x00000001
104 #define TEEC_VALUE_OUTPUT           0x00000002
105 #define TEEC_VALUE_INOUT            0x00000003
106 #define TEEC_MEMREF_TEMP_INPUT      0x00000005
107 #define TEEC_MEMREF_TEMP_OUTPUT     0x00000006
108 #define TEEC_MEMREF_TEMP_INOUT      0x00000007
109 #define TEEC_MEMREF_WHOLE           0x0000000C
110 #define TEEC_MEMREF_PARTIAL_INPUT   0x0000000D
111 #define TEEC_MEMREF_PARTIAL_OUTPUT  0x0000000E
112 #define TEEC_MEMREF_PARTIAL_INOUT   0x0000000F
113 
114 /**
115  * Flag constants indicating the data transfer direction of memory in
116  * TEEC_Parameter. TEEC_MEM_INPUT signifies data transfer direction from the
117  * client application to the TEE. TEEC_MEM_OUTPUT signifies data transfer
118  * direction from the TEE to the client application. Type is uint32_t.
119  *
120  * TEEC_MEM_INPUT   The Shared Memory can carry data from the client
121  *                  application to the Trusted Application.
122  * TEEC_MEM_OUTPUT  The Shared Memory can carry data from the Trusted
123  *                  Application to the client application.
124  * TEEC_MEM_DMABUF  The Shared Memory is allocated with the dma buf api and
125  *                  not necessarily user mapped. The handle will be then the
126  *                  fd instead of the buffer
127  * TEEC_MEM_KAPI    Shared memory is required from another Linux module.
128  *                  Dma buf file descriptor is not created.
129  */
130 #define TEEC_MEM_INPUT   0x00000001
131 #define TEEC_MEM_OUTPUT  0x00000002
132 #define TEEC_MEM_DMABUF  0x00010000
133 #define TEEC_MEM_KAPI    0x00020000
134 
135 /**
136  * Return values. Type is TEEC_Result
137  *
138  * TEEC_SUCCESS                 The operation was successful.
139  * TEEC_ERROR_GENERIC           Non-specific cause.
140  * TEEC_ERROR_ACCESS_DENIED     Access privileges are not sufficient.
141  * TEEC_ERROR_CANCEL            The operation was canceled.
142  * TEEC_ERROR_ACCESS_CONFLICT   Concurrent accesses caused conflict.
143  * TEEC_ERROR_EXCESS_DATA       Too much data for the requested operation was
144  *                              passed.
145  * TEEC_ERROR_BAD_FORMAT        Input data was of invalid format.
146  * TEEC_ERROR_BAD_PARAMETERS    Input parameters were invalid.
147  * TEEC_ERROR_BAD_STATE         Operation is not valid in the current state.
148  * TEEC_ERROR_ITEM_NOT_FOUND    The requested data item is not found.
149  * TEEC_ERROR_NOT_IMPLEMENTED   The requested operation should exist but is not
150  *                              yet implemented.
151  * TEEC_ERROR_NOT_SUPPORTED     The requested operation is valid but is not
152  *                              supported in this implementation.
153  * TEEC_ERROR_NO_DATA           Expected data was missing.
154  * TEEC_ERROR_OUT_OF_MEMORY     System ran out of resources.
155  * TEEC_ERROR_BUSY              The system is busy working on something else.
156  * TEEC_ERROR_COMMUNICATION     Communication with a remote party failed.
157  * TEEC_ERROR_SECURITY          A security fault was detected.
158  * TEEC_ERROR_SHORT_BUFFER      The supplied buffer is too short for the
159  *                              generated output.
160  * TEEC_ERROR_TARGET_DEAD       Trusted Application has panicked
161  *                              during the operation.
162  */
163 
164 /**
165  *  Standard defined error codes.
166  */
167 #define TEEC_SUCCESS                0x00000000
168 #define TEEC_ERROR_GENERIC          0xFFFF0000
169 #define TEEC_ERROR_ACCESS_DENIED    0xFFFF0001
170 #define TEEC_ERROR_CANCEL           0xFFFF0002
171 #define TEEC_ERROR_ACCESS_CONFLICT  0xFFFF0003
172 #define TEEC_ERROR_EXCESS_DATA      0xFFFF0004
173 #define TEEC_ERROR_BAD_FORMAT       0xFFFF0005
174 #define TEEC_ERROR_BAD_PARAMETERS   0xFFFF0006
175 #define TEEC_ERROR_BAD_STATE        0xFFFF0007
176 #define TEEC_ERROR_ITEM_NOT_FOUND   0xFFFF0008
177 #define TEEC_ERROR_NOT_IMPLEMENTED  0xFFFF0009
178 #define TEEC_ERROR_NOT_SUPPORTED    0xFFFF000A
179 #define TEEC_ERROR_NO_DATA          0xFFFF000B
180 #define TEEC_ERROR_OUT_OF_MEMORY    0xFFFF000C
181 #define TEEC_ERROR_BUSY             0xFFFF000D
182 #define TEEC_ERROR_COMMUNICATION    0xFFFF000E
183 #define TEEC_ERROR_SECURITY         0xFFFF000F
184 #define TEEC_ERROR_SHORT_BUFFER     0xFFFF0010
185 #define TEEC_ERROR_EXTERNAL_CANCEL  0xFFFF0011
186 #define TEEC_ERROR_TARGET_DEAD      0xFFFF3024
187 
188 /**
189  * Function error origins, of type TEEC_ErrorOrigin. These indicate where in
190  * the software stack a particular return value originates from.
191  *
192  * TEEC_ORIGIN_API          The error originated within the TEE Client API
193  *                          implementation.
194  * TEEC_ORIGIN_COMMS        The error originated within the underlying
195  *                          communications stack linking the rich OS with
196  *                          the TEE.
197  * TEEC_ORIGIN_TEE          The error originated within the common TEE code.
198  * TEEC_ORIGIN_TRUSTED_APP  The error originated within the Trusted Application
199  *                          code.
200  */
201 #define TEEC_ORIGIN_API          0x00000001
202 #define TEEC_ORIGIN_COMMS        0x00000002
203 #define TEEC_ORIGIN_TEE          0x00000003
204 #define TEEC_ORIGIN_TRUSTED_APP  0x00000004
205 
206 /**
207  * Session login methods, for use in TEEC_OpenSession() as parameter
208  * connectionMethod. Type is uint32_t.
209  *
210  * TEEC_LOGIN_PUBLIC       No login data is provided.
211  * TEEC_LOGIN_USER         Login data about the user running the Client
212  *                         Application process is provided.
213  * TEEC_LOGIN_GROUP        Login data about the group running the Client
214  *                         Application process is provided.
215  * TEEC_LOGIN_APPLICATION  Login data about the running Client Application
216  *                         itself is provided.
217  */
218 #define TEEC_LOGIN_PUBLIC       0x00000000
219 #define TEEC_LOGIN_USER         0x00000001
220 #define TEEC_LOGIN_GROUP        0x00000002
221 #define TEEC_LOGIN_APPLICATION  0x00000004
222 
223 /**
224  * Encode the paramTypes according to the supplied types.
225  *
226  * @param p0 The first param type.
227  * @param p1 The second param type.
228  * @param p2 The third param type.
229  * @param p3 The fourth param type.
230  */
231 #define TEEC_PARAM_TYPES(p0, p1, p2, p3) \
232 	((p0) | ((p1) << 4) | ((p2) << 8) | ((p3) << 12))
233 
234 /**
235  * Get the i_th param type from the paramType.
236  *
237  * @param p The paramType.
238  * @param i The i-th parameter to get the type for.
239  */
240 #define TEEC_PARAM_TYPE_GET(p, i) (((p) >> (i * 4)) & 0xF)
241 
242 #define TEEC_MAX_DEVNAME_SIZE 256
243 typedef uint32_t TEEC_Result;
244 
245 /**
246  * struct TEEC_Context - Represents a connection between a client application
247  * and a TEE.
248  *
249  * Context identifier can be a handle (when opened from user land)
250  * or a structure pointer (when opened from kernel land).
251  * Identifier is defined as an union to match type sizes on all architectures.
252  */
253 typedef struct {
254 	char devname[256];
255 	union {
256 		struct tee_context *ctx;
257 		int fd;
258 	};
259 } TEEC_Context;
260 
261 /**
262  * This type contains a Universally Unique Resource Identifier (UUID) type as
263  * defined in RFC4122. These UUID values are used to identify Trusted
264  * Applications.
265  */
266 typedef struct {
267 	uint32_t timeLow;
268 	uint16_t timeMid;
269 	uint16_t timeHiAndVersion;
270 	uint8_t clockSeqAndNode[8];
271 } TEEC_UUID;
272 
273 /**
274  * In terms of compatible kernel, the data struct shared by client application
275  * and TEE driver should be restructrued in "compatible" rules. To keep GP's
276  * standard in compatibility mode, the anonymous padding members are filled
277  * in the struct definition below.
278  */
279 
280 
281 /**
282  * struct TEEC_SharedMemory - Memory to transfer data between a client
283  * application and trusted code.
284  *
285  * @param buffer      The memory buffer which is to be, or has been, shared
286  *                    with the TEE.
287  * @param size        The size, in bytes, of the memory buffer.
288  * @param flags       Bit-vector which holds properties of buffer.
289  *                    The bit-vector can contain either or both of the
290  *                    TEEC_MEM_INPUT and TEEC_MEM_OUTPUT flags.
291  *
292  * A shared memory block is a region of memory allocated in the context of the
293  * client application memory space that can be used to transfer data between
294  * that client application and a trusted application. The user of this struct
295  * is responsible to populate the buffer pointer.
296  */
297 typedef struct {
298 	union {
299 		void *buffer;
300 		uint64_t padding_ptr;
301 	};
302 	union {
303 		size_t size;
304 		uint64_t padding_sz;
305 	};
306 	uint32_t flags;
307 	/*
308 	 * Implementation-Defined, must match what the kernel driver have
309 	 *
310 	 * Identifier can store a handle (int) or a structure pointer (void *).
311 	 * Define this union to match case where sizeof(int)!=sizeof(void *).
312 	 */
313 	uint32_t reserved;
314 	union {
315 		int fd;
316 		void *ptr;
317 		uint64_t padding_d;
318 	} d;
319 	uint64_t registered;
320 } TEEC_SharedMemory;
321 
322 /**
323  * struct TEEC_TempMemoryReference - Temporary memory to transfer data between
324  * a client application and trusted code, only used for the duration of the
325  * operation.
326  *
327  * @param buffer  The memory buffer which is to be, or has been shared with
328  *                the TEE.
329  * @param size    The size, in bytes, of the memory buffer.
330  *
331  * A memory buffer that is registered temporarily for the duration of the
332  * operation to be called.
333  */
334 typedef struct {
335 	union {
336 		void *buffer;
337 		uint64_t padding_ptr;
338 	};
339 	union {
340 		size_t size;
341 		uint64_t padding_sz;
342 	};
343 } TEEC_TempMemoryReference;
344 
345 /**
346  * struct TEEC_RegisteredMemoryReference - use a pre-registered or
347  * pre-allocated shared memory block of memory to transfer data between
348  * a client application and trusted code.
349  *
350  * @param parent  Points to a shared memory structure. The memory reference
351  *                may utilize the whole shared memory or only a part of it.
352  *                Must not be NULL
353  *
354  * @param size    The size, in bytes, of the memory buffer.
355  *
356  * @param offset  The offset, in bytes, of the referenced memory region from
357  *                the start of the shared memory block.
358  *
359  */
360 typedef struct {
361 	union {
362 		TEEC_SharedMemory *parent;
363 		uint64_t padding_ptr;
364 	};
365 	union {
366 		size_t size;
367 		uint64_t padding_sz;
368 	};
369 	union {
370 		size_t offset;
371 		uint64_t padding_off;
372 	};
373 } TEEC_RegisteredMemoryReference;
374 
375 /**
376  * struct TEEC_Value - Small raw data container
377  *
378  * Instead of allocating a shared memory buffer this structure can be used
379  * to pass small raw data between a client application and trusted code.
380  *
381  * @param a  The first integer value.
382  *
383  * @param b  The second second value.
384  */
385 typedef struct {
386 	uint32_t a;
387 	uint32_t b;
388 } TEEC_Value;
389 
390 /**
391  * union TEEC_Parameter - Memory container to be used when passing data between
392  *                        client application and trusted code.
393  *
394  * Either the client uses a shared memory reference, parts of it or a small raw
395  * data container.
396  *
397  * @param tmpref  A temporary memory reference only valid for the duration
398  *                of the operation.
399  *
400  * @param memref  The entire shared memory or parts of it.
401  *
402  * @param value   The small raw data container to use
403  */
404 typedef union {
405 	TEEC_TempMemoryReference tmpref;
406 	TEEC_RegisteredMemoryReference memref;
407 	TEEC_Value value;
408 } TEEC_Parameter;
409 
410 /**
411  * struct TEEC_Session - Represents a connection between a client application
412  * and a trusted application.
413  *
414  * Session identifier can be a handle (when opened from user land) or a
415  * structure pointer (when opened from kernel land).
416  * Identifier is defined as an union to match type sizes on all architectures.
417  */
418 typedef union {
419 	int fd;
420 	struct tee_session *session;
421 } TEEC_Session;
422 
423 /**
424  * struct TEEC_Operation - Holds information and memory references used in
425  * TEEC_InvokeCommand().
426  *
427  * @param   started     Client must initialize to zero if it needs to cancel
428  *                      an operation about to be performed.
429  * @param   paramTypes  Type of data passed. Use TEEC_PARAMS_TYPE macro to
430  *                      create the correct flags.
431  *                      0 means TEEC_NONE is passed for all params.
432  * @param   params      Array of parameters of type TEEC_Parameter.
433  * @param   session     Internal pointer to the last session used by
434  *                      TEEC_InvokeCommand with this operation.
435  *
436  */
437 typedef struct {
438 	uint32_t started;
439 	uint32_t paramTypes;
440 	TEEC_Parameter params[TEEC_CONFIG_PAYLOAD_REF_COUNT];
441 	/* Implementation-Defined */
442 	union {
443 		TEEC_Session *session;
444 		uint64_t padding_ptr;
445 	};
446 	TEEC_SharedMemory memRefs[TEEC_CONFIG_PAYLOAD_REF_COUNT];
447 	uint64_t flags;
448 } TEEC_Operation;
449 
450 /**
451  * TEEC_InitializeContext() - Initializes a context holding connection
452  * information on the specific TEE, designated by the name string.
453 
454  * @param name    A zero-terminated string identifying the TEE to connect to.
455  *                If name is set to NULL, the default TEE is connected to. NULL
456  *                is the only supported value in this version of the API
457  *                implementation.
458  *
459  * @param context The context structure which is to be initialized.
460  *
461  * @return TEEC_SUCCESS  The initialization was successful.
462  * @return TEEC_Result   Something failed.
463  */
464 TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context);
465 
466 /**
467  * TEEC_FinalizeContext() - Destroys a context holding connection information
468  * on the specific TEE.
469  *
470  * This function destroys an initialized TEE context, closing the connection
471  * between the client application and the TEE. This function must only be
472  * called when all sessions related to this TEE context have been closed and
473  * all shared memory blocks have been released.
474  *
475  * @param context       The context to be destroyed.
476  */
477 void TEEC_FinalizeContext(TEEC_Context *context);
478 
479 /**
480  * TEEC_OpenSession() - Opens a new session with the specified trusted
481  *                      application.
482  *
483  * @param context            The initialized TEE context structure in which
484  *                           scope to open the session.
485  * @param session            The session to initialize.
486  * @param destination        A structure identifying the trusted application
487  *                           with which to open a session.
488  *
489  * @param connectionMethod   The connection method to use.
490  * @param connectionData     Any data necessary to connect with the chosen
491  *                           connection method. Not supported, should be set to
492  *                           NULL.
493  * @param operation          An operation structure to use in the session. May
494  *                           be set to NULL to signify no operation structure
495  *                           needed.
496  *
497  * @param returnOrigin       A parameter which will hold the error origin if
498  *                           this function returns any value other than
499  *                           TEEC_SUCCESS.
500  *
501  * @return TEEC_SUCCESS      OpenSession successfully opened a new session.
502  * @return TEEC_Result       Something failed.
503  *
504  */
505 TEEC_Result TEEC_OpenSession(TEEC_Context *context,
506 			     TEEC_Session *session,
507 			     const TEEC_UUID *destination,
508 			     uint32_t connectionMethod,
509 			     const void *connectionData,
510 			     TEEC_Operation *operation,
511 			     uint32_t *returnOrigin);
512 
513 /**
514  * TEEC_CloseSession() - Closes the session which has been opened with the
515  * specific trusted application.
516  *
517  * @param session The opened session to close.
518  */
519 void TEEC_CloseSession(TEEC_Session *session);
520 
521 /**
522  * TEEC_InvokeCommand() - Executes a command in the specified trusted
523  * application.
524  *
525  * @param session        A handle to an open connection to the trusted
526  *                       application.
527  * @param commandID      Identifier of the command in the trusted application
528  *                       to invoke.
529  * @param operation      An operation structure to use in the invoke command.
530  *                       May be set to NULL to signify no operation structure
531  *                       needed.
532  * @param returnOrigin   A parameter which will hold the error origin if this
533  *                       function returns any value other than TEEC_SUCCESS.
534  *
535  * @return TEEC_SUCCESS  OpenSession successfully opened a new session.
536  * @return TEEC_Result   Something failed.
537  */
538 TEEC_Result TEEC_InvokeCommand(TEEC_Session *session,
539 			       uint32_t commandID,
540 			       TEEC_Operation *operation,
541 			       uint32_t *returnOrigin);
542 
543 /**
544  * TEEC_RegisterSharedMemory() - Register a block of existing memory as a
545  * shared block within the scope of the specified context.
546  *
547  * @param context    The initialized TEE context structure in which scope to
548  *                   open the session.
549  * @param sharedMem  pointer to the shared memory structure to register.
550  *
551  * @return TEEC_SUCCESS              The registration was successful.
552  * @return TEEC_ERROR_OUT_OF_MEMORY  Memory exhaustion.
553  * @return TEEC_Result               Something failed.
554  */
555 TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context,
556 				      TEEC_SharedMemory *sharedMem);
557 
558 /**
559  * TEEC_AllocateSharedMemory() - Allocate shared memory for TEE.
560  *
561  * @param context     The initialized TEE context structure in which scope to
562  *                    open the session.
563  * @param sharedMem   Pointer to the allocated shared memory.
564  *
565  * @return TEEC_SUCCESS              The registration was successful.
566  * @return TEEC_ERROR_OUT_OF_MEMORY  Memory exhaustion.
567  * @return TEEC_Result               Something failed.
568  */
569 TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context,
570 				      TEEC_SharedMemory *sharedMem);
571 
572 /**
573  * TEEC_ReleaseSharedMemory() - Free or deregister the shared memory.
574  *
575  * @param sharedMem  Pointer to the shared memory to be freed.
576  */
577 void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMemory);
578 
579 /**
580  * TEEC_RequestCancellation() - Request the cancellation of a pending open
581  *                              session or command invocation.
582  *
583  * @param operation Pointer to an operation previously passed to open session
584  *                  or invoke.
585  */
586 void TEEC_RequestCancellation(TEEC_Operation *operation);
587 
588 /**
589  * Register a pre-allocated Trusted Application This is mainly intended for
590  * OS-FREE contexts or when a filesystem is not available.
591  *
592  * @param ta   Pointer to the trusted application binary
593  * @param size The size of the TA binary
594  *
595  * @return TEEC_SUCCESS if successful.
596  * @return TEEC_Result something failed.
597  */
598 TEEC_Result TEEC_RegisterTA(const void *ta, const size_t size);
599 
600 /**
601  * Unregister a pre-allocated Trusted Application This is mainly intended for
602  * OS-FREE contexts or when a filesystem is not available.
603  *
604  * @param ta Pointer to the trusted application binary
605  */
606 void TEEC_UnregisterTA(const void *ta);
607 
608 TEEC_Result TEEC_GetUuidBySession(TEEC_Session session,char* uuid );
609 
610 
611 #endif
612