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 HUKS_WRAPPED_TEST_COMMON_H 17 #define HUKS_WRAPPED_TEST_COMMON_H 18 19 #include "huks_three_stage_test_common.h" 20 21 namespace Unittest::ImportWrapped 22 { 23 struct HksImportWrappedKeyTestParams { 24 struct OH_Huks_Blob *wrappingKeyAlias; 25 struct OH_Huks_Blob *agreeKeyAlgName; 26 struct OH_Huks_ParamSet *genWrappingKeyParamSet; 27 uint32_t publicKeySize; 28 29 struct OH_Huks_Blob *callerKeyAlias; 30 struct OH_Huks_ParamSet *genCallerKeyParamSet; 31 32 struct OH_Huks_Blob *callerKekAlias; 33 struct OH_Huks_Blob *callerKek; 34 struct OH_Huks_ParamSet *importCallerKekParamSet; 35 36 struct OH_Huks_Blob *callerAgreeKeyAlias; 37 struct OH_Huks_ParamSet *agreeParamSet; 38 39 struct OH_Huks_ParamSet *importWrappedKeyParamSet; 40 struct OH_Huks_Blob *importedKeyAlias; 41 struct OH_Huks_Blob *importedPlainKey; 42 uint32_t keyMaterialLen; 43 }; 44 45 static const uint32_t IV_SIZE = 16; 46 static uint8_t IV[IV_SIZE] = "bababababababab"; 47 48 static const uint32_t AAD_SIZE = 16; 49 static uint8_t AAD[AAD_SIZE] = "abababababababa"; 50 51 static const uint32_t NONCE_SIZE = 12; 52 static uint8_t NONCE[NONCE_SIZE] = "hahahahahah"; 53 54 static const uint32_t AEAD_TAG_SIZE = 16; 55 56 static const uint32_t X25519_256_SIZE = 256; 57 58 void HksImportWrappedKeyTestCommonCase(const struct HksImportWrappedKeyTestParams *params); 59 60 void HksClearKeysForWrappedKeyTest(const struct HksImportWrappedKeyTestParams *params); 61 } // namespace Unittest::ImportWrapped 62 #endif // HUKS_WRAPPED_TEST_COMMON_H 63