Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't apply eip155 to v anymore #23

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/ui_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,17 @@ unsigned int io_seproxyhal_touch_tx_ok(void) {
sizeof(tmpCtx.transactionContext.hash), signature, &sig_len, &info));
explicit_bzero(&privateKey, sizeof(privateKey));
// Parity is present in the sequence tag in the legacy API
if (tmpContent.txContent.vLength == 0) {
// Legacy API
G_io_apdu_buffer[0] = 27;
}
else {
// New API
// Note that this is wrong for a large v, but the client can always recover
G_io_apdu_buffer[0] = (v * 2) + 35;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v constant is not used anymore so you need to delete line 93. "uint32_t v = getV(&tmpContent.txContent);"

}

// Note: For EIP1559 and CIP64 transactions, the client expects v to be
// the parity: 0 | 1
G_io_apdu_buffer[0] = 0;
if (info & CX_ECCINFO_PARITY_ODD) {
G_io_apdu_buffer[0]++;
}
if (info & CX_ECCINFO_xGTn) {
G_io_apdu_buffer[0] += 2;
}
// Unsure what this does
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this commented code

// if (info & CX_ECCINFO_xGTn) {
// G_io_apdu_buffer[0] += 2;
// }
format_signature_out(signature);
tx = 65;
G_io_apdu_buffer[tx++] = 0x90;
Expand Down
Loading