My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
otz_api.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Header file for trustzone API
25  */
26 
27 #ifndef __OTZ_API_H_
28 #define __OTZ_API_H_
29 #include <sw_common_types.h>
30 #include <sw_list.h>
31 //#include <sw_types.h>
32 
33 #define TYPE_UINT_DEFINED 1
34 
35 typedef unsigned int uint32_t;
36 typedef unsigned short uint16_t;
37 typedef unsigned long long uint64_t;
38 #ifndef _STDINT_H
39 typedef char uint8_t;
40 #endif
41 
42 #define MAX_MEMBLOCKS_PER_OPERATION 4
43 
50  OTZ_SUCCESS = 0x0,
87 };
88 
122 };
123 
144 };
145 
160 };
161 
175 };
176 
186 };
187 
199 };
200 
203 
204 /* Trust zone client API */
205 
212 typedef struct otz_uuid_t
213 {
218 }otz_uuid_t;
219 
224 typedef struct otz_login_t
225 {
249 
255  void* p_buff;
256 
262 }otz_login_t;
263 
267 typedef struct {
276 
280 typedef struct {
282  union {
283  struct {
284  void* buffer; size_t length;
285  } ref;
286  struct
287  {
289  } value;
290  } content;
291 } TEE_Attribute;
292 
293 
300  void* dataPtr;
306 
307 };
313 typedef struct otz_property_t
314 {
322  void* p_value;
326 
327 /* Lists the functions exposed to the client by the system or service */
333 typedef struct otz_property_name_t
334 {
340 
346 typedef struct otz_timelimit_t otz_timelimit_t; /*Implementation Defined */
347 
348 
360 typedef struct otz_device_t otz_device_t;
365 
371 {
372  int cmd_id;
373  int encode_id;
376 };
377 
383 {
385  void *shared_mem;
392 };
393 
400 {
420  int s_errno;
422  /*struct {
423  }s_imp;*/ /* Implementation Defined */
424 
425 };
426 
433 {
449  /*struct {
450  }s_imp;*/ /* Implementation Defined */
451 
452 };
453 
460 {
468  int s_errno;
470  /*struct {
471  }s_imp;*/ /* Implementation Defined */
472 };
473 
482 {
509  void* p_block;
517  int s_errno;
519  struct list head_ref;
521  /*struct {
522  }s_imp;*/ /* Implementation Defined */
523 };
524 
525 
526 
562 otz_return_t otz_device_open(void const* pk_device_name, void const* pk_init,
563  otz_device_t* ps_device);
564 
589  uint32_t ui_timeout,
590  otz_timelimit_t* ps_timelimit);
591 
654 /* otz_uuid_t const* pks_service, */
655  int pks_service,
656  otz_login_t const* pks_login,
657  otz_timelimit_t const* pks_timelimit,
658  otz_session_t* ps_session,
659  otz_operation_t* ps_operation );
660 
709  uint32_t ui_command,
710  otz_timelimit_t const* pks_timelimit,
711  otz_operation_t* ps_operation);
712 
806  otz_return_t* pui_service_return);
807 
842 void otz_operation_release(otz_operation_t* ps_operation);
843 
898  otz_operation_t* ps_operation);
899 
930 
931 
993  otz_shared_mem_t* ps_shared_mem);
994 
1023 void otz_shared_memory_release(otz_shared_mem_t* ps_shared_mem);
1024 
1051 void otz_encode_uint32( otz_operation_t* ps_operation,
1052  void const* data,
1053  int param_type);
1054 
1094 void otz_encode_array( otz_operation_t* ps_operation,
1095  void const* pk_array,
1096  uint32_t length,
1097  int param_type);
1098 
1148 void* otz_encode_array_space( otz_operation_t* ps_operation,
1149  uint32_t length,
1150  int param_type);
1151 
1152 
1153 
1223 void otz_encode_memory_reference( otz_operation_t* ps_operation,
1224  otz_shared_mem_t* ps_shared_mem,
1225  uint32_t offset,
1226  uint32_t length,
1227  uint32_t flags,
1228  int param_type);
1229 
1230 
1272 
1273 
1337 void* otz_decode_array_space(otz_operation_t* ps_operation, uint32_t *plength);
1338 
1339 
1340 
1362 
1383 
1384 #endif
uint32_t otz_return_t
Definition: otz_api.h:201
otz_type_of_operation
Operation type constants.
Definition: otz_api.h:166
Definition: otz_api.h:198
int service_id
Definition: otz_api.h:441
int operation_count
Definition: otz_api.h:437
uint32_t b
Definition: otz_api.h:288
struct otz_login_t otz_login_t
Login credentials to be provided to the service.
Definition: otz_api.h:115
uint32_t objectType
Definition: otz_api.h:268
Definition: otz_api.h:168
uint32_t length
Definition: otz_api.h:389
Definition: otz_api.h:70
Definition: otz_api.h:117
uint32_t otz_decode_get_type(otz_operation_t *ps_operation)
Returns the decoder stream data type.
Definition: otz_api.c:1262
uint32_t ui_length
Definition: otz_api.h:324
Definition: otz_api.h:74
void otz_shared_memory_release(otz_shared_mem_t *ps_shared_mem)
This function allocates a block of memory, defined by the structure pointed to by ps_shared_mem...
Definition: otz_api.c:705
int operation_count
Definition: otz_api.h:515
Definition: otz_api.h:50
void otz_encode_memory_reference(otz_operation_t *ps_operation, otz_shared_mem_t *ps_shared_mem, uint32_t offset, uint32_t length, uint32_t flags, int param_type)
Appends a reference of previously allocated shared block to the encoded buffer.
Definition: otz_api.c:1056
void * otz_encode_array_space(otz_operation_t *ps_operation, uint32_t length, int param_type)
Encode empty binary array to the encoded message.
Definition: otz_api.c:942
otz_shared_mem_flags
Shared memory flag constants.
Definition: otz_api.h:151
int session_id
Definition: otz_api.h:513
struct list shared_mem_list
Definition: otz_api.h:447
uint32_t ui_flags
Definition: otz_api.h:507
opaque structure definition for an object handle. TODO - Fill it with something appropriate ...
Definition: otz_api.h:299
Definition: otz_api.h:101
Definition: otz_api.h:196
uint32_t ui_length
Definition: otz_api.h:495
uint32_t objectSize
Definition: otz_api.h:269
Definition: otz_api.h:86
otz_return_t otz_shared_memory_allocate(otz_session_t *ps_session, otz_shared_mem_t *ps_shared_mem)
This function allocates a block of memory, defined by the structure pointed to by ps_shared_mem...
Definition: otz_api.c:592
int cmd_id
Definition: otz_api.h:372
unsigned short uint16_t
Definition: otz_api.h:36
otz_device_t * device
Definition: otz_api.h:445
struct otz_uuid_t otz_uuid_t
Universally Unique IDentifier (UUID) type as defined in [RFC4122].A.
unsigned int uint32_t
Definition: otz_api.h:35
The otz_session_t structure is used to contain control information related to a session between a cli...
Definition: otz_api.h:432
Definition: otz_api.h:99
otz_session_t * session
Definition: otz_api.h:404
uint32_t ui_namespace
Definition: otz_api.h:336
void otz_encode_array(otz_operation_t *ps_operation, void const *pk_array, uint32_t length, int param_type)
Encode binary array to the encoded message.
Definition: otz_api.c:896
void * p_buff
Definition: otz_api.h:255
Definition: otz_api.h:185
Universally Unique IDentifier (UUID) type as defined in [RFC4122].A.
Definition: otz_api.h:212
Definition: otz_api.h:80
Definition: otz_api.h:143
Definition: otz_api.h:72
Definition: otz_api.h:82
int session_id
Definition: otz_api.h:439
otz_login_flags
Login flag constants.
Definition: otz_api.h:129
otz_session_t * session
Definition: otz_api.h:511
int s_errno
Definition: otz_api.h:517
Definition: otz_api.h:113
otz_decode_type
Decode type constants.
Definition: otz_api.h:192
struct otz_property_t otz_property_t
Name value pairs.
Definition: otz_api.h:155
uint32_t ui_namespace
Definition: otz_api.h:316
Login credentials to be provided to the service.
Definition: otz_api.h:224
Definition: otz_api.h:153
int dec_error_state
Definition: otz_api.h:375
Encoder and decoder state.
Definition: otz_api.h:370
uint32_t otz_state_t
Definition: otz_api.h:202
TEE_Attribute * Attribute
Definition: otz_api.h:304
otz_return_t otz_operation_prepare_open(otz_device_t *ps_device, int pks_service, otz_login_t const *pks_login, otz_timelimit_t const *pks_timelimit, otz_session_t *ps_session, otz_operation_t *ps_operation)
Prepare open operation.
Definition: otz_api.c:145
uint32_t shared_mem_cnt
Definition: otz_api.h:443
int param_type
Definition: otz_api.h:391
uint32_t ui_name
Definition: otz_api.h:318
uint32_t type
Definition: otz_api.h:406
uint8_t aui_clock_seq_and_node[8]
Definition: otz_api.h:217
Definition: otz_api.h:78
Definition: otz_api.h:54
Definition: otz_api.h:62
uint16_t ui_time_hi_and_version
Definition: otz_api.h:216
Service property.
Definition: otz_api.h:333
uint32_t maxObjectSize
Definition: otz_api.h:270
uint32_t objectUsage
Definition: otz_api.h:271
uint32_t fd
Definition: otz_api.h:464
int session_count
Definition: otz_api.h:466
struct otz_timelimit_t otz_timelimit_t
Absolute time since an arbitary origin.
Definition: otz_api.h:346
Definition: otz_api.h:170
Definition: otz_api.h:172
Definition: otz_api.h:121
u8 * data
Definition: fat32.c:40
uint32_t ui_buff_len
Definition: otz_api.h:261
void * p_block
Definition: otz_api.h:509
struct otz_mem_reference shared_mem[MAX_MEMBLOCKS_PER_OPERATION]
Definition: otz_api.h:412
uint32_t attributeID
Definition: otz_api.h:281
otz_return_t otz_decode_get_error(otz_operation_t *ps_operation)
Get decode error.
Definition: otz_api.c:1320
struct list head_ref
Definition: otz_api.h:519
otz_return_t otz_device_get_timelimit(otz_device_t *ps_device, uint32_t ui_timeout, otz_timelimit_t *ps_timelimit)
Get local time limit.
Definition: otz_api.c:121
void otz_encode_uint32(otz_operation_t *ps_operation, void const *data, int param_type)
Encode unsigned 32-bit integer.
Definition: otz_api.c:851
otz_state_t ui_state
Definition: otz_api.h:402
uint32_t ui_time_low
Definition: otz_api.h:214
otz_return_t otz_operation_prepare_close(otz_session_t *ps_session, otz_operation_t *ps_operation)
Prepare the operation for close session.
Definition: otz_api.c:231
int temp_mem_ref_count
Definition: otz_api.h:418
otz_error_codes
Error codes.
Definition: otz_api.h:48
Definition: otz_api.h:84
int s_errno
Definition: otz_api.h:468
Definition: otz_api.h:159
Name value pairs.
Definition: otz_api.h:313
struct otz_enc_dec_t enc_dec
Definition: otz_api.h:410
uint32_t otz_decode_uint32(otz_operation_t *ps_operation)
Decode a unsigned 32-bit integer value from message.
Definition: otz_api.c:1177
The otz_shared_memory_t structure is used to contain control information related to a block of shared...
Definition: otz_api.h:481
otz_return_t otz_operation_prepare_invoke(otz_session_t *ps_session, uint32_t ui_command, otz_timelimit_t const *pks_timelimit, otz_operation_t *ps_operation)
Prepare operation for service request.
Definition: otz_api.c:191
void * shared_mem
Definition: otz_api.h:385
void otz_operation_release(otz_operation_t *ps_operation)
Release operation.
Definition: otz_api.c:495
otz_state_t ui_state
Definition: otz_api.h:435
uint32_t ui_time_mid
Definition: otz_api.h:215
otz_param_type
Param type constants.
Definition: otz_api.h:181
int enc_error_state
Definition: otz_api.h:374
TEE_ObjectInfo * ObjectInfo
Definition: otz_api.h:303
otz_return_t otz_operation_perform(otz_operation_t *ps_operation, otz_return_t *pui_service_return)
Performs the previously prepared operation.
Definition: otz_api.c:280
Definition: otz_api.h:267
Definition: otz_api.h:76
otz_return_t otz_device_close(otz_device_t *ps_device)
Close the device connection.
Definition: otz_api.c:781
uint32_t dataSize
Definition: otz_api.h:272
uint32_t dataLen
Definition: otz_api.h:301
uint32_t offset
Definition: otz_api.h:387
Definition: otz_api.h:133
Definition: otz_api.h:105
void * p_value
Definition: otz_api.h:322
otz_return_t otz_device_open(void const *pk_device_name, void const *pk_init, otz_device_t *ps_device)
Open the device.
Definition: otz_api.c:64
Definition: otz_api.h:280
int shared_mem_ref_count
Definition: otz_api.h:414
Definition: otz_api.h:141
Definition: otz_api.h:52
Definition: otz_api.h:131
Definition: otz_api.h:103
int s_errno
Definition: otz_api.h:420
Definition: otz_api.h:56
Definition: otz_api.h:68
Definition: sw_list.h:56
uint8_t dataName[255]
Definition: otz_api.h:302
uint32_t ui_name
Definition: otz_api.h:338
Shared memory reference.
Definition: otz_api.h:382
Definition: otz_api.h:137
otz_state_t ui_state
Definition: otz_api.h:493
Definition: otz_api.h:66
Definition: otz_api.h:109
Definition: otz_api.h:64
Definition: otz_api.h:139
void * dataPtr
Definition: otz_api.h:300
Definition: otz_api.h:58
otz_state_machine_state_const
State machine constants.
Definition: otz_api.h:93
struct otz_property_name_t otz_property_name_t
Service property.
The otz_device_t structure is used to contain control information related to the device.
Definition: otz_api.h:459
uint32_t handleFlags
Definition: otz_api.h:274
Definition: otz_api.h:194
char uint8_t
Definition: otz_api.h:39
unsigned long long uint64_t
Definition: otz_api.h:37
int session_id
Definition: otz_api.h:408
otz_state_t ui_state
Definition: otz_api.h:462
int encode_id
Definition: otz_api.h:373
struct otz_mem_reference temp_mem[MAX_MEMBLOCKS_PER_OPERATION]
Definition: otz_api.h:416
Definition: otz_api.h:60
Definition: otz_api.h:135
The otz_operation_t structure is used to contain control information related to an operation that is ...
Definition: otz_api.h:399
uint32_t dataPosition
Definition: otz_api.h:273
Definition: otz_api.h:174
size_t length
Definition: otz_api.h:284
#define MAX_MEMBLOCKS_PER_OPERATION
Definition: otz_api.h:42
Definition: otz_api.h:183
void * otz_decode_array_space(otz_operation_t *ps_operation, uint32_t *plength)
Decode a block of binary data from the message.
Definition: otz_api.c:1219
uint32_t ui_type
Definition: otz_api.h:248
Definition: otz_api.h:157
uint32_t attributesLen
Definition: otz_api.h:305