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_CRYPTO_HAL_H 17 #define TEE_CRYPTO_HAL_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_crypto_hal.h 32 * 33 * @brief Provides APIs for cryptographic operations. 34 * 35 * You can use these APIs to implement encryption and decryption. 36 * 37 * @library NA 38 * @kit TEEKit 39 * @syscap SystemCapability.Tee.TeeClient 40 * @since 12 41 * @version 1.0 42 */ 43 44 #include "tee_crypto_api.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /** 51 * @brief Enumerates the types of the crypto engine. 52 * 53 * @since 12 54 */ 55 enum CRYPTO_ENGINE { 56 SOFT_CRYPTO = 2, 57 CRYPTO_ENGINE_MAX = 1024, 58 }; 59 60 /** 61 * @brief Sets the encryption and decryption engines to an operation. 62 * 63 * @param operation Indicates the handle of the operation to set. 64 * @param crypto Indicates the engines to set. 65 * 66 * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 67 * Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if <b>operation</b> is null or <b>crypto</b> is invalid. 68 * 69 * @since 12 70 * @version 1.0 71 */ 72 TEE_Result TEE_SetCryptoFlag(TEE_OperationHandle operation, uint32_t crypto); 73 74 /** 75 * @brief Sets the encryption and decryption engines to an object. 76 * 77 * @param object Indicates the handle of the object to set. 78 * @param crypto Indicates the engines to set. 79 * 80 * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 81 * Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if <b>object</b> is null or <b>crypto</b> is invalid. 82 * 83 * @since 12 84 * @version 1.0 85 */ 86 TEE_Result TEE_SetObjectFlag(TEE_ObjectHandle object, uint32_t crypto); 87 88 #ifdef __cplusplus 89 } 90 #endif 91 /** @} */ 92 #endif 93 94