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 MOCK_HKS_TYPE_H 17 #define MOCK_HKS_TYPE_H 18 19 #include <stdbool.h> 20 #include <stdint.h> 21 #include <stdlib.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 enum HksTagType { 28 HKS_TAG_TYPE_UINT = 2 << 28, 29 HKS_TAG_TYPE_BYTES = 5 << 28, 30 }; 31 32 enum HksErrorCode { 33 HKS_SUCCESS = 0, 34 HKS_FAILURE = -1, 35 HKS_ERROR_INVALID_ARGUMENT = -3, 36 37 HKS_ERROR_NOT_EXIST = -13, 38 }; 39 40 enum HksKeyAlg { 41 HKS_ALG_AES = 20, 42 }; 43 44 enum HksKeyPurpose { 45 HKS_KEY_PURPOSE_ENCRYPT = 1, 46 HKS_KEY_PURPOSE_DECRYPT = 2, 47 }; 48 49 enum HksKeyPadding { 50 HKS_PADDING_NONE = 0, 51 }; 52 53 enum HksCipherMode { 54 HKS_MODE_GCM = 32, 55 }; 56 57 enum HksAuthStorageLevel { 58 HKS_AUTH_STORAGE_LEVEL_DE = 0, 59 }; 60 61 enum HksKeySize { 62 HKS_AES_KEY_SIZE_256 = 256, 63 }; 64 65 struct HksBlob { 66 uint32_t size; 67 uint8_t *data; 68 }; 69 70 struct HksParam { 71 uint32_t tag; 72 union { 73 bool boolParam; 74 int32_t int32Param; 75 uint32_t uint32Param; 76 uint64_t uint64Param; 77 struct HksBlob blob; 78 }; 79 }; 80 81 enum HksTag { 82 HKS_TAG_ALGORITHM = HKS_TAG_TYPE_UINT | 1, 83 HKS_TAG_PURPOSE = HKS_TAG_TYPE_UINT | 2, 84 HKS_TAG_KEY_SIZE = HKS_TAG_TYPE_UINT | 3, 85 HKS_TAG_DIGEST = HKS_TAG_TYPE_UINT | 4, 86 HKS_TAG_PADDING = HKS_TAG_TYPE_UINT | 5, 87 HKS_TAG_BLOCK_MODE = HKS_TAG_TYPE_UINT | 6, 88 HKS_TAG_ASSOCIATED_DATA = HKS_TAG_TYPE_BYTES | 8, 89 HKS_TAG_NONCE = HKS_TAG_TYPE_BYTES | 9, 90 91 HKS_TAG_AUTH_STORAGE_LEVEL = HKS_TAG_TYPE_UINT | 316, 92 93 HKS_TAG_AE_TAG = HKS_TAG_TYPE_BYTES | 10009, 94 }; 95 96 struct HksParamSet; 97 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif /* MOCK_HKS_TYPE_H */ 104