Skip to content

Commit

Permalink
remove: #ifndef BAKING_APP
Browse files Browse the repository at this point in the history
  • Loading branch information
emturner committed Oct 16, 2023
1 parent ed61710 commit 85c5538
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 911 deletions.
3 changes: 0 additions & 3 deletions src/apdu_pubkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
size_t handle_apdu_get_public_key(uint8_t instruction, volatile uint32_t* flags);

void prompt_address(
#ifndef BAKING_APP
__attribute__((unused))
#endif
bool baking,
ui_callback_t ok_cb,
ui_callback_t cxl_cb);
68 changes: 0 additions & 68 deletions src/apdu_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,6 @@ static bool is_operation_allowed(enum operation_tag tag) {
return true;
case OPERATION_TAG_BABYLON_REVEAL:
return true;
#ifndef BAKING_APP
case OPERATION_TAG_PROPOSAL:
return true;
case OPERATION_TAG_BALLOT:
return true;
case OPERATION_TAG_ATHENS_ORIGINATION:
return true;
case OPERATION_TAG_ATHENS_TRANSACTION:
return true;
case OPERATION_TAG_BABYLON_ORIGINATION:
return true;
case OPERATION_TAG_BABYLON_TRANSACTION:
return true;
#endif
default:
return false;
}
Expand All @@ -131,18 +117,6 @@ static bool parse_allowed_operations(struct parsed_operation_group *const out,
&is_operation_allowed);
}

#else

static bool parse_allowed_operation_packet(struct parsed_operation_group *const out,
uint8_t const *const in,
size_t const in_size) {
return parse_operations_packet(out, in, in_size, &is_operation_allowed);
}

#endif

#ifdef BAKING_APP // ----------------------------------------------------------

