1 /* 2 * Copyright (c) 2020 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 TEST_XTS_ACTS_SECURITY_LITE_DATAHUKS_HAL_SRC_SECURITY_DATA_HUKS_H 17 #define TEST_XTS_ACTS_SECURITY_LITE_DATAHUKS_HAL_SRC_SECURITY_DATA_HUKS_H 18 19 #include "hctest.h" 20 #include "hks_client.h" 21 #include "hks_types.h" 22 #include "securec.h" 23 #include <securec.h> 24 #include <stdbool.h> 25 #include <stdio.h> 26 #include <stdlib.h> 27 #include <string.h> 28 29 #define NUM1 1 30 #define NUM2 2 31 #define NUM3 3 32 #define NUM4 4 33 #define NUM5 5 34 #define NUM6 6 35 #define NUM10 10 36 #define NUM11 11 37 #define NUM12 12 38 #define NUM15 15 39 #define NUM16 16 40 #define NUM20 20 41 #define NUM21 21 42 #define NUM24 24 43 #define NUM25 25 44 #define NUM30 30 45 #define NUM31 31 46 #define NUM32 32 47 #define NUM33 33 48 #define NUM60 60 49 #define NUM63 63 50 #define NUM64 64 51 #define NUM65 65 52 #define NUM88 88 53 #define NUM100 100 54 #define NUM111 111 55 #define NUM128 128 56 #define NUM192 192 57 #define NUM256 256 58 #define NUM1025 1025 59 #define NUM134 (-134) 60 #define NUM135 (-135) 61 #define NUM138 (-138) 62 #define NUM142 (-142) 63 #define NUM1000 (-1000) 64 #define NUM1004 (-1004) 65 #define NUM1005 (-1005) 66 #define NUM1006 (-1006) 67 #define NUM1007 (-1007) 68 #define NUM1010 (-1010) 69 #define MAX_INT 2147483647 70 #define HKS_FREE_PTR1(p) { if ((p) != NULL) { free(p); (p) = NULL; }} 71 72 void HksStBlobInit1(struct hks_blob *blob, size_t nmemb, size_t size, uint8_t type); 73 74 void HksBlobDestroyT1(struct hks_blob *blob); 75 76 int TestSecShuksGenerateKeyNormal(void); 77 78 int TestSecShuksDeleteKeyNormal(void); 79 80 int TestSecShuksExportPublicNormal(struct hks_blob *keyAlias, struct hks_blob *publicKey1); 81 82 void BuildBlobData(struct hks_blob *param, const char *str, uint8_t type, uint32_t size, uint8_t isDataNull); 83 84 void HexStringToByte(const char *str, int nLen, unsigned char *pHex); 85 86 void TestInitKeyParam1(struct hks_key_param *keyParam, uint32_t keyType, uint32_t keyLen, uint32_t keyMode, 87 uint32_t keyUsage); 88 89 int TestSecShuksImportPublicNormal(void); 90 91 #endif 92