Extract EIP-712 UI code
This commit is contained in:
@@ -451,8 +451,8 @@ void ui_712_deinit(void) {
|
||||
* @param[in] e unused here, just needed to match the UI function signature
|
||||
* @return unused here, just needed to match the UI function signature
|
||||
*/
|
||||
unsigned int ui_712_approve(const bagl_element_t *e) {
|
||||
ui_712_approve_cb(e);
|
||||
unsigned int ui_712_approve() {
|
||||
ui_712_approve_cb();
|
||||
eip712_context_deinit();
|
||||
return 0;
|
||||
}
|
||||
@@ -464,8 +464,8 @@ unsigned int ui_712_approve(const bagl_element_t *e) {
|
||||
* @param[in] e unused here, just needed to match the UI function signature
|
||||
* @return unused here, just needed to match the UI function signature
|
||||
*/
|
||||
unsigned int ui_712_reject(const bagl_element_t *e) {
|
||||
ui_712_reject_cb(e);
|
||||
unsigned int ui_712_reject() {
|
||||
ui_712_reject_cb();
|
||||
eip712_context_deinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ void ui_712_next_field(void);
|
||||
void ui_712_review_struct(const void *const struct_ptr);
|
||||
bool ui_712_new_field(const void *const field_ptr, const uint8_t *const data, uint8_t length);
|
||||
void ui_712_end_sign(void);
|
||||
unsigned int ui_712_approve(const bagl_element_t *e);
|
||||
unsigned int ui_712_reject(const bagl_element_t *e);
|
||||
unsigned int ui_712_approve();
|
||||
unsigned int ui_712_reject();
|
||||
void ui_712_set_title(const char *const str, uint8_t length);
|
||||
void ui_712_set_value(const char *const str, uint8_t length);
|
||||
void ui_712_message_hash(void);
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
|
||||
static const uint8_t EIP_712_MAGIC[] = {0x19, 0x01};
|
||||
|
||||
unsigned int ui_712_approve_cb(const bagl_element_t *e) {
|
||||
unsigned int ui_712_approve_cb() {
|
||||
uint8_t privateKeyData[INT256_LENGTH];
|
||||
uint8_t hash[INT256_LENGTH];
|
||||
uint8_t signature[100];
|
||||
cx_ecfp_private_key_t privateKey;
|
||||
uint32_t tx = 0;
|
||||
|
||||
(void) e;
|
||||
io_seproxyhal_io_heartbeat();
|
||||
cx_keccak_init(&global_sha3, 256);
|
||||
cx_hash((cx_hash_t *) &global_sha3,
|
||||
@@ -74,8 +73,7 @@ unsigned int ui_712_approve_cb(const bagl_element_t *e) {
|
||||
return 0; // do not redraw the widget
|
||||
}
|
||||
|
||||
unsigned int ui_712_reject_cb(const bagl_element_t *e) {
|
||||
(void) e;
|
||||
unsigned int ui_712_reject_cb() {
|
||||
reset_app_context();
|
||||
G_io_apdu_buffer[0] = 0x69;
|
||||
G_io_apdu_buffer[1] = 0x85;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include "ux.h"
|
||||
|
||||
unsigned int ui_712_approve_cb(const bagl_element_t *e);
|
||||
unsigned int ui_712_reject_cb(const bagl_element_t *e);
|
||||
unsigned int ui_712_approve_cb();
|
||||
unsigned int ui_712_reject_cb();
|
||||
|
||||
#endif // COMMON_EIP712_H_
|
||||
|
||||
Reference in New Issue
Block a user