1 /*
2  * Copyright (C) 2021-2023 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 DAS_MODULE_DEFINES_H
17 #define DAS_MODULE_DEFINES_H
18 
19 #include "common_defs.h"
20 #include "device_auth_defines.h"
21 #include "hc_types.h"
22 
23 #define STEP_ONE 1
24 #define STEP_TWO 2
25 #define STEP_THREE 3
26 #define MIN_PIN_LEN 6
27 #define MAX_PIN_LEN 1024
28 #define MIN_OUTPUT_KEY_LEN 16
29 #define MAX_OUTPUT_KEY_LEN 32
30 
31 typedef enum {
32     PAKE_REQUEST = 0x0001,
33     PAKE_RESPONSE = 0x8001,
34     PAKE_CLIENT_CONFIRM = 0x0002,
35     PAKE_SERVER_CONFIRM = 0x8002,
36 
37     PAKE_BIND_EXCHANGE_REQUEST = 0x0003,
38     PAKE_BIND_EXCHANGE_RESPONSE = 0x8003,
39 
40     PAKE_UNBIND_EXCHANGE_REQUEST = 0x0033,
41     PAKE_UNBIND_EXCHANGE_RESPONSE = 0x8033,
42 
43     ISO_CLIENT_BIND_START = 0x0001,
44     ISO_SERVER_BIND_START = 0x8001,
45     ISO_CLIENT_BIND_CAL_TOKEN = 0x0002,
46     ISO_SERVER_BIND_CAL_TOKEN = 0x8002,
47 
48     ISO_CLIENT_AUTH_OR_UNBIND_START = 0x0011,
49     ISO_SERVER_AUTH_OR_UNBIND_START = 0x8011,
50     ISO_CLIENT_AUTH_OR_UNBIND_CAL_TAOKEN = 0x0012,
51     ISO_SERVER_AUTH_OR_UNBIND_CAL_TAOKEN = 0x8012,
52 
53     ISO_CLIENT_BIND_EXCHANGE_CMD = 0x0003,
54     ISO_SERVER_BIND_EXCHANGE_RET = 0x8003,
55     ISO_CLIENT_BIND_EXCHANGE_CONFIRM = 0x0004,
56 
57     ISO_CLIENT_UNBIND_EXCHANGE_CMD = 0x0013,
58     ISO_SERVER_UNBIND_EXCHANGE_RET = 0x8013,
59     ISO_CLIENT_UNBIND_EXCHANGE_CONFIRM = 0x0014,
60 
61     ISO_RESULT_CONFIRM_CMD = 0x0013,
62 
63     ERR_MESSAGE = 0x8080,
64     INVALID_MESSAGE = 0xFFFF,
65 } DasMessageCode;
66 
67 typedef enum CurTaskTypeT {
68     TASK_TYPE_ISO_PROTOCOL = 0,
69     TASK_TYPE_PAKE_V1_PROTOCOL = 1,
70     TASK_TYPE_PAKE_V2_PROTOCOL = 2,
71     TASK_TYPE_BIND_LITE_EXCHANGE = 3,
72     TASK_TYPE_UNBIND_LITE_EXCHANGE = 4,
73     TASK_TYPE_BIND_STANDARD_EXCHANGE = 5,
74     TASK_TYPE_UNBIND_STANDARD_EXCHANGE = 6,
75     TASK_TYPE_NONE,
76 } CurTaskType;
77 
78 #endif
79