Skip to content

Commit

Permalink
Feature/78-remove-commented-code (#81)
Browse files Browse the repository at this point in the history
* Removed commented code from signer

* Removed commented code from UI
  • Loading branch information
italo-sampaio authored Jul 27, 2022
1 parent fe884e2 commit 3b842c7
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 30 deletions.
6 changes: 0 additions & 6 deletions ledger/src/signer/src/keccak256.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ const uint8_t constants[] = {

uint8_t getConstant(uint8_t type, uint8_t index) {
return constants[type + index];
//return pgm_read_byte(&constants[type + index]);
}

static uint64_t get_round_constant(uint8_t round) {
uint64_t result = 0;

//uint8_t roundInfo = pgm_read_byte(&round_constant_info[round]);
uint8_t roundInfo = getConstant(TYPE_ROUND_INFO, round);
if (roundInfo & (1 << 6)) { result |= ((uint64_t)1 << 63); }
if (roundInfo & (1 << 5)) { result |= ((uint64_t)1 << 31); }
Expand Down Expand Up @@ -134,9 +132,7 @@ static void keccak_theta(uint64_t *A) {
/* Keccak pi() transformation */
static void keccak_pi(uint64_t *A) {
uint64_t A1 = A[1];
//for (uint8_t i = 1; i < sizeof(pi_transform); i++) {
for (uint8_t i = 1; i < 24; i++) {
//A[pgm_read_byte(&pi_transform[i - 1])] = A[pgm_read_byte(&pi_transform[i])];
A[getConstant(TYPE_PI_TRANSFORM, i - 1)] = A[getConstant(TYPE_PI_TRANSFORM, i)];
}
A[10] = A1;
Expand All @@ -162,13 +158,11 @@ static void keccak_chi(uint64_t *A) {


static void sha3_permutation(uint64_t *state) {
//for (uint8_t round = 0; round < sizeof(round_constant_info); round++) {
for (uint8_t round = 0; round < 24; round++) {
keccak_theta(state);

/* apply Keccak rho() transformation */
for (uint8_t i = 1; i < 25; i++) {
//state[i] = ROTL64(state[i], pgm_read_byte(&rhoTransforms[i - 1]));
state[i] = ROTL64(state[i], getConstant(TYPE_RHO_TRANSFORM, i - 1));
}

Expand Down
2 changes: 0 additions & 2 deletions ledger/src/signer/src/keccak256.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ typedef struct SHA3_CTX {
uint64_t message[sha3_max_rate_in_qwords];
/* count of bytes in the message[] buffer */
uint16_t rest;
/* size of a message block processed at once */
//unsigned block_size;
} SHA3_CTX;


Expand Down
4 changes: 1 addition & 3 deletions ledger/src/signer/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ unsigned char io_event(unsigned char channel) {
if ((uiState == UI_TEXT) &&
(os_seph_features() &
SEPROXYHAL_TAG_SESSION_START_EVENT_FEATURE_SCREEN_BIG)) {
if (!display_text_part()) {
// ui_approval();
} else {
if (display_text_part()) {
UX_REDISPLAY();
}
} else {
Expand Down
2 changes: 0 additions & 2 deletions ledger/src/signer/src/trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ uint8_t trie_consume(uint8_t *buf, const uint8_t len) {
uint8_t processed;

for (uint8_t i = 0; i < len; i++) {
// printf("st: %u, i: %u/%u, val: 0x%02x\n", ctx->state, i, len,
// buf[i]);
switch (ctx->state) {
case TRIE_ST_FLAGS:
ctx->raw[0] = buf[i];
Expand Down
5 changes: 0 additions & 5 deletions ledger/src/ui/src/bolos_ux.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ static void sample_main(void) {
BEGIN_TRY {
TRY {
rx = tx;
// flags |= IO_ASYNCH_REPLY;
tx = 0; // ensure no race in catch_other if io_exchange throws
// an error
rx = io_exchange(CHANNEL_APDU | flags, rx);
Expand Down Expand Up @@ -921,10 +920,8 @@ void bolos_ux_main(void) {
break;
}

// screen_onboarding_0_welcome_init();
io_seproxyhal_init();
USB_power(1);
// UX_DISPLAY(bagl_ui_idle_nanos, NULL);
screen_wake_up();
screen_settings_apply();
screen_not_personalized_init();
Expand Down Expand Up @@ -994,14 +991,12 @@ void bolos_ux_main(void) {

case BOLOS_UX_CONSENT_FOREIGN_KEY:
screen_wake_up();
// screen_consent_foreign_key_init();
break;

case BOLOS_UX_CONSENT_GET_DEVICE_NAME:
screen_wake_up();
// GET_DEVICE_NAME event override to reload app
run_first_app();
// screen_consent_get_device_name_init();
break;

case BOLOS_UX_CONSENT_SET_DEVICE_NAME:
Expand Down
2 changes: 0 additions & 2 deletions ledger/src/ui/src/bolos_ux.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ typedef struct bolos_ux_context {
unsigned int settings_index;
unsigned int settings_value;

// unsigned int saver_step;
// unsigned int saver_konami;
int saver_step_x;
int saver_step_y;

Expand Down
3 changes: 0 additions & 3 deletions ledger/src/ui/src/bolos_ux_onboarding_4_restore_word.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,6 @@ const bagl_element_t *screen_onboarding_4_restore_word_keyboard_callback(
G_bolos_ux_context.tmp_element.component.x +=
1 + G_bolos_ux_context.tmp_element.component.width / 2 -
C_icon_backspace.width / 2;
// G_bolos_ux_context.tmp_element.component.y +=
// screen_settings_passphrase_classes_icons[value]->height/2 -
// G_bolos_ux_context.tmp_element.component.height/2;
G_bolos_ux_context.tmp_element.component.y = 5;
G_bolos_ux_context.tmp_element.component.height =
C_icon_backspace.height;
Expand Down
2 changes: 0 additions & 2 deletions ledger/src/ui/src/bolos_ux_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,13 @@ void screen_settings_apply_internal(unsigned int use_persisted,
brightness = BRIGHTNESS_DEFAULT;
rotation = ROTATION_DEFAULT;
invert = INVERSION_DEFAULT;
// shufflePin = SHUFFLE_PIN_DEFAULT;
G_bolos_ux_context.setting_auto_lock_delay_ms = AUTO_LOCK_DEFAULT;
}

if (os_perso_isonboarded() && use_persisted) {
brightness = os_setting_get(OS_SETTING_BRIGHTNESS);
rotation = os_setting_get(OS_SETTING_ROTATION);
invert = os_setting_get(OS_SETTING_INVERT);
// shufflePin = os_setting_get(OS_SETTING_SHUFFLE_PIN);

// load
G_bolos_ux_context.setting_auto_lock_delay_ms = AUTO_LOCK_DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,6 @@ screen_settings_passphrase_type_and_review_keyboard_item_callback(
G_bolos_ux_context.tmp_element.component.width / 2 -
icon->width / 2;
G_bolos_ux_context.tmp_element.component.width = icon->width;
// G_bolos_ux_context.tmp_element.component.y += icon->height/2 -
// G_bolos_ux_context.tmp_element.component.height/2;
G_bolos_ux_context.tmp_element.component.y = 5;
G_bolos_ux_context.tmp_element.component.height = icon->height;
G_bolos_ux_context.tmp_element.component.type = BAGL_ICON;
Expand Down Expand Up @@ -1110,8 +1108,6 @@ screen_settings_passphrase_type_and_review_keyboard_class_callback(
G_bolos_ux_context.tmp_element.component.width / 2 -
icon->width / 2;
G_bolos_ux_context.tmp_element.component.width = icon->width;
// G_bolos_ux_context.tmp_element.component.y += icon->height/2 -
// G_bolos_ux_context.tmp_element.component.height/2;
G_bolos_ux_context.tmp_element.component.y = 5;
G_bolos_ux_context.tmp_element.component.height = icon->height;
G_bolos_ux_context.tmp_element.component.type = BAGL_ICON;
Expand Down
1 change: 0 additions & 1 deletion ledger/src/ui/src/bolos_ux_validate_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ unsigned int force_static_pin() {
G_bolos_ux_context
.screen_stack[G_bolos_ux_context.screen_stack_count - 1]
.button_push_callback = screen_modal_validate_pin_error_button;
// screen_display_init(G_bolos_ux_context.screen_stack_count - 1);
return 1;
}

Expand Down

0 comments on commit 3b842c7

Please sign in to comment.