1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * Description: Provides common utils for security_unified service layer. \n 16 * 17 * History: \n 18 * 2023-03-14, Create file. \n 19 */ 20 #ifndef SL_COMMON_H 21 #define SL_COMMON_H 22 23 #include <stdint.h> 24 #include "errcode.h" 25 #ifdef CONFIG_SECURITY_UNIFIED_SUPPORT_DEEP_SLEEP 26 #include "pm_veto.h" 27 #else 28 #define uapi_pm_add_sleep_veto(...) 29 #define uapi_pm_remove_sleep_veto(...) 30 #define PM_SECURITY_VETO_ID 31 #endif 32 33 #ifdef __cplusplus 34 #if __cplusplus 35 extern "C" { 36 #endif /* __cplusplus */ 37 #endif /* __cplusplus */ 38 39 /** 40 * @if Eng 41 * @brief Convert security-driven error codes to standard error codes. 42 * @param [in] from_errcode Error codes returned by the security driver interface. 43 * @retval Converted error code. For details, see @ref errcode_t 44 * @else 45 * @brief 将安全驱动的错误码转换成标准错误码 46 * @param [in] from_errcode 安全驱动接口返回的错误码 47 * @retval 转换后的错误码,参考 @ref errcode_t 48 * @endif 49 */ 50 errcode_t crypto_sl_common_get_errcode(int32_t from_errcode); 51 52 #ifdef __cplusplus 53 #if __cplusplus 54 } 55 #endif /* __cplusplus */ 56 #endif /* __cplusplus */ 57 58 #endif