size_t baking_sign_complete(bool const send_hash, volatile uint32_t *flags) {
switch (G.magic_byte) {
case MAGIC_BYTE_TENDERBAKE_BLOCK:
Expand Down Expand Up @@ -194,9 +168,6 @@ static uint8_t get_magic_byte_or_throw(uint8_t const *const buff, size_t const b
case MAGIC_BYTE_BLOCK:
case MAGIC_BYTE_BAKING_OP:
case MAGIC_BYTE_UNSAFE_OP: // Only for self-delegations
#else
case MAGIC_BYTE_UNSAFE_OP:
case MAGIC_BYTE_UNSAFE_OP3:
#endif
return magic_byte;

Expand All @@ -223,12 +194,6 @@ static size_t handle_apdu(bool const enable_hashing,
global.path_with_curve.derivation_type =
parse_derivation_type(G_io_apdu_buffer[OFFSET_CURVE]);
return finalize_successful_send(0);
#ifndef BAKING_APP
case P1_HASH_ONLY_NEXT:
// This is a debugging Easter egg
G.hash_only = true;
__attribute__((fallthrough));
#endif
case P1_NEXT:
if (global.path_with_curve.bip32_path.length == 0) THROW(EXC_WRONG_LENGTH_FOR_INS);

Expand All @@ -254,31 +219,6 @@ static size_t handle_apdu(bool const enable_hashing,
// This should be a baking operation so parse it.
if (!parse_baking_data(&G.parsed_baking_data, buff, buff_size)) PARSE_ERROR();
}
#else
if (G.packet_index == 1) {
G.maybe_ops.is_valid = false;
G.magic_byte = get_magic_byte_or_throw(buff, buff_size);

// If it is an "operation" (starting with the 0x03 magic byte), set up parsing
// If it is arbitrary Michelson (starting with 0x05), dont bother parsing and show
// the "Sign Hash" prompt
if (G.magic_byte == MAGIC_BYTE_UNSAFE_OP) {
parse_operations_init(&G.maybe_ops.v,
global.path_with_curve.derivation_type,
&global.path_with_curve.bip32_path,
&G.parse_state);
}
// If magic byte is not 0x03 or 0x05, fail
else if (G.magic_byte != MAGIC_BYTE_UNSAFE_OP3) {
PARSE_ERROR();
}
}

// Only parse if the message is an "Operation"
if (G.magic_byte == MAGIC_BYTE_UNSAFE_OP) {
parse_allowed_operation_packet(&G.maybe_ops.v, buff, buff_size);
}

#endif
}

Expand Down Expand Up @@ -315,8 +255,6 @@ static size_t handle_apdu(bool const enable_hashing,
return
#ifdef BAKING_APP
baking_sign_complete(instruction == INS_SIGN_WITH_HASH, flags);
#else
wallet_sign_complete(instruction, G.magic_byte, flags);
#endif
} else {
return finalize_successful_send(0);
Expand All @@ -338,12 +276,6 @@ size_t handle_apdu_sign_with_hash(uint8_t instruction, volatile uint32_t *flags)
int perform_signature(bool const on_hash, bool const send_hash) {
#ifdef BAKING_APP
write_high_water_mark(&G.parsed_baking_data);
#else
if (on_hash && G.hash_only) {
memcpy(G_io_apdu_buffer, G.final_hash, sizeof(G.final_hash));
clear_data();
return finalize_successful_send(sizeof(G.final_hash));
}
#endif

size_t tx = 0;
Expand Down
7 changes: 0 additions & 7 deletions src/apdu_sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ size_t handle_apdu_sign_with_hash(uint8_t instruction, volatile uint32_t* flags)

void prompt_register_delegate(ui_callback_t const ok_cb, ui_callback_t const cxl_cb);

#else // ifdef BAKING_APP -----------------------------------------------------
bool prompt_transaction(struct parsed_operation_group const* const ops,
bip32_path_with_curve_t const* const key,
ui_callback_t ok,
ui_callback_t cxl);

size_t wallet_sign_complete(uint8_t instruction, uint8_t magic_byte, volatile uint32_t* flags);
#endif // ifdef BAKING_APP ----------------------------------------------------

int perform_signature(bool const on_hash, bool const send_hash);
2 changes: 0 additions & 2 deletions src/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,5 @@ __attribute__((section(".boot"))) int main(arg0) {
false
#endif
); // Should not be allowed dashboard access
#else
exit_app();
#endif
}
2 changes: 0 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ __attribute__((noreturn)) void app_main(void) {
global.handlers[APDU_INS(INS_QUERY_AUTH_KEY_WITH_CURVE)] =
handle_apdu_query_auth_key_with_curve;
global.handlers[APDU_INS(INS_HMAC)] = handle_apdu_hmac;
#else
global.handlers[APDU_INS(INS_SIGN_UNSAFE)] = handle_apdu_sign;
#endif
main_loop(global.handlers, NUM_ELEMENTS(global.handlers));
}
30 changes: 0 additions & 30 deletions src/operations.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,34 +962,4 @@ bool parse_operations(struct parsed_operation_group *const out,
END_TRY;
return true;
}

#else

bool parse_operations_packet(struct parsed_operation_group *const out,
uint8_t const *const data,
size_t length,
is_operation_allowed_t is_operation_allowed) {
BEGIN_TRY {
TRY {
size_t ix = 0;
while (ix < length) {
uint8_t byte = ((uint8_t *) data)[ix];
parse_byte(byte, &G.parse_state, out, is_operation_allowed);
PRINTF("Byte: %x - Next op_step state: %d\n", byte, G.parse_state.op_step);
ix++;
}
}
CATCH(EXC_PARSE_ERROR) {
return false;
}
CATCH_OTHER(e) {
THROW(e);
}
FINALLY {
}
}
END_TRY;
return true;
}

#endif
2 changes: 0 additions & 2 deletions src/ui_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ void ui_initial_screen(void) {
init_screen_stack();
#ifdef BAKING_APP
calculate_baking_idle_screens_data();
#else
push_ui_callback("Tezos Wallet", copy_string, VERSION);
#endif

ux_idle_screen(NULL, NULL);
Expand Down
27 changes: 0 additions & 27 deletions src/ui_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,6 @@ void ui_menu_about_baking(void) {
navigation_cb_baking,
NULL);
}

#else
static bool navigation_cb_wallet(uint8_t page, nbgl_pageContent_t* content) {
UNUSED(page);

if (page == 0) {
content->type = INFOS_LIST;
content->infosList.nbInfos = 3;
content->infosList.infoTypes = infoTypes;
content->infosList.infoContents = infoContents;
}

return true;
}

void ui_menu_about_wallet(void) {
nbgl_useCaseSettings("Tezos wallet",
0,
1,
false,
ui_initial_screen,
navigation_cb_wallet,
NULL);
}

#endif

void ux_idle_screen(ui_callback_t ok_c, ui_callback_t cxl_c) {
Expand All @@ -106,8 +81,6 @@ void ux_idle_screen(ui_callback_t ok_c, ui_callback_t cxl_c) {

#ifdef BAKING_APP
nbgl_useCaseHome("Tezos Baking", &C_tezos, NULL, false, ui_menu_about_baking, exit_app);
#else
nbgl_useCaseHome("Tezos", &C_tezos, NULL, false, ui_menu_about_wallet, exit_app);
#endif
}

Expand Down
3 changes: 0 additions & 3 deletions src/ui_pubkey_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include <string.h>

__attribute__((noreturn)) void prompt_address(
#ifndef BAKING_APP
__attribute__((unused))
#endif
bool baking,
ui_callback_t ok_cb,
ui_callback_t cxl_cb) {
Expand Down
3 changes: 0 additions & 3 deletions src/ui_pubkey_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ static void verify_address(void) {
}

void prompt_address(
#ifndef BAKING_APP
__attribute__((unused))
#endif
bool baking,
ui_callback_t ok_cb,
ui_callback_t cxl_cb) {
Expand Down
Loading

0 comments on commit 85c5538

Please sign in to comment.