-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathecall.h
79 lines (71 loc) · 3.59 KB
/
ecall.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
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "api/ecall-params.h"
#include "api/uint256.h"
#include "speculos.h"
__attribute__((noreturn)) void ecall_exit(int status);
__attribute__((noreturn)) void ecall_fatal(uint8_t *msg, size_t size);
void ecall_app_loading_start(const char *status);
bool ecall_app_loading_stop(void);
void ecall_bagl_draw_with_context(packed_bagl_component_t *component,
const void *context,
unsigned short context_length,
unsigned char context_encoding);
void ecall_bagl_hal_draw_bitmap_within_rect(int x,
int y,
unsigned int width,
unsigned int height,
const unsigned int *colors,
unsigned int bit_per_pixel,
const unsigned char *bitmap,
unsigned int bitmap_length_bits);
bool ecall_derive_node_bip32(cx_curve_t curve,
const unsigned int *path,
size_t path_count,
uint8_t *private_key,
uint8_t *chain);
size_t ecall_ecdsa_sign(const cx_ecfp_private_key_t *key,
const int mode,
const cx_md_t hash_id,
const uint8_t *hash,
uint8_t *sig,
size_t sig_len,
int *parity);
bool ecall_ecdsa_verify(const cx_ecfp_public_key_t *key,
const uint8_t *hash,
const uint8_t *sig,
const size_t sig_len);
bool ecall_cx_ecfp_generate_pair(cx_curve_t curve,
cx_ecfp_public_key_t *pubkey,
cx_ecfp_private_key_t *privkey,
bool keep_privkey);
bool ecall_schnorr_sign(const cx_ecfp_private_key_t *privkey,
uint32_t mode,
cx_md_t hash_id,
const uint8_t *msg,
size_t msg_len,
uint8_t *sig,
size_t *sig_len); // TODO: make sig_len not a pointer, and return size_t (like ecall_ecdsa_sign)?
bool ecall_schnorr_verify(const cx_ecfp_public_key_t *pubkey,
uint32_t mode,
cx_md_t hash_id,
const uint8_t *msg,
size_t msg_len,
const uint8_t *sig,
size_t sig_len);
void ecall_get_random_bytes(uint8_t *buffer, const size_t size);
bool ecall_hash_final(const cx_hash_id_t hash_id, ctx_hash_guest_t *ctx, uint8_t *digest);
bool ecall_hash_update(const cx_hash_id_t hash_id,
ctx_hash_guest_t *ctx,
const uint8_t *buffer,
const size_t size);
bool ecall_multm(uint8_t *r, const uint8_t *a, const uint8_t *b, const uint8_t *m, size_t len);
bool ecall_powm(uint8_t *r, const uint8_t *a, const uint8_t *e, size_t len_e, const uint8_t *m, size_t len);
void ecall_screen_update(void);
bool ecall_tostring256(const uint256_t *number, const unsigned int base, char *out, size_t len);
void ecall_ux_idle(void);
size_t ecall_xrecv(uint8_t *buffer, size_t size);
void ecall_xsend(const uint8_t *buffer, size_t size);
int ecall_wait_button(void);