• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 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 PINAUTHTA_ALL_IN_ONE_FUNC_H
17 #define PINAUTHTA_ALL_IN_ONE_FUNC_H
18 
19 #include "executor_func_common.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif // __cplusplus
24 
25 #define TAG_AND_LEN_BYTE 8
26 #define MAX_TEMPLATE_OF_SCHEDUAL 10
27 
28 typedef struct {
29     uint64_t scheduleId;
30     uint64_t templateId;
31     uint8_t pinData[CONST_PIN_DATA_LEN];
32     uint32_t pinLength;
33 } PinAuthParam;
34 
35 typedef struct {
36     uint64_t subType;
37     uint64_t templateId;
38 } QueryCredential;
39 
40 typedef struct {
41     uint64_t scheduleId;
42     int32_t authIntent;
43     Buffer *oldRootSecret;
44     Buffer *rootSecret;
45 } PinAuthFwkInfo;
46 
47 typedef struct {
48     uint64_t scheduleId;
49     uint64_t templateId;
50 } PinAbandonParam;
51 
52 typedef struct {
53     uint64_t oldTemplateId;
54     uint64_t newTemplateId;
55     Buffer *oldRootSecret;
56     Buffer *newRootSecret;
57 } PinAbandonExtraInfo;
58 
59 ResultCode DoGetAllInOneExecutorInfo(PinExecutorInfo *pinExecutorInfo);
60 ResultCode DoEnrollPin(PinEnrollParam *pinEnrollParam, Buffer *retTlv);
61 ResultCode DoAllInOneAuth(uint64_t scheduleId, uint64_t templateId,
62     const uint8_t *extraInfo, uint32_t extraInfoSize, AlgoParamOut *algoParam);
63 ResultCode DoAuthPin(PinAuthParam *pinAuthParam, Buffer *extra, Buffer *retTlv, ResultCode *compareRet);
64 ResultCode DoDeleteTemplate(uint64_t templateId);
65 ResultCode GenerateAllInOneKeyPair(void);
66 void DestroyAllInOneKeyPair(void);
67 ResultCode DoSetAllInOneFwkParam(
68     const uint64_t *templateIdList, uint32_t templateIdListLen, const uint8_t *fwkPubKey, uint32_t fwkPubKeySize);
69 ResultCode DoWriteAntiBruteInfoToFile(uint64_t templateId);
70 ResultCode DoAbandonPin(PinAbandonParam *pinAbandonParam, Buffer *extraInfo, Buffer *retTlv);
71 ResultCode DoRestartLockoutDuration(int32_t userId);
72 
73 #ifdef __cplusplus
74 }
75 #endif // __cplusplus
76 #endif // PINAUTHTA_ALL_IN_ONE_FUNC_H
77