Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Jun 11, 2024
1 parent 418bc84 commit 2bb34c5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
12 changes: 10 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ static void neo_main(void) {

// generate the public key.
CX_ASSERT(cx_ecdsa_init_public_key(CX_CURVE_256R1, NULL, 0, &publicKey));
CX_ASSERT(cx_ecfp_generate_pair_no_throw(CX_CURVE_256R1, &publicKey, &privateKey, 1));
CX_ASSERT(cx_ecfp_generate_pair_no_throw(CX_CURVE_256R1,
&publicKey,
&privateKey,
1));

// push the public key onto the response buffer.
memmove(G_io_apdu_buffer, publicKey.W, 65);
Expand All @@ -239,7 +242,12 @@ static void neo_main(void) {
cx_sha256_t pubKeyHash;
cx_sha256_init(&pubKeyHash);

CX_ASSERT(cx_hash_no_throw(&pubKeyHash.header, CX_LAST, publicKey.W, 65, result, 32));
CX_ASSERT(cx_hash_no_throw(&pubKeyHash.header,
CX_LAST,
publicKey.W,
65,
result,
32));
size_t sig_len = sizeof(G_io_apdu_buffer) - tx;

if (cx_ecdsa_sign_no_throw((void *) &privateKey,
Expand Down
20 changes: 10 additions & 10 deletions src/neo.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,18 @@ static void to_address(char *dest, unsigned int dest_len, const unsigned char *s
// do a sha256 hash of the address twice.
cx_sha256_init(&address_hash);
CX_ASSERT(cx_hash_no_throw(&address_hash.header,
CX_LAST,
address,
SCRIPT_HASH_LEN + 1,
address_hash_result_0,
32));
CX_LAST,
address,
SCRIPT_HASH_LEN + 1,
address_hash_result_0,
32));
cx_sha256_init(&address_hash);
CX_ASSERT(cx_hash_no_throw(&address_hash.header,
CX_LAST,
address_hash_result_0,
SHA256_HASH_LEN,
address_hash_result_1,
32));
CX_LAST,
address_hash_result_0,
SHA256_HASH_LEN,
address_hash_result_1,
32));

// add the first bytes of the hash as a checksum at the end of the address.
memmove(address + 1 + SCRIPT_HASH_LEN, address_hash_result_1, SCRIPT_HASH_CHECKSUM_LEN);
Expand Down
10 changes: 8 additions & 2 deletions test/test_display_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def test_display_address(backend, firmware, navigator):
# button position.
ROOT_SCREENSHOT_PATH,
path,
[NavIns(NavInsID.TOUCH, (200, y_touch)), NavInsID.CENTERED_FOOTER_TAP],
[
NavIns(NavInsID.TOUCH,
(200, y_touch)), NavInsID.CENTERED_FOOTER_TAP
],
screen_change_before_first_instruction=False)
else:
navigator.navigate_and_compare(
Expand Down Expand Up @@ -67,7 +70,10 @@ def test_display_address(backend, firmware, navigator):
# button position.
ROOT_SCREENSHOT_PATH,
path,
[NavIns(NavInsID.TOUCH, (200, y_touch)), NavInsID.CENTERED_FOOTER_TAP],
[
NavIns(NavInsID.TOUCH,
(200, y_touch)), NavInsID.CENTERED_FOOTER_TAP
],
screen_change_before_first_instruction=False,
snap_start_idx=3)
else:
Expand Down

0 comments on commit 2bb34c5

Please sign in to comment.