• 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 FACE_AUTHTA_FUNC_H
17 #define FACE_AUTHTA_FUNC_H
18 
19 #include <vector>
20 #include "defines.h"
21 #include "buffer.h"
22 #include "coauth_info_define.h"
23 
24 namespace OHOS {
25 namespace UserIAM {
26 namespace FaceAuth {
27 #define TAG_AND_LEN_BYTE 8
28 #define TAG_ANG_LEN_T 12
29 #define TAG_AND_LEN_S 16
30 #define MAX_TLV_LEN 200
31 #define SIGN_DATA_LEN 64
32 #define PIN_RET_TYPE_LEN 8
33 #define PIN_RET_DATA_LEN 72
34 #define FACE_AUTH_CAPABILITY_LEVEL 2
35 #define ED25519_FIX_PUBKEY_BUFFER_SIZE 32
36 #define ED25519_FIX_PRIKEY_BUFFER_SIZE 64
37 #define FACE_EXECUTOR_SECURITY_LEVEL 1
38 #define PIN_AUTH_ABILITY 7
39 #define FACE_AUTH_ABILITY 7
40 #define RESULT_TLV_LEN 160U
41 #define CONST_PUB_KEY_LEN 32U
42 
43 ResultCode GenerateRetTlv(uint32_t result, uint64_t scheduleId, uint64_t subType, uint64_t templatedId, Buffer *retTlv);
44 ResultCode GenerateKeyPair();
45 ResultCode SetResultTlv(Buffer *retTlv, std::vector<uint8_t> &resultTlv);
46 ResultCode DoGetExecutorInfo(std::vector<uint8_t> &vPubKey, uint32_t &esl, uint64_t &authAbility);
47 } // namespace FaceAuth
48 } // namespace UserIAM
49 } // namespace OHOS
50 #endif // FACE_AUTHTA_FUNC_H
51