My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
otz_tee_internal_storage_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 global platform TEE client API
25  */
26 
31 #ifndef OTZ_TEE_INTERNAL_STORAGE_API_H
32 #define OTZ_TEE_INTERNAL_STORAGE_API_H
33 #include <otz_tee_common.h>
34 #include <sw_common_types.h>
35 #include <otz_api.h>
36 #include <otz_tee_arith_api.h>
37 typedef enum
38 {
42 } TEE_Whence;
43 
44 typedef struct __TEE_ObjectEnumHandle* TEE_ObjectEnumHandle;
45 
51 };
52 
62  TEE_DATA_FLAG_CREATE = 0x00000200,
64 };
65 
70  TEE_USAGE_EXTRACTABLE = 0x00000001,
71  TEE_USAGE_ENCRYPT = 0x00000002,
72  TEE_USAGE_DECRYPT = 0x00000004,
73  TEE_USAGE_MAC = 0x00000008,
74  TEE_USAGE_SIGN = 0x00000010,
75  TEE_USAGE_VERIFY = 0x00000020,
76  TEE_USAGE_DERIVE = 0x00000040,
77 };
78 
87 };
88 
92 #define TEE_DATA_MAX_POSITION 0xFFFFFFFF
93 #define TEE_OBJECT_ID_MAX_LEN 64
94 
95 
102 void TEE_GetObjectInfo(
103  TEE_ObjectHandle object,
104  TEE_ObjectInfo* objectInfo);
105 
113  TEE_ObjectHandle object,
114  uint32_t objectUsage);
115 
127  TEE_ObjectHandle object,
128  uint32_t attributeID,
129  void* buffer, size_t* size);
130 
142  TEE_ObjectHandle object,
143  uint32_t attributeID,
144  uint32_t* a,
145  uint32_t* b);
146 
152 void TEE_CloseObject( TEE_ObjectHandle object);
153 
164  uint32_t objectType,
165  uint32_t maxObjectSize,
166  TEE_ObjectHandle* object);
167 
168 //TEE_AllocateTransientObject and Object Sizes
170  TEE_TYPE_AES, //128, 192, or 256 bits
171  TEE_TYPE_DES, //Always 56 bits
172  TEE_TYPE_DES3, //112 or 168 bits
173  TEE_TYPE_HMAC_MD5, //Between 64 and 512 bits, multiple of 8 bits
174  TEE_TYPE_HMAC_SHA1, //Between 80 and 512 bits, multiple of 8 bits
175  TEE_TYPE_HMAC_SHA224, //Between 112 and 512 bits, multiple of 8 bits
176  TEE_TYPE_HMAC_SHA256, //Between 192 and 1024 bits, multiple of 8 bits
177  TEE_TYPE_HMAC_SHA384, //Between 256 and 1024 bits, multiple of 8 bits
178  TEE_TYPE_HMAC_SHA512, //Between 256 and 1024 bits, multiple of 8 bits
179  TEE_TYPE_RSA_PUBLIC_KEY, //Object size is the number of bits in the modulus.
180  //All key size up to 2048 bits must be supported. Support for bigger key 3
181  //sizes is implementation-dependent. Minimum key size is 256 bits.
182  TEE_TYPE_RSA_KEYPAIR, //Same as for RSA public key size.
183  TEE_TYPE_DSA_PUBLIC_KEY, //Between 512 and 1024 bits, multiple of 64 bits
185  TEE_TYPE_DH_KEYPAIR, //From 256 to 2048 bits
186  TEE_TYPE_GENERIC_SECRET //Multiple of 8 bits, up to 4096 bits. This type is intended for secret data
187  //that is not directly used as a key in a cryptographic operation, but
188  //participates in a key derivation.
189 };
190 
197  TEE_ObjectHandle object);
198 
205  TEE_ObjectHandle object);
206 
217  TEE_ObjectHandle object,
218  TEE_Attribute* attrs,
219  uint32_t attrCount);
220 
230  TEE_Attribute* attr,
231  uint32_t attributeID,
232  void* buffer,
233  size_t length);
234 
244  TEE_Attribute* attr,
245  uint32_t attributeID,
246  uint32_t a, uint32_t b);
247 
255  TEE_ObjectHandle destObject,
256  TEE_ObjectHandle srcObject);
257 
269  TEE_ObjectHandle object,
270  uint32_t keySize,
271  TEE_Attribute* params,
272  uint32_t paramCount);
273 
286  uint32_t storageID,
287  void* objectID,
288  size_t objectIDLen,
289  uint32_t flags,
290  TEE_ObjectHandle* object);
291 
307  uint32_t storageID,
308  void* objectID,
309  size_t objectIDLen,
310  uint32_t flags,
311  TEE_ObjectHandle attributes,
312  void* initialData,
313  size_t initialDataLen,
314  TEE_ObjectHandle* object);
315 
322 
323 
334  TEE_ObjectHandle object,
335  void* newObjectID,
336  size_t newObjectIDLen);
337 
346  TEE_ObjectEnumHandle* objectEnumerator );
347 
354  objectEnumerator );
355 
356 
363  objectEnumerator );
364 
374  TEE_ObjectEnumHandle objectEnumerator,
375  uint32_t storageID);
376 
377 
389  TEE_ObjectEnumHandle objectEnumerator,
390  TEE_ObjectInfo objectInfo,
391  void* objectID,
392  size_t* objectIDLen );
393 
405  TEE_ObjectHandle object,
406  void* buffer,
407  size_t size,
408  uint32_t* count );
409 
420  TEE_ObjectHandle object,
421  void* buffer,
422  size_t size );
423 
433  TEE_ObjectHandle object,
434  uint32_t size );
435 
445 typedef signed int int32_t;
447  TEE_ObjectHandle object,
448  int32_t offset,
449  TEE_Whence whence );
450 
451 
452 
453 #endif
Data_Flag_Constants
Definition: otz_tee_internal_storage_api.h:56
TEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b)
Extracts one value attribute from an object attribute identified by the attributeID.
Definition: otz_tee_internal_storage_api.c:114
Definition: otz_tee_internal_storage_api.h:182
TEE_Result TEE_ReadObjectData(TEE_ObjectHandle object, void *buffer, size_t size, uint32_t *count)
Attempts to read size bytes from the data stream associated with the object into the buffer...
Definition: otz_tee_internal_storage_api.c:929
TEE_Result TEE_GetNextPersistentObject(TEE_ObjectEnumHandle objectEnumerator, TEE_ObjectInfo objectInfo, void *objectID, size_t *objectIDLen)
Gets the next object in an enumeration and returns information about the object: type, size, identifier, etc.
Definition: otz_tee_internal_storage_api.c:905
Definition: otz_tee_internal_storage_api.h:41
Definition: otz_tee_internal_storage_api.h:173
Definition: otz_tee_internal_storage_api.h:40
TEE_Result TEE_AllocatePersistentObjectEnumerator(TEE_ObjectEnumHandle *objectEnumerator)
Allocates a handle on an object enumerator. Once an object enumerator handle has been allocated it ca...
Definition: otz_tee_internal_storage_api.c:844
opaque structure definition for an object handle. TODO - Fill it with something appropriate ...
Definition: otz_api.h:299
Definition: otz_tee_internal_storage_api.h:86
Definition: otz_tee_internal_storage_api.h:71
TEE_Result TEE_CreatePersistentObject(uint32_t storageID, void *objectID, size_t objectIDLen, uint32_t flags, TEE_ObjectHandle attributes, void *initialData, size_t initialDataLen, TEE_ObjectHandle *object)
Creates a persistent object with initial attributes and an initial data stream content, and optionally returns a handle on the created object.
Definition: otz_tee_internal_storage_api.c:646
unsigned int uint32_t
Definition: otz_api.h:35
void TEE_ResetTransientObject(TEE_ObjectHandle object)
Resets a transient object to its initial state after allocation.
Definition: otz_tee_internal_storage_api.c:289
Definition: otz_tee_internal_storage_api.h:177
TEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, size_t *size)
Extracts one buffer attribute from an object attribute identified by the attributeID.
Definition: otz_tee_internal_storage_api.c:92
TEE_Result TEE_TruncateObjectData(TEE_ObjectHandle object, uint32_t size)
Changes the size of data stream.
Definition: otz_tee_internal_storage_api.c:1051
Definition: otz_tee_internal_storage_api.h:59
signed int int32_t
Definition: otz_tee_internal_storage_api.h:445
void TEE_CloseAndDeletePersistentObject(TEE_ObjectHandle object)
Marks an object for deletion and closes the object handle.
Definition: otz_tee_internal_storage_api.c:759
Definition: otz_tee_internal_storage_api.h:176
Definition: otz_tee_internal_storage_api.h:170
Object_Storage_Constants
Definition: otz_tee_internal_storage_api.h:49
Definition: otz_tee_internal_storage_api.h:57
void TEE_CopyObjectAttributes(TEE_ObjectHandle destObject, TEE_ObjectHandle srcObject)
function populates an uninitialized object handle destObject with the attributes of another object ha...
Definition: otz_tee_internal_storage_api.c:453
Definition: otz_tee_internal_storage_api.h:174
TEE_AllocateTransientObject
Definition: otz_tee_internal_storage_api.h:169
Definition: otz_tee_internal_storage_api.h:73
TEE_Result TEE_WriteObjectData(TEE_ObjectHandle object, void *buffer, size_t size)
Writes size bytes from the buffer to the date stream associated with the open object handle...
Definition: otz_tee_internal_storage_api.c:990
Definition: otz_tee_internal_storage_api.h:85
Definition: otz_tee_internal_storage_api.h:61
Definition: otz_tee_internal_storage_api.h:171
Definition: otz_tee_internal_storage_api.h:179
Definition: otz_tee_internal_storage_api.h:50
Definition: otz_tee_internal_storage_api.h:183
void TEE_FreeTransientObject(TEE_ObjectHandle object)
deallocates a transient object previously allocated with TEE_AllocateTransientObject ...
Definition: otz_tee_internal_storage_api.c:271
TEE_Result TEE_RenamePersistentObject(TEE_ObjectHandle object, void *newObjectID, size_t newObjectIDLen)
Changes the identifier of the object.
Definition: otz_tee_internal_storage_api.c:786
void TEE_RestrictObjectUsage(TEE_ObjectHandle object, uint32_t objectUsage)
Restricts the object usage flag of an object handled.
Definition: otz_tee_internal_storage_api.c:74
Definition: otz_tee_internal_storage_api.h:185
Handle_Flag_Constants
Definition: otz_tee_internal_storage_api.h:82
Usage_Constants
Definition: otz_tee_internal_storage_api.h:69
Definition: otz_tee_internal_storage_api.h:186
Definition: otz_tee_internal_storage_api.h:72
Definition: otz_tee_internal_storage_api.h:63
Definition: otz_api.h:267
void TEE_ResetPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator)
Resets an object enumerator handle to its initial state after allocation.
Definition: otz_tee_internal_storage_api.c:869
Definition: otz_api.h:280
s32int count
Definition: virtual_keyboard.c:40
Definition: otz_tee_internal_storage_api.h:39
struct __TEE_ObjectEnumHandle * TEE_ObjectEnumHandle
Definition: otz_tee_internal_storage_api.h:44
void TEE_FreePersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator)
Deallocates all resources associated with an object enumerator handle. After this function is called...
Definition: otz_tee_internal_storage_api.c:857
TEE_Whence
Definition: otz_tee_internal_storage_api.h:37
Definition: otz_tee_internal_storage_api.h:58
void TEE_InitRefAttribute(TEE_Attribute *attr, uint32_t attributeID, void *buffer, size_t length)
Helper function that can be used to populate a single attribute with reference to a buffer...
Definition: otz_tee_internal_storage_api.c:379
Definition: otz_tee_internal_storage_api.h:172
TEE_Result TEE_SeekObjectData(TEE_ObjectHandle object, int32_t offset, TEE_Whence whence)
Sets the data position indicator associated with the object handle.
Definition: otz_tee_internal_storage_api.c:1082
Definition: otz_tee_internal_storage_api.h:60
Definition: otz_tee_internal_storage_api.h:62
uint32_t TEE_Result
Definition: otz_tee_api.h:87
Definition: otz_tee_internal_storage_api.h:178
Definition: otz_tee_internal_storage_api.h:74
void TEE_CloseObject(TEE_ObjectHandle object)
closes an opened object handle. The object can be persistent or transient
Definition: otz_tee_internal_storage_api.c:133
Definition: otz_tee_internal_storage_api.h:70
void TEE_GetObjectInfo(TEE_ObjectHandle object, TEE_ObjectInfo *objectInfo)
Returns the characteristics of an object.
Definition: otz_tee_internal_storage_api.c:60
void TEE_InitValueAttribute(TEE_Attribute *attr, uint32_t attributeID, uint32_t a, uint32_t b)
Helper function that can be used to populate a single attribute with reference to integer value...
Definition: otz_tee_internal_storage_api.c:423
Definition: otz_tee_internal_storage_api.h:84
TEE_Result TEE_PopulateTransientObject(TEE_ObjectHandle object, TEE_Attribute *attrs, uint32_t attrCount)
Function populates an uninitialized object container with object attributes passed by the TA in the a...
Definition: otz_tee_internal_storage_api.c:311
Definition: otz_tee_internal_storage_api.h:83
TEE_Result TEE_OpenPersistentObject(uint32_t storageID, void *objectID, size_t objectIDLen, uint32_t flags, TEE_ObjectHandle *object)
Opens a handle on an existing persistent object.
Definition: otz_tee_internal_storage_api.c:554
TEE_Result TEE_GenerateKey(TEE_ObjectHandle object, uint32_t keySize, TEE_Attribute *params, uint32_t paramCount)
generates a random key or a key-pair and populates a transient key object with the generated key mate...
Definition: otz_tee_internal_storage_api.c:530
Definition: otz_tee_internal_storage_api.h:75
TEE_Result TEE_StartPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator, uint32_t storageID)
Starts the enumeration of all the persistent objects in a given Trusted Storage.
Definition: otz_tee_internal_storage_api.c:884
Definition: otz_tee_internal_storage_api.h:76
Definition: otz_tee_internal_storage_api.h:175
Definition: otz_tee_internal_storage_api.h:184