1 /* 2 * Copyright (c) 2023 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 HUKS_SA_TYPE_H 17 #define HUKS_SA_TYPE_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 #include <stdlib.h> 22 23 /** 24 * @brief HksBlob should be same with huks sa 25 */ 26 struct HksBlob { 27 uint32_t size; 28 uint8_t *data; 29 }; 30 31 /** 32 * @brief HksParam should be same with huks sa 33 */ 34 struct HksParam { 35 uint32_t tag; 36 union { 37 bool boolParam; 38 int32_t int32Param; 39 uint32_t uint32Param; 40 uint64_t uint64Param; 41 struct HksBlob blob; 42 }; 43 }; 44 45 /** 46 * @brief HksParamSet set should be same with huks sa 47 */ 48 struct HksParamSet { 49 uint32_t paramSetSize; 50 uint32_t paramsCnt; 51 struct HksParam params[]; 52 }; 53 54 /** 55 * @brief hks chipset platform decrypt scene should be same with huks sa 56 */ 57 enum HksChipsetPlatformDecryptScene { 58 HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA = 1, 59 }; 60 61 62 /** 63 * @brief huks hdi error code should be same with huks sa 64 */ 65 enum HuksErrorCode { 66 HUKS_SUCCESS = 0, 67 HUKS_FAILURE = -1, 68 HUKS_ERROR_NULL_POINTER = -14, 69 HUKS_ERROR_MALLOC_FAIL = -21, 70 }; 71 72 #endif