• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ISO_AUTH_TASK_COMMON_H
17 #define ISO_AUTH_TASK_COMMON_H
18 
19 #include "account_module_defines.h"
20 #include "account_task_main.h"
21 #include "account_version_util.h"
22 #include "iso_protocol_common.h"
23 #include "json_utils.h"
24 
25 typedef struct {
26     uint64_t versionNo;
27     int32_t authForm;
28     int32_t credentialType;
29     int32_t localDevType;
30     int32_t keyLength;
31     uint8_t seed[SEED_SIZE];
32     uint8_t hmacToken[HMAC_TOKEN_SIZE];
33     Uint8Buff challenge;
34     Uint8Buff devIdSelf;
35     Uint8Buff devIdPeer;
36     char *userIdSelf;
37     char *userIdPeer;
38     char *deviceIdSelf;
39     char *deviceIdPeer;
40     IsoBaseParams isoBaseParams;
41 } IsoAuthParams;
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 bool IsIsoAuthTaskSupported(void);
48 
49 TaskBase *CreateIsoAuthTask(const CJson *in, CJson *out, const AccountVersionInfo *verInfo);
50 
51 int32_t InitIsoAuthParams(const CJson *in, IsoAuthParams *params, const AccountVersionInfo *verInfo);
52 void DestroyIsoAuthParams(IsoAuthParams *params);
53 
54 int32_t AccountAuthGeneratePsk(IsoAuthParams *params);
55 int32_t ExtractAndVerifyPayload(IsoAuthParams *params, const CJson *in);
56 int32_t AuthIsoSendFinalToOut(IsoAuthParams *params, CJson *out);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif
63