1 /* 2 * Copyright (C) 2021 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 ISO_BASE_CUR_TASK_H 17 #define ISO_BASE_CUR_TASK_H 18 19 #include "json_utils.h" 20 #include "alg_loader.h" 21 #include "common_defs.h" 22 #include "das_module_defines.h" 23 #include "iso_protocol_common.h" 24 25 #define CHALLENGE_SIZE 16 26 #define NONCE_SIZE 12 27 #define TAG_LEN 16 28 #define EXCHANGE_AAD "hichain_iso_exchange" 29 #define RESULT_AAD "hichain_iso_result" 30 #define UNBIND_ADD_REQUEST "hichain_remove_info_request" 31 #define UNBIND_ADD_RESPONSE "hichain_remove_info_response" 32 #define GENERATE_RETURN_KEY_STR "hichain_return_key" 33 #define ISO_TOKEN_LEN 32 34 #define RESULT_MAC_LEN 32 35 #define AUTH_CODE_LEN 32 36 #define KEY_ALIAS_SIZE 32 37 #define ENC_CHALLENGE_LEN (CHALLENGE_SIZE + TAG_LEN) 38 #define SEED_LEN 32 39 #define ISO_KEY_ALIAS_LEN 32 40 41 typedef struct IsoParamsT { 42 IsoBaseParams baseParams; 43 44 Uint8Buff seed; 45 int32_t selfUserType; 46 int32_t peerUserType; 47 char *packageName; 48 char *serviceType; 49 char *pinCodeString; 50 int32_t opCode; 51 uint32_t keyLen; 52 bool isClient; 53 bool isPeerFromUpgrade; 54 } IsoParams; 55 56 typedef struct SymBaseCurTaskT { 57 CurTaskType (*getCurTaskType)(void); 58 void (*destroyTask)(struct SymBaseCurTaskT *); 59 int(*process)(struct SymBaseCurTaskT *, IsoParams *params, const CJson *in, CJson *out, int32_t *status); 60 int taskStatus; 61 } SymBaseCurTask; 62 63 #endif 64