17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci#ifndef __TEE_OBJECT_API_H 177777dab0Sopenharmony_ci#define __TEE_OBJECT_API_H 187777dab0Sopenharmony_ci 197777dab0Sopenharmony_ci/** 207777dab0Sopenharmony_ci * @addtogroup TeeTrusted 217777dab0Sopenharmony_ci * @{ 227777dab0Sopenharmony_ci * 237777dab0Sopenharmony_ci * @brief TEE(Trusted Excution Environment) API. 247777dab0Sopenharmony_ci * Provides security capability APIs such as trusted storage, encryption and decryption, 257777dab0Sopenharmony_ci * and trusted time for trusted application development. 267777dab0Sopenharmony_ci * 277777dab0Sopenharmony_ci * @since 12 287777dab0Sopenharmony_ci */ 297777dab0Sopenharmony_ci 307777dab0Sopenharmony_ci/** 317777dab0Sopenharmony_ci * @file tee_object_api.h 327777dab0Sopenharmony_ci * 337777dab0Sopenharmony_ci * @brief Provides trusted storage APIs. 347777dab0Sopenharmony_ci * 357777dab0Sopenharmony_ci * You can use these APIs to implement trusted storage features. 367777dab0Sopenharmony_ci * 377777dab0Sopenharmony_ci * @library NA 387777dab0Sopenharmony_ci * @kit TEEKit 397777dab0Sopenharmony_ci * @syscap SystemCapability.Tee.TeeClient 407777dab0Sopenharmony_ci * @since 12 417777dab0Sopenharmony_ci * @version 1.0 427777dab0Sopenharmony_ci */ 437777dab0Sopenharmony_ci 447777dab0Sopenharmony_ci#include "tee_defines.h" 457777dab0Sopenharmony_ci 467777dab0Sopenharmony_ci#ifdef __cplusplus 477777dab0Sopenharmony_ciextern "C" { 487777dab0Sopenharmony_ci#endif 497777dab0Sopenharmony_ci 507777dab0Sopenharmony_ci/** 517777dab0Sopenharmony_ci * @brief Defines <b>HANDLE_NULL</b>, which is used to denote the absence of a handle. 527777dab0Sopenharmony_ci * 537777dab0Sopenharmony_ci * @since 12 547777dab0Sopenharmony_ci */ 557777dab0Sopenharmony_ci#define TEE_HANDLE_NULL 0x00000000 567777dab0Sopenharmony_ci 577777dab0Sopenharmony_ci/** 587777dab0Sopenharmony_ci * @brief Enumerates the usages of the key of the <b>TEE_ObjectHandle</b>. 597777dab0Sopenharmony_ci * 607777dab0Sopenharmony_ci * @since 12 617777dab0Sopenharmony_ci */ 627777dab0Sopenharmony_cienum Usage_Constants { 637777dab0Sopenharmony_ci /** The object's key is extractable. */ 647777dab0Sopenharmony_ci TEE_USAGE_EXTRACTABLE = 0x00000001, 657777dab0Sopenharmony_ci /** Used for encryption. */ 667777dab0Sopenharmony_ci TEE_USAGE_ENCRYPT = 0x00000002, 677777dab0Sopenharmony_ci /** Used for decryption. */ 687777dab0Sopenharmony_ci TEE_USAGE_DECRYPT = 0x00000004, 697777dab0Sopenharmony_ci /** Used for hash calculation. */ 707777dab0Sopenharmony_ci TEE_USAGE_MAC = 0x00000008, 717777dab0Sopenharmony_ci /** Used for creating a signature. */ 727777dab0Sopenharmony_ci TEE_USAGE_SIGN = 0x00000010, 737777dab0Sopenharmony_ci /** Used for signature verification. */ 747777dab0Sopenharmony_ci TEE_USAGE_VERIFY = 0x00000020, 757777dab0Sopenharmony_ci /** Used for key derivation. */ 767777dab0Sopenharmony_ci TEE_USAGE_DERIVE = 0x00000040, 777777dab0Sopenharmony_ci /** Used for object initialization, with all permissions assigned by default. */ 787777dab0Sopenharmony_ci TEE_USAGE_DEFAULT = 0xFFFFFFFF, 797777dab0Sopenharmony_ci}; 807777dab0Sopenharmony_ci 817777dab0Sopenharmony_ci/** 827777dab0Sopenharmony_ci * @brief Defines information about the object pointed to by the flag of the <b>TEE_ObjectHandle</b>, 837777dab0Sopenharmony_ci * for example, whether the object is a persistent object or is initialized. 847777dab0Sopenharmony_ci * 857777dab0Sopenharmony_ci * @since 12 867777dab0Sopenharmony_ci */ 877777dab0Sopenharmony_cienum Handle_Flag_Constants { 887777dab0Sopenharmony_ci /** The object is a persistent object. */ 897777dab0Sopenharmony_ci TEE_HANDLE_FLAG_PERSISTENT = 0x00010000, 907777dab0Sopenharmony_ci /** The object is initialized. */ 917777dab0Sopenharmony_ci TEE_HANDLE_FLAG_INITIALIZED = 0x00020000, 927777dab0Sopenharmony_ci /** Reserved */ 937777dab0Sopenharmony_ci TEE_HANDLE_FLAG_KEY_SET = 0x00040000, 947777dab0Sopenharmony_ci /** Reserved */ 957777dab0Sopenharmony_ci TEE_HANDLE_FLAG_EXPECT_TWO_KEYS = 0x00080000, 967777dab0Sopenharmony_ci}; 977777dab0Sopenharmony_ci 987777dab0Sopenharmony_ci/** 997777dab0Sopenharmony_ci * @brief Defines a value attribute identifier flag. 1007777dab0Sopenharmony_ci * 1017777dab0Sopenharmony_ci * @since 12 1027777dab0Sopenharmony_ci */ 1037777dab0Sopenharmony_ci#define TEE_ATTR_FLAG_VALUE 0x20000000 1047777dab0Sopenharmony_ci 1057777dab0Sopenharmony_ci/** 1067777dab0Sopenharmony_ci * @brief Defines a public attribute identifier flag. 1077777dab0Sopenharmony_ci * 1087777dab0Sopenharmony_ci * @since 12 1097777dab0Sopenharmony_ci */ 1107777dab0Sopenharmony_ci#define TEE_ATTR_FLAG_PUBLIC 0x10000000 1117777dab0Sopenharmony_ci 1127777dab0Sopenharmony_ci/** 1137777dab0Sopenharmony_ci * @brief Check whether the attribute is a buffer. 1147777dab0Sopenharmony_ci * 1157777dab0Sopenharmony_ci * @since 12 1167777dab0Sopenharmony_ci */ 1177777dab0Sopenharmony_ci#define TEE_ATTR_IS_BUFFER(attribute_id) ((((attribute_id) << 2) >> 31) == 0) 1187777dab0Sopenharmony_ci 1197777dab0Sopenharmony_ci/** 1207777dab0Sopenharmony_ci * @brief Check whether the attribute is a value. 1217777dab0Sopenharmony_ci * 1227777dab0Sopenharmony_ci * @since 12 1237777dab0Sopenharmony_ci */ 1247777dab0Sopenharmony_ci#define TEE_ATTR_IS_VALUE(attribute_id) ((((attribute_id) << 2) >> 31) == 1) 1257777dab0Sopenharmony_ci 1267777dab0Sopenharmony_ci/** 1277777dab0Sopenharmony_ci * @brief Check whether the attribute is protected. 1287777dab0Sopenharmony_ci * 1297777dab0Sopenharmony_ci * @since 12 1307777dab0Sopenharmony_ci */ 1317777dab0Sopenharmony_ci#define TEE_ATTR_IS_PROTECTED(attribute_id) ((((attribute_id) << 3) >> 31) == 0) 1327777dab0Sopenharmony_ci 1337777dab0Sopenharmony_ci/** 1347777dab0Sopenharmony_ci * @brief Check whether the attribute is public. 1357777dab0Sopenharmony_ci * 1367777dab0Sopenharmony_ci * @since 12 1377777dab0Sopenharmony_ci */ 1387777dab0Sopenharmony_ci#define TEE_ATTR_IS_PUBLIC(attribute_id) ((((attribute_id) << 3) >> 31) == 1) 1397777dab0Sopenharmony_ci 1407777dab0Sopenharmony_ci/** 1417777dab0Sopenharmony_ci * @brief Obtains a buffer attribute from the <b>TEE_Attribute</b> struct of the object pointed 1427777dab0Sopenharmony_ci * to by <b>TEE_ObjectHandle</b>. 1437777dab0Sopenharmony_ci * 1447777dab0Sopenharmony_ci * The members in the <b>TEE_Attribute</b> struct must be <b>ref</b>. If the <b>TEE_Attribute</b> is private, 1457777dab0Sopenharmony_ci * the <b>Usage_Constants</b> of the object must include <b>TEE_USAGE_EXTRACTABLE</b>. 1467777dab0Sopenharmony_ci * 1477777dab0Sopenharmony_ci * @param object Indicates the handle of the object. 1487777dab0Sopenharmony_ci * @param attributeID Indicates the ID of the attribute to obtain, for example, <b>TEE_ObjectAttribute</b>. 1497777dab0Sopenharmony_ci * The attribute ID can also be customized. 1507777dab0Sopenharmony_ci * @param buffer Indicates the pointer to the buffer that stores the attribute obtained. 1517777dab0Sopenharmony_ci * @param size Indicates the pointer to the length of the content stored. 1527777dab0Sopenharmony_ci * 1537777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 1547777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the <b>TEE_Attribute</b> cannot be found in the object 1557777dab0Sopenharmony_ci * or the object is not initialized. 1567777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the buffer is too small to store the content obtained. 1577777dab0Sopenharmony_ci * 1587777dab0Sopenharmony_ci * @since 12 1597777dab0Sopenharmony_ci * @version 1.0 1607777dab0Sopenharmony_ci */ 1617777dab0Sopenharmony_ciTEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, size_t *size); 1627777dab0Sopenharmony_ci 1637777dab0Sopenharmony_ci/** 1647777dab0Sopenharmony_ci * @brief Obtains a value attribute from the <b>TEE_Attribute</b> of an object. 1657777dab0Sopenharmony_ci * 1667777dab0Sopenharmony_ci * The members of the <b>TEE_Attribute</b> struct must be values. If the <b>TEE_Attribute</b> is private, 1677777dab0Sopenharmony_ci * the <b>Usage_Constants</b> of the object must include <b>TEE_USAGE_EXTRACTABLE</b>. 1687777dab0Sopenharmony_ci * 1697777dab0Sopenharmony_ci * @param object Indicates the handle of the object. 1707777dab0Sopenharmony_ci * @param attributeID Indicates the ID of the attribute to obtain, for example, <b>TEE_ObjectAttribute</b>. 1717777dab0Sopenharmony_ci * The attribute ID can also be customized. 1727777dab0Sopenharmony_ci * @param a Indicates the pointer to the placeholder filled with the attribute field <b>a</b>. 1737777dab0Sopenharmony_ci * @param b Indicates the pointer to the placeholder filled with the attribute field <b>b</b>. 1747777dab0Sopenharmony_ci * 1757777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 1767777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the <b>TEE_Attribute</b> cannot be found in the object 1777777dab0Sopenharmony_ci * or the object is not initialized. 1787777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_ACCESS_DENIED</b> if <b>TEE_Attribute</b> is private 1797777dab0Sopenharmony_ci * but the object <b>Usage_Constants</b> does not contain the <b>TEE_USAGE_EXTRACTABLE</b> flag. 1807777dab0Sopenharmony_ci * 1817777dab0Sopenharmony_ci * @since 12 1827777dab0Sopenharmony_ci * @version 1.0 1837777dab0Sopenharmony_ci */ 1847777dab0Sopenharmony_ciTEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b); 1857777dab0Sopenharmony_ci 1867777dab0Sopenharmony_ci/** 1877777dab0Sopenharmony_ci * @brief Closes a <b>TEE_ObjectHandle</b> object. 1887777dab0Sopenharmony_ci * 1897777dab0Sopenharmony_ci * The object can be persistent or transient. 1907777dab0Sopenharmony_ci * 1917777dab0Sopenharmony_ci * @param object Indicates the <b>TEE_ObjectHandle</b> object to close. 1927777dab0Sopenharmony_ci * 1937777dab0Sopenharmony_ci * @since 12 1947777dab0Sopenharmony_ci * @version 1.0 1957777dab0Sopenharmony_ci */ 1967777dab0Sopenharmony_civoid TEE_CloseObject(TEE_ObjectHandle object); 1977777dab0Sopenharmony_ci 1987777dab0Sopenharmony_ci/** 1997777dab0Sopenharmony_ci * @brief Allocates an uninitialized object to store keys. 2007777dab0Sopenharmony_ci * 2017777dab0Sopenharmony_ci * <b>objectType</b> and <b>maxObjectSize</b> must be specified. 2027777dab0Sopenharmony_ci * 2037777dab0Sopenharmony_ci * @param objectType Indicates the type of the object to create. The value is <b>TEE_ObjectType</b>. 2047777dab0Sopenharmony_ci * @param maxObjectSize Indicates the maximum number of bytes of the object. 2057777dab0Sopenharmony_ci * @param object Indicates the pointer to the handle of the newly created object. 2067777dab0Sopenharmony_ci * 2077777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 2087777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is insufficient. 2097777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_NOT_SUPPORTED</b> if the object type is not supported. 2107777dab0Sopenharmony_ci * 2117777dab0Sopenharmony_ci * @since 12 2127777dab0Sopenharmony_ci * @version 1.0 2137777dab0Sopenharmony_ci */ 2147777dab0Sopenharmony_ciTEE_Result TEE_AllocateTransientObject(uint32_t objectType, uint32_t maxObjectSize, TEE_ObjectHandle *object); 2157777dab0Sopenharmony_ci 2167777dab0Sopenharmony_ci/** 2177777dab0Sopenharmony_ci * @brief Releases a transient object that is previously allocated with <b>TEE_AllocateTransientObject</b>. 2187777dab0Sopenharmony_ci * 2197777dab0Sopenharmony_ci * After the function is called, the handle becomes invalid and all allocated resources are released. 2207777dab0Sopenharmony_ci * <b>TEE_FreeTransientObject</b> and <b>TEE_AllocateTransientObject</b> are used in pairs. 2217777dab0Sopenharmony_ci * 2227777dab0Sopenharmony_ci * @param object Indicates the <b>TEE_ObjectHandle</b> to release. 2237777dab0Sopenharmony_ci * 2247777dab0Sopenharmony_ci * @since 12 2257777dab0Sopenharmony_ci * @version 1.0 2267777dab0Sopenharmony_ci */ 2277777dab0Sopenharmony_civoid TEE_FreeTransientObject(TEE_ObjectHandle object); 2287777dab0Sopenharmony_ci 2297777dab0Sopenharmony_ci/** 2307777dab0Sopenharmony_ci * @brief Resets a transient object to its initial state after allocation. 2317777dab0Sopenharmony_ci * 2327777dab0Sopenharmony_ci * You can use an allocated object, which has not been initialized or used to store a key, to store a key. 2337777dab0Sopenharmony_ci * 2347777dab0Sopenharmony_ci * @param object Indicates the <b>TEE_ObjectHandle</b> to reset. 2357777dab0Sopenharmony_ci * 2367777dab0Sopenharmony_ci * @since 12 2377777dab0Sopenharmony_ci * @version 1.0 2387777dab0Sopenharmony_ci */ 2397777dab0Sopenharmony_civoid TEE_ResetTransientObject(TEE_ObjectHandle object); 2407777dab0Sopenharmony_ci 2417777dab0Sopenharmony_ci/** 2427777dab0Sopenharmony_ci * @brief Populates an uninitialized object with object attributes passed by the TA in the <b>attrs</b> parameter. 2437777dab0Sopenharmony_ci * 2447777dab0Sopenharmony_ci * The object must be uninitialized. \n 2457777dab0Sopenharmony_ci * The <b>attrs</b> parameter is passed by a TA. 2467777dab0Sopenharmony_ci * 2477777dab0Sopenharmony_ci * @param object Indicates the handle on a created but uninitialized object. 2487777dab0Sopenharmony_ci * @param attrs Indicates the pointer to an array of object attributes, which can be one or more <b>TEE_Attribute</b>s. 2497777dab0Sopenharmony_ci * @param attrCount Indicates the number of members in the attribute array. 2507777dab0Sopenharmony_ci * 2517777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 2527777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if an incorrect or inconsistent attribute value is detected. 2537777dab0Sopenharmony_ci * 2547777dab0Sopenharmony_ci * @since 12 2557777dab0Sopenharmony_ci * @version 1.0 2567777dab0Sopenharmony_ci */ 2577777dab0Sopenharmony_ciTEE_Result TEE_PopulateTransientObject(TEE_ObjectHandle object, TEE_Attribute *attrs, uint32_t attrCount); 2587777dab0Sopenharmony_ci 2597777dab0Sopenharmony_ci/** 2607777dab0Sopenharmony_ci * @brief Initializes the <b>TEE_Attribute</b> of the buffer type. 2617777dab0Sopenharmony_ci * 2627777dab0Sopenharmony_ci * The members in the <b>TEE_Attribute</b> struct must be <b>ref</b>. 2637777dab0Sopenharmony_ci * 2647777dab0Sopenharmony_ci * @param attr Indicates the pointer to the <b>TEE_Attribute</b> initialized. 2657777dab0Sopenharmony_ci * @param attributeID Indicates the ID assigned to the <b>TEE_Attribute</b>. 2667777dab0Sopenharmony_ci * @param buffer Indicates the pointer to the buffer that stores the content to be allocated. 2677777dab0Sopenharmony_ci * @param length Indicates the length of the assigned value, in bytes. 2687777dab0Sopenharmony_ci * 2697777dab0Sopenharmony_ci * @since 12 2707777dab0Sopenharmony_ci * @version 1.0 2717777dab0Sopenharmony_ci */ 2727777dab0Sopenharmony_civoid TEE_InitRefAttribute(TEE_Attribute *attr, uint32_t attributeID, void *buffer, size_t length); 2737777dab0Sopenharmony_ci 2747777dab0Sopenharmony_ci/** 2757777dab0Sopenharmony_ci * @brief Initializes a <b>TEE_Attribute</b>. 2767777dab0Sopenharmony_ci * 2777777dab0Sopenharmony_ci * @param attr Indicates the pointer to the <b>TEE_Attribute</b> initialized. 2787777dab0Sopenharmony_ci * @param attributeID Indicates the ID assigned to the <b>TEE_Attribute</b>. 2797777dab0Sopenharmony_ci * @param a Indicates the value to be assigned to the member <b>a</b> in the <b>TEE_Attribute</b>. 2807777dab0Sopenharmony_ci * @param b Indicates the value to be assigned to the member <b>b</b> in the <b>TEE_Attribute</b>. 2817777dab0Sopenharmony_ci * 2827777dab0Sopenharmony_ci * @since 12 2837777dab0Sopenharmony_ci * @version 1.0 2847777dab0Sopenharmony_ci */ 2857777dab0Sopenharmony_civoid TEE_InitValueAttribute(TEE_Attribute *attr, uint32_t attributeID, uint32_t a, uint32_t b); 2867777dab0Sopenharmony_ci 2877777dab0Sopenharmony_ci/** 2887777dab0Sopenharmony_ci * @brief Generates a random key or a key pair and populates a transient key object with the generated key. 2897777dab0Sopenharmony_ci * 2907777dab0Sopenharmony_ci * @param object Indicates a transient object used to hold the generated key. 2917777dab0Sopenharmony_ci * @param keySize Indicates the number of bytes of the key. 2927777dab0Sopenharmony_ci * @param params Indicates the pointer to the parameters for key generation. 2937777dab0Sopenharmony_ci * @param paramCount Indicates the number of parameters required for key generation. 2947777dab0Sopenharmony_ci * 2957777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 2967777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the type of the key generated does not match 2977777dab0Sopenharmony_ci * the key that can be held in the transient object. 2987777dab0Sopenharmony_ci * 2997777dab0Sopenharmony_ci * @since 12 3007777dab0Sopenharmony_ci * @version 1.0 3017777dab0Sopenharmony_ci */ 3027777dab0Sopenharmony_ciTEE_Result TEE_GenerateKey(TEE_ObjectHandle object, uint32_t keySize, TEE_Attribute *params, uint32_t paramCount); 3037777dab0Sopenharmony_ci 3047777dab0Sopenharmony_ci/** 3057777dab0Sopenharmony_ci * @brief Get the information of the object data part, the total length of the data part and the current 3067777dab0Sopenharmony_ci * position of the data stream. 3077777dab0Sopenharmony_ci * 3087777dab0Sopenharmony_ci * @param object Indicates the handle of the object. 3097777dab0Sopenharmony_ci * @param pos Indicates the data stream position. 3107777dab0Sopenharmony_ci * @param len Indicates the data stream length. 3117777dab0Sopenharmony_ci * 3127777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 3137777dab0Sopenharmony_ci * @return Returns others if the operation is failed. 3147777dab0Sopenharmony_ci * 3157777dab0Sopenharmony_ci * @since 12 3167777dab0Sopenharmony_ci * @version 1.0 3177777dab0Sopenharmony_ci */ 3187777dab0Sopenharmony_ciTEE_Result TEE_InfoObjectData(TEE_ObjectHandle object, uint32_t *pos, uint32_t *len); 3197777dab0Sopenharmony_ci 3207777dab0Sopenharmony_ci/** 3217777dab0Sopenharmony_ci * @brief Obtains <b>TEE_ObjectInfo</b>. 3227777dab0Sopenharmony_ci * 3237777dab0Sopenharmony_ci * This function obtains <b>TEE_ObjectInfo</b> and copies the obtained information to the pre-allocated space 3247777dab0Sopenharmony_ci * pointed to by <b>objectInfo</b>. 3257777dab0Sopenharmony_ci * 3267777dab0Sopenharmony_ci * @param object Indicates the handle of the object. 3277777dab0Sopenharmony_ci * @param objectInfo Indicates the pointer to the <b>TEE_ObjectInfo</b> obtained. 3287777dab0Sopenharmony_ci * 3297777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 3307777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed. 3317777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored 3327777dab0Sopenharmony_ci * in a storage area that is inaccessible currently. 3337777dab0Sopenharmony_ci * 3347777dab0Sopenharmony_ci * @since 12 3357777dab0Sopenharmony_ci * @version 1.0 3367777dab0Sopenharmony_ci */ 3377777dab0Sopenharmony_ciTEE_Result TEE_GetObjectInfo1(TEE_ObjectHandle object, TEE_ObjectInfo *objectInfo); 3387777dab0Sopenharmony_ci 3397777dab0Sopenharmony_ci/** 3407777dab0Sopenharmony_ci * @brief Assigns the <b>TEE_Attribute</b> of an initialized object to an uninitialized object. 3417777dab0Sopenharmony_ci * 3427777dab0Sopenharmony_ci * This function populates an uninitialized object with <b>TEE_Attribute</b>. 3437777dab0Sopenharmony_ci * That is, it copies <b>TEE_Attribute</b> of <b>srcobject</b> to <b>destobject</b>. 3447777dab0Sopenharmony_ci * The <b>TEE_Attribute</b> types and IDs of the two objects must match. 3457777dab0Sopenharmony_ci * 3467777dab0Sopenharmony_ci * @param destObject Indicates the uninitialized object. 3477777dab0Sopenharmony_ci * @param srcObject Indicates the initialized object. 3487777dab0Sopenharmony_ci * 3497777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 3507777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed. 3517777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored 3527777dab0Sopenharmony_ci * in a storage area that is inaccessible currently. 3537777dab0Sopenharmony_ci * 3547777dab0Sopenharmony_ci * @since 12 3557777dab0Sopenharmony_ci * @version 1.0 3567777dab0Sopenharmony_ci */ 3577777dab0Sopenharmony_ciTEE_Result TEE_CopyObjectAttributes1(TEE_ObjectHandle destObject, TEE_ObjectHandle srcObject); 3587777dab0Sopenharmony_ci 3597777dab0Sopenharmony_ci/** 3607777dab0Sopenharmony_ci * @brief Restricts the <b>objectUse</b> bit of an object. 3617777dab0Sopenharmony_ci * 3627777dab0Sopenharmony_ci * This bit determines the usage of the key in the object. The value range is <b>Usage_Constant</b>. 3637777dab0Sopenharmony_ci * The bit in the <b>objectUse</b> parameter can be set as follows: \n 3647777dab0Sopenharmony_ci * If it is set to <b>1</b>, the corresponding usage flag in the object is left unchanged. \n 3657777dab0Sopenharmony_ci * If it is set to <b>0</b>, the corresponding usage flag in the object is cleared. \n 3667777dab0Sopenharmony_ci * The newly created object contains all <b>Usage_Constant</b>, and the usage flag can be cleared only. 3677777dab0Sopenharmony_ci * 3687777dab0Sopenharmony_ci * @param object Indicates the <b>TEE_ObjectHandle</b> of the target object. 3697777dab0Sopenharmony_ci * @param objectUsage Indicates the new object usage. 3707777dab0Sopenharmony_ci * 3717777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 3727777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed. 3737777dab0Sopenharmony_ci * @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored 3747777dab0Sopenharmony_ci * in a storage area that is inaccessible currently. 3757777dab0Sopenharmony_ci * 3767777dab0Sopenharmony_ci * @since 12 3777777dab0Sopenharmony_ci * @version 1.0 3787777dab0Sopenharmony_ci */ 3797777dab0Sopenharmony_ciTEE_Result TEE_RestrictObjectUsage1(TEE_ObjectHandle object, uint32_t objectUsage); 3807777dab0Sopenharmony_ci#ifdef __cplusplus 3817777dab0Sopenharmony_ci} 3827777dab0Sopenharmony_ci#endif 3837777dab0Sopenharmony_ci/** @} */ 3847777dab0Sopenharmony_ci#endif 385