-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathsyscalls.h
More file actions
316 lines (278 loc) · 14.3 KB
/
syscalls.h
File metadata and controls
316 lines (278 loc) · 14.3 KB
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/**
* @file syscalls.h
* @brief Public header file related to the syscalls provided by the OS.
*/
#pragma once
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
// the number of parameters of a syscall is stored in the syscall id
#define SYSCALL_NUMBER_OF_PARAMETERS(id) (((id) >> 24) & 0xf)
#define SYSCALL_get_api_level_ID 0x00000001
#define SYSCALL_halt_ID 0x00000002
#define SYSCALL_nvm_write_ID 0x03000003
#define SYSCALL_nvm_erase_ID 0x02000121
#define SYSCALL_cx_aes_set_key_hw_ID 0x020000b2
#define SYSCALL_cx_aes_reset_hw_ID 0x000000b3
#define SYSCALL_cx_aes_block_hw_ID 0x020000b4
#define SYSCALL_cx_bn_lock_ID 0x02000112
#define SYSCALL_cx_bn_unlock_ID 0x000000b6
#define SYSCALL_cx_bn_is_locked_ID 0x000000b7
#define SYSCALL_cx_bn_alloc_ID 0x02000113
#define SYSCALL_cx_bn_alloc_init_ID 0x04000114
#define SYSCALL_cx_bn_destroy_ID 0x010000bc
#define SYSCALL_cx_bn_nbytes_ID 0x0200010d
#define SYSCALL_cx_bn_init_ID 0x03000115
#define SYSCALL_cx_bn_rand_ID 0x010000ea
#define SYSCALL_cx_bn_copy_ID 0x020000c0
#define SYSCALL_cx_bn_set_u32_ID 0x020000c1
#define SYSCALL_cx_bn_get_u32_ID 0x020000eb
#define SYSCALL_cx_bn_export_ID 0x030000c3
#define SYSCALL_cx_bn_cmp_ID 0x030000c4
#define SYSCALL_cx_bn_cmp_u32_ID 0x030000c5
#define SYSCALL_cx_bn_is_odd_ID 0x02000118
#define SYSCALL_cx_bn_xor_ID 0x030000c8
#define SYSCALL_cx_bn_or_ID 0x030000c9
#define SYSCALL_cx_bn_and_ID 0x030000ca
#define SYSCALL_cx_bn_tst_bit_ID 0x030000cb
#define SYSCALL_cx_bn_set_bit_ID 0x020000cc
#define SYSCALL_cx_bn_clr_bit_ID 0x020000cd
#define SYSCALL_cx_bn_shr_ID 0x020000ce
#define SYSCALL_cx_bn_shl_ID 0x0200011c
#define SYSCALL_cx_bn_cnt_bits_ID 0x020000ec
#define SYSCALL_cx_bn_add_ID 0x03000119
#define SYSCALL_cx_bn_sub_ID 0x0300011a
#define SYSCALL_cx_bn_mul_ID 0x030000d2
#define SYSCALL_cx_bn_mod_add_ID 0x040000d3
#define SYSCALL_cx_bn_mod_sub_ID 0x040000d4
#define SYSCALL_cx_bn_mod_mul_ID 0x040000d5
#define SYSCALL_cx_bn_reduce_ID 0x030000d6
#define SYSCALL_cx_bn_mod_sqrt_ID 0x0400011d
#define SYSCALL_cx_bn_mod_pow_bn_ID 0x040000d7
#define SYSCALL_cx_bn_mod_pow_ID 0x050000ed
#define SYSCALL_cx_bn_mod_pow2_ID 0x050000ee
#define SYSCALL_cx_bn_mod_invert_nprime_ID 0x030000da
#define SYSCALL_cx_bn_mod_u32_invert_ID 0x03000116
#define SYSCALL_cx_bn_is_prime_ID 0x020000ef
#define SYSCALL_cx_bn_next_prime_ID 0x010000f0
#define SYSCALL_cx_bn_rng_ID 0x020001dd
#define SYSCALL_cx_bn_gf2_n_mul_ID 0x05000046
#define SYSCALL_cx_mont_alloc_ID 0x020000dc
#define SYSCALL_cx_mont_init_ID 0x020000dd
#define SYSCALL_cx_mont_init2_ID 0x030000de
#define SYSCALL_cx_mont_to_montgomery_ID 0x030000df
#define SYSCALL_cx_mont_from_montgomery_ID 0x030000e0
#define SYSCALL_cx_mont_mul_ID 0x040000e1
#define SYSCALL_cx_mont_pow_ID 0x050000e2
#define SYSCALL_cx_mont_pow_bn_ID 0x040000e3
#define SYSCALL_cx_mont_invert_nprime_ID 0x030000e4
#define SYSCALL_cx_ecdomain_size_ID 0x0200012e
#define SYSCALL_cx_ecdomain_parameters_length_ID 0x0200012f
#define SYSCALL_cx_ecdomain_parameter_ID 0x04000130
#define SYSCALL_cx_ecdomain_parameter_bn_ID 0x03000131
#define SYSCALL_cx_ecdomain_generator_ID 0x04000132
#define SYSCALL_cx_ecdomain_generator_bn_ID 0x02000133
#define SYSCALL_cx_ecpoint_alloc_ID 0x020000f1
#define SYSCALL_cx_ecpoint_destroy_ID 0x010000f2
#define SYSCALL_cx_ecpoint_init_ID 0x050000f3
#define SYSCALL_cx_ecpoint_init_bn_ID 0x030000f4
#define SYSCALL_cx_ecpoint_export_ID 0x050000f5
#define SYSCALL_cx_ecpoint_export_bn_ID 0x030000f6
#define SYSCALL_cx_ecpoint_compress_ID 0x0400012c
#define SYSCALL_cx_ecpoint_decompress_ID 0x0400012d
#define SYSCALL_cx_ecpoint_add_ID 0x0300010e
#define SYSCALL_cx_ecpoint_neg_ID 0x0100010f
#define SYSCALL_cx_ecpoint_scalarmul_ID 0x03000110
#define SYSCALL_cx_ecpoint_scalarmul_bn_ID 0x02000111
#define SYSCALL_cx_ecpoint_rnd_scalarmul_ID 0x03000127
#define SYSCALL_cx_ecpoint_rnd_scalarmul_bn_ID 0x02000128
#ifdef HAVE_FIXED_SCALAR_LENGTH
#define SYSCALL_cx_ecpoint_rnd_fixed_scalarmul_ID 0x03000129
#endif // HAVE_FIXED_SCALAR_LENGTH
#define SYSCALL_cx_ecpoint_double_scalarmul_ID 0x07000148
#define SYSCALL_cx_ecpoint_double_scalarmul_bn_ID 0x0500014a
#define SYSCALL_cx_ecpoint_cmp_ID 0x030000fb
#define SYSCALL_cx_ecpoint_is_on_curve_ID 0x020000fc
#define SYSCALL_cx_ecpoint_is_at_infinity_ID 0x0200014b
#ifdef HAVE_X25519
#define SYSCALL_cx_ecpoint_x25519_ID 0x0300001b
#endif // HAVE_X25519
#ifdef HAVE_X448
#define SYSCALL_cx_ecpoint_x448_ID 0x03000060
#endif // HAVE_X448
#ifdef HAVE_VSS
#define SYSCALL_cx_vss_generate_shares_ID 0x0a000001
#define SYSCALL_cx_vss_combine_shares_ID 0x04000002
#define SYSCALL_cx_vss_verify_commits_ID 0x05000003
#endif // HAVE_VSS
#define SYSCALL_cx_crc_hw_ID 0x04000102
#ifdef HAVE_BLS
#define SYSCALL_ox_bls12381_sign_ID 0x05000103
#define SYSCALL_cx_hash_to_field_ID 0x06000104
#define SYSCALL_cx_bls12381_aggregate_ID 0x05000105
#define SYSCALL_cx_bls12381_key_gen_ID 0x03000108
#endif // HAVE_BLS
#define SYSCALL_cx_get_random_bytes_ID 0x02000107
#define SYSCALL_cx_trng_get_random_data_ID 0x02000106
#define SYSCALL_RESERVED_7_ID 0x0000004b
#define SYSCALL_RESERVED_8_ID 0x0400004e
#define SYSCALL_RESERVED_9_ID 0x0700004f
#define SYSCALL_RESERVED_10_ID 0x02000050
#define SYSCALL_RESERVED_11_ID 0x01000051
#define SYSCALL_os_perso_is_pin_set_ID 0x0000009e
#define SYSCALL_os_perso_isonboarded_ID 0x0000009f
#define SYSCALL_RESERVED_12_ID 0x03000094
#define SYSCALL_os_perso_derive_node_bip32_ID 0x05000053
#define SYSCALL_os_perso_derive_node_with_seed_key_ID 0x080000a6
#define SYSCALL_os_perso_derive_eip2333_ID 0x040000a7
#define SYSCALL_HDKEY_DERIVE_ID 0x0a000002
#define SYSCALL_RESERVED_13_ID 0x02000052
#ifdef HAVE_RECOVER
#define SYSCALL_RESERVED_14_ID 0x02000054
#endif // HAVE_RECOVER
#define SYSCALL_os_perso_get_master_key_identifier_ID 0x02000055
#define SYSCALL_ENDORSEMENT_GET_CODE_HASH_ID 0x01000055
#define SYSCALL_ENDORSEMENT_GET_PUB_KEY_ID 0x03000056
#define SYSCALL_ENDORSEMENT_GET_PUB_KEY_SIG_ID 0x03000057
#define SYSCALL_ENDORSEMENT_KEY1_GET_APP_SECRET_ID 0x01000058
#define SYSCALL_ENDORSEMENT_KEY1_SIGN_DATA_ID 0x04000059
#define SYSCALL_ENDORSEMENT_KEY2_DERIVE_AND_SIGN_DATA_ID 0x0400005a
#define SYSCALL_ENDORSEMENT_KEY1_SIGN_WITHOUT_CODE_HASH_ID 0x0400005b
#define SYSCALL_RESERVED_15_ID 0x0400004c
#define SYSCALL_RESERVED_16_ID 0x0200004d
#define SYSCALL_os_global_pin_is_validated_ID 0x000000a0
#define SYSCALL_os_global_pin_check_ID 0x020000a1
#define SYSCALL_os_global_pin_invalidate_ID 0x0000005d
#define SYSCALL_os_global_pin_retries_ID 0x0000005e
#define SYSCALL_RESERVED_3_ID 0x0000005f
#define SYSCALL_RESERVED_4_ID 0x02000122
#define SYSCALL_os_ux_ID 0x01000064
#define SYSCALL_os_lib_call_ID 0x01000067
#define SYSCALL_os_lib_end_ID 0x00000068
#define SYSCALL_os_flags_ID 0x0000006a
#define SYSCALL_os_version_ID 0x0200006b
#define SYSCALL_os_serial_ID 0x0200006c
#define SYSCALL_os_seph_features_ID 0x0000006e
#define SYSCALL_os_seph_version_ID 0x0200006f
#define SYSCALL_os_bootloader_version_ID 0x02000073
#define SYSCALL_os_factory_setting_get_ID 0x0300014c
#define SYSCALL_os_setting_get_ID 0x03000070
#define SYSCALL_os_setting_set_ID 0x03000071
#define SYSCALL_RESERVED_5_ID 0x06000123
#define SYSCALL_os_registry_get_current_app_tag_ID 0x03000074
#define SYSCALL_RESERVED_6_ID 0x00000125
#define SYSCALL_RESERVED_34_ID 0x01000126
#define SYSCALL_os_sched_exit_ID 0x0100009a
#define SYSCALL_RESERVED_36_ID 0x0100009b
#define SYSCALL_os_io_seph_tx_ID 0x03000082
#define SYSCALL_os_io_seph_se_rx_event_ID 0x05000083
#define SYSCALL_os_io_init_ID 0x01000084
#define SYSCALL_os_io_start_ID 0x01000085
#define SYSCALL_os_io_stop_ID 0x01000086
#define SYSCALL_os_io_tx_cmd_ID 0x04000088
#define SYSCALL_os_io_rx_evt_ID 0x03000089
#define SYSCALL_nvm_write_page_ID 0x0100010a
#define SYSCALL_nvm_erase_page_ID 0x01000136
#define SYSCALL_try_context_get_ID 0x00000087
#define SYSCALL_try_context_set_ID 0x0100010b
#define SYSCALL_os_sched_last_status_ID 0x0100009c
#define SYSCALL_RESERVED_38_ID 0x0100009d
#define SYSCALL_os_sched_switch_ID 0x0200009e
#define SYSCALL_RESERVED_37_ID 0x0000008b
#define SYSCALL_os_allow_protected_flash_ID 0x0000008e
#define SYSCALL_os_deny_protected_flash_ID 0x00000091
#define SYSCALL_os_allow_protected_ram_ID 0x00000092
#define SYSCALL_os_deny_protected_ram_ID 0x00000093
#define SYSCALL_os_set_ux_time_ms_ID 0x010000a2
#if defined(HAVE_LEDGER_PKI)
#define SYSCALL_os_pki_load_certificate_ID 0x060000aa
#define SYSCALL_os_pki_verify_ID 0x040000ab
#define SYSCALL_os_pki_get_info_ID 0x040000ac
#endif // HAVE_LEDGER_PKI
#define SYSCALL_RESERVED_20_ID 0x02000150
#define SYSCALL_RESERVED_21_ID 0x03000151
#define SYSCALL_RESERVED_22_ID 0x01000152
#define SYSCALL_RESERVED_23_ID 0x01000155
#ifdef HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS
#define SYSCALL_RESERVED_24_ID 0x01000CA0
#define SYSCALL_RESERVED_25_ID 0x00000CA1
#endif // HAVE_CUSTOM_CA_DETAILS_IN_SETTINGS
#define SYSCALL_RESERVED_2_ID 0x010001ED
#define SYSCALL_RESERVED_1_ID 0x010001EE
#define SYSCALL_ENDORSEMENT_GET_METADATA_ID 0x02000138
#if defined(HAVE_VAULT_RECOVERY_ALGO)
#define SYSCALL_RESERVED_17_ID 0x02000137
#define SYSCALL_RESERVED_18_ID 0x00000149
#define SYSCALL_RESERVED_19_ID 0x00000152
#endif // HAVE_VAULT_RECOVERY_ALGO
#ifdef HAVE_SE_SCREEN
#define SYSCALL_screen_clear_ID 0x00000079
#define SYSCALL_screen_update_ID 0x0000007a
#define SYSCALL_screen_set_keepout_ID 0x0400007b
#define SYSCALL_RESERVED_35_ID 0x0400007b
#define SYSCALL_bagl_hal_draw_bitmap_within_rect_ID 0x0900007c
#define SYSCALL_bagl_hal_draw_rect_ID 0x0500007d
#endif // HAVE_SE_SCREEN
#ifdef HAVE_BLE
#define SYSCALL_os_ux_set_status_ID_IN 0x02000134
#define SYSCALL_os_ux_get_status_ID_IN 0x01000135
#endif
#ifdef HAVE_SE_BUTTON
#define SYSCALL_io_button_read_ID 0x0000008f
#endif // HAVE_SE_BUTTON
#define SYSCALL_os_standby_ID 0x0000d0d0
#define SYSCALL_os_seph_serial_ID 0x0200006d
#define SYSCALL_RESERVED_26_ID 0x01000153
#define SYSCALL_RESERVED_27_ID 0x01000154
#ifdef DEBUG_OS_STACK_CONSUMPTION
#define SYSCALL_os_stack_operations_ID 0x01000199
#endif // DEBUG_OS_STACK_CONSUMPTION
// Stax syscalls
#ifdef HAVE_NBGL
#define SYSCALL_nbgl_front_draw_rect_ID 0x01fa0000
#define SYSCALL_nbgl_front_draw_line_ID 0x03fa0001
#define SYSCALL_nbgl_front_draw_img_ID 0x04fa0002
#define SYSCALL_nbgl_front_refresh_area_ID 0x03fa0003
#define SYSCALL_nbgl_front_draw_img_file_ID 0x05fa0004
#define SYSCALL_RESERVED_30_ID 0x01fa0005
#define SYSCALL_RESERVED_31_ID 0x03fa0006
#define SYSCALL_RESERVED_32_ID 0x04fa0007
#define SYSCALL_RESERVED_33_ID 0x02fa0008
#define SYSCALL_nbgl_screen_reinit_ID 0x00fa000d
#define SYSCALL_nbgl_front_draw_img_rle_ID 0x05fa0010
#define SYSCALL_nbgl_front_control_area_masking_ID 0x03fa0012
#ifdef HAVE_SE_EINK_DISPLAY
#define SYSCALL_nbgl_wait_pipeline_ID 0x00fa0011
#endif
#ifdef HAVE_STAX_DISPLAY_FAST_MODE
#define SYSCALL_nbgl_screen_update_temperature_ID 0x01fa0011
#endif // HAVE_STAX_DISPLAY_FAST_MODE
#ifdef HAVE_STAX_CONFIG_DISPLAY_FAST_MODE
#define SYSCALL_nbgl_screen_config_fast_mode_ID 0x00fa0012
#endif // HAVE_STAX_CONFIG_DISPLAY_FAST_MODE
#endif // HAVE_NBGL
#define SYSCALL_RESERVED_28_ID 0x00fa0009
#define SYSCALL_RESERVED_29_ID 0x00fa000a
#ifdef HAVE_SE_TOUCH
#define SYSCALL_touch_get_last_info_ID 0x01fa000b
#define SYSCALL_touch_exclude_borders_ID 0x01fa000d
#define SYSCALL_touch_set_state_ID 0x01fa000e
#ifdef HAVE_TOUCH_READ_DEBUG_DATA_SYSCALL
#define SYSCALL_touch_debug_ID 0x03fa000f
#endif
#endif // HAVE_SE_TOUCH
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* STATIC INLINE
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/