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 ROOT_SECRET_LEN 32U 27 28 typedef struct { 29 uint64_t scheduleId; 30 uint64_t templateId; 31 uint8_t pinData[CONST_PIN_DATA_LEN]; 32 } PinAuthParam; 33 34 typedef struct { 35 uint64_t subType; 36 uint64_t templateId; 37 } QueryCredential; 38 39 ResultCode DoGetAllInOneExecutorInfo(PinExecutorInfo *pinExecutorInfo); 40 ResultCode DoEnrollPin(PinEnrollParam *pinEnrollParam, Buffer *retTlv); 41 ResultCode DoAllInOneAuth(uint64_t scheduleId, uint64_t templateId, 42 const uint8_t *extraInfo, uint32_t extraInfoSize, AlgoParamOut *algoParam); 43 ResultCode DoAuthPin(PinAuthParam *pinAuthParam, Buffer *retTlv, ResultCode *compareRet); 44 ResultCode DoDeleteTemplate(uint64_t templateId); 45 ResultCode GenerateAllInOneKeyPair(void); 46 void DestroyAllInOneKeyPair(void); 47 ResultCode DoSetAllInOneFwkParam( 48 const uint64_t *templateIdList, uint32_t templateIdListLen, const uint8_t *fwkPubKey, uint32_t fwkPubKeySize); 49 ResultCode DoWriteAntiBruteInfoToFile(uint64_t templateId); 50 51 #ifdef __cplusplus 52 } 53 #endif // __cplusplus 54 #endif // PINAUTHTA_ALL_IN_ONE_FUNC_H 55