1 /* 2 * Copyright (c) 2022 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 HKS_THREE_STAGE_TEST_COMMON_H 17 #define HKS_THREE_STAGE_TEST_COMMON_H 18 19 #include <securec.h> 20 21 #include "hks_api.h" 22 #include "hks_log.h" 23 #include "hks_mem.h" 24 #include "hks_param.h" 25 #include "hks_type.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 static const uint32_t TIMES = 4; 32 static const uint32_t MAX_UPDATE_SIZE = 64; 33 static const uint32_t MAX_OUTDATA_SIZE = MAX_UPDATE_SIZE * TIMES; 34 35 int32_t InitParamSet(struct HksParamSet **paramSet, const struct HksParam *params, uint32_t paramcount); 36 int32_t HksTestUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData); 37 int32_t TestUpdateLoopFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, 38 const struct HksBlob *inData, struct HksBlob *outData); 39 int32_t TestUpdateFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, 40 uint32_t purpose, const struct HksBlob *inData, struct HksBlob *outData); 41 int32_t MallocAndCheckBlobData(struct HksBlob *blob, const uint32_t blobSize); 42 int32_t TestCmpKeyAliasHash(const struct HksBlob *srcData1, const struct HksBlob *srcData2); 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 #endif // HKS_THREE_STAGE_TEST_COMMON_H