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 PAKE_BASE_CUR_TASK_H 17 #define PAKE_BASE_CUR_TASK_H 18 19 #include "das_module_defines.h" 20 #include "hc_types.h" 21 #include "json_utils.h" 22 #include "pake_defs.h" 23 24 #define HICHAIN_RETURN_KEY "hichain_return_key" 25 #define TMP_AUTH_KEY_FACTOR "hichain_tmp_auth_enc_key" 26 27 #define PAKE_KEY_ALIAS_LEN 64 28 #define PAKE_ED25519_KEY_PAIR_LEN 32 29 #define PAKE_NONCE_LEN 32 30 #define PAKE_PSK_LEN 32 31 32 typedef struct PakeParamsT { 33 PakeBaseParams baseParams; 34 35 bool isPskSupported; 36 Uint8Buff returnKey; 37 Uint8Buff nonce; 38 int32_t opCode; 39 int32_t userType; 40 int32_t userTypePeer; 41 char *packageName; 42 char *serviceType; 43 } PakeParams; 44 45 typedef struct AsyBaseCurTaskT { 46 CurTaskType (*getCurTaskType)(void); 47 void (*destroyTask)(struct AsyBaseCurTaskT *); 48 int(*process)(struct AsyBaseCurTaskT *, PakeParams *params, const CJson *in, CJson *out, int *status); 49 int taskStatus; 50 } AsyBaseCurTask; 51 52 #endif 53