1 /* 2 * Copyright (c) 2023-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 PIN_DB_OPS_V0_H 17 #define PIN_DB_OPS_V0_H 18 19 #include <stdint.h> 20 21 #include "pin_db_ops_base.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif // __cplusplus 26 27 #define DB_VERSION_0 0 28 29 typedef struct { 30 uint64_t templateId; 31 uint64_t subType; 32 } __attribute__((__packed__)) PinInfoV0; 33 34 typedef struct { 35 uint32_t authErrorCount; 36 uint64_t startFreezeTime; 37 } __attribute__((__packed__)) AntiBruteInfoV0; 38 39 typedef struct { 40 PinInfoV0 pinInfo; 41 AntiBruteInfoV0 antiBruteInfo; 42 } __attribute__((__packed__)) PinIndexV0; 43 44 typedef struct { 45 uint32_t version; 46 uint32_t pinIndexLen; 47 PinIndexV0 *pinIndex; 48 } __attribute__((__packed__)) PinDbV0; 49 50 void *GetPinDbV0(uint8_t *data, uint32_t dataLen); 51 void FreePinDbV0(void **pinDb); 52 53 void GetMaxLockedAntiBruteInfo(AntiBruteInfoV0 *antiBruteInfoV0); 54 55 #ifdef __cplusplus 56 } 57 #endif // __cplusplus 58 #endif // PIN_DB_OPS_V0_H