forked from sonyxperiadev/vendor-sony-oss-fingerprint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tz_api_nile.h
234 lines (201 loc) · 5.07 KB
/
tz_api_nile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*
* Copyright (C) 2018 Jens Andersen / Shane Francis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __TZAPI_H_
#define __TZAPI_H_
#include "tz_api_yoshino_nile_tama.h"
#ifdef __cplusplus
extern "C" {
#endif
#define FP_TZAPP_PATH "/vendor/firmware_mnt/image/"
#define FP_TZAPP_NAME "fpctzapp"
#define KM_TZAPP_PATH ""
#define KM_TZAPP_NAME "keymaster64"
#define KM_TZAPP_ALT_NAME ""
#define BUFFER_SIZE 64
#define TZ_RESPONSE_OFFSET 256
#define FINGERPRINT_MAX_COUNT 5
#define AUTH_RESULT_LENGTH 69
enum fingerprint_group_t {
FPC_GROUP_DB = 0x2,
FPC_GROUP_FPCDATA = 0x3,
FPC_GROUP_DEBUG = 0x6, // I think?
FPC_GROUP_QC = 0x07,
FPC_GROUP_NAVIGATION = 0x8,
FPC_GROUP_INFO = 0x09,
FPC_GROUP_SENSOR = 0xA,
FPC_GROUP_TEMPLATE = 0xB,
};
enum fingerprint_db_cmd_t {
FPC_LOAD_DB = 0x0B,
FPC_STORE_DB = 0x0C,
};
enum fingerprint_fpcdata_cmd_t {
FPC_SET_AUTH_CHALLENGE = 0x01,
FPC_GET_AUTH_CHALLENGE = 0x02,
FPC_AUTHORIZE_ENROL = 0x03,
FPC_GET_AUTH_RESULT = 0x04,
FPC_SET_KEY_DATA = 0x05,
};
//enumerate tz app command ID's
enum fingerprint_sensor_cmd_t {
FPC_WAIT_FINGER_LOST = 0x00,
FPC_WAIT_FINGER_DOWN = 0x02,
FPC_CAPTURE_IMAGE = 0x3,
FPC_DEEP_SLEEP = 0x04,
FPC_GET_OTP_INFO = 0x06,
// FPC_INIT Is unused on Nile
};
enum fingerprint_templates_cmd_t {
FPC_BEGIN_ENROL = 0x00,
FPC_ENROL_STEP = 0x01,
FPC_END_ENROL = 0x02,
FPC_IDENTIFY = 0x03,
FPC_UPDATE_TEMPLATE = 0x04,
FPC_LOAD_EMPTY_DB = 0x06,
FPC_GET_FINGERPRINTS = 0x07,
FPC_DELETE_FINGERPRINT = 0x08,
FPC_SET_GID = 0x09,
FPC_GET_TEMPLATE_ID = 0x0A,
FPC_GET_IDENTIFY_STATISTICS = 0x0D,
};
enum fingerprint_debug_cmd_t {
FPC_GET_SENSOR_INFO = 0x02,
};
enum fingerprint_qc_cmd_t {
FPC_SET_QC_AUTH_NONCE = 0x01,
FPC_GET_QC_AUTH_RESULT = 0x02,
FPC_IS_USER_VALID = 0x03,
};
enum fingerprint_info_cmd_t {
FPC_GET_FPC_INFO = 0x02,
};
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
uint32_t ret_val; //Some cases this is used for return value of the command
} fpc_send_std_cmd_t;
typedef struct {
uint32_t cmd_id;
uint32_t ret_val; //Some cases this is used for return value of the command
uint32_t length; //Some length of data supplied by previous modified command
} keymaster_cmd_t;
typedef struct {
int32_t status;
uint32_t offset;
uint32_t length;
} keymaster_return_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
uint64_t challenge;
int32_t status;
} fpc_send_auth_cmd_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t gid;
} fpc_set_gid_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t has_changed;
} fpc_update_template_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t length;
char data[];
} fpc_send_keydata_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
uint64_t challenge;
int32_t status;
} fpc_load_auth_challenge_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t remaining_touches;
} fpc_enrol_step_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t print_id;
} fpc_end_enrol_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t length;
char* data;
} fpc_send_buffer_t;
typedef struct {
uint32_t commandgroup;
uint32_t command;
int32_t status;
uint32_t id;
uint32_t unk1[2];
} fpc_send_identify_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t length;
uint32_t fingerprints[FINGERPRINT_MAX_COUNT];
} fpc_fingerprint_list_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
int32_t status;
uint32_t fingerprint_id;
} fpc_fingerprint_delete_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
uint32_t result;
uint32_t length;
uint8_t auth_result[AUTH_RESULT_LENGTH]; // In practice this is always 69 bytes
} fpc_get_auth_result_t;
typedef struct {
uint32_t length; //Length of data on ion buffer
uint32_t v_addr; //Virtual address of ion mmap buffer
} fpc_send_mod_cmd_t;
typedef struct {
uint32_t group_id;
uint32_t cmd_id;
uint32_t result;
uint32_t unk1;
uint64_t auth_id;
} fpc_get_db_id_cmd_t;
/*
// Unused but included for completeness
struct fpc_get_identify_stats {
uint32_t command;
uint32_t group;
uint32_t status;
uint32_t unk1;
uint32_t stats[7];
}
*/
#ifdef __cplusplus
}
#endif
#endif