• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef TEE_HW_EXT_API_H
17 #define TEE_HW_EXT_API_H
18 
19 /**
20  * @addtogroup TeeTrusted
21  * @{
22  *
23  * @brief TEE(Trusted Excution Environment) API.
24  * Provides security capability APIs such as trusted storage, encryption and decryption,
25  * and trusted time for trusted application development.
26  *
27  * @since 12
28  */
29 
30 /**
31  * @file tee_hw_ext_api.h
32  *
33  * @brief Provides extended interfaces.
34  *
35  * @library NA
36  * @kit TEEKit
37  * @syscap SystemCapability.Tee.TeeClient
38  * @since 12
39  * @version 1.0
40  */
41 
42 #include "tee_defines.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49  * @brief Obtains the unique device ID from the TEE.
50  *
51  * @param device_unique_id Indicates the pointer to the buffer for storing the device ID.
52  * @param length Indicates the pointer to the buffer length.
53  *
54  * @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
55  * @return Returns other information otherwise.
56  *
57  * @since 12
58  */
59 TEE_Result tee_ext_get_device_unique_id(uint8_t *device_unique_id, uint32_t *length);
60 
61 /**
62  * @brief Defines the memory information.
63  *
64  * @since 12
65  */
66 struct meminfo_t {
67     uint64_t buffer;
68     uint32_t size;
69 };
70 
71 /**
72  * @brief Derive key from device rootkey and UUID of the current task for iteration.
73  *
74  * @param salt [IN] Indicates the data for salt.
75  * @param key [OUT] Indicates the pointer where key is saved.
76  * @param outer_iter_num [IN] Indicates the iteration times in huk service.
77  * @param inner_iter_num [IN] Indicates the iteration times in platform driver.
78  *
79  * @return Returns {@code TEE_SUCCESS} if the operation is successful.
80  *         Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect.
81  *         Returns {@code TEE_ERROR_GENERIC} if the processing failed.
82  *
83  * @since 12
84  */
85 TEE_Result tee_ext_derive_key_iter(const struct meminfo_t *salt, struct meminfo_t *key,
86     uint32_t outer_iter_num, uint32_t inner_iter_num);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 /** @} */
92 #endif