forked from pontem-network/ledger-app-aptos
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add check address #19
Draft
joaoccmartins
wants to merge
3
commits into
LedgerHQ:develop
Choose a base branch
from
LedgerHQ:swap/add_check_address
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+110
−14
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ | |
* | ||
*/ | ||
int handler_get_public_key(buffer_t *cdata, bool display); | ||
|
||
int get_public_key(buffer_t *cdata); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifdef HAVE_SWAP | ||
#include <string.h> | ||
#include "swap.h" | ||
#include "../handler/get_public_key.h" | ||
#include "os.h" | ||
|
||
#define ADDRESS_LENGTH 32 | ||
|
||
/* Set params.result to 0 on error, 1 otherwise */ | ||
void swap_handle_check_address(check_address_parameters_t *params) { | ||
PRINTF("Inside Aptos swap_handle_check_address\n"); | ||
params->result = 0; | ||
|
||
// Checking that parameters are correct | ||
if (params->address_parameters == NULL || params->address_parameters_length == 0) { | ||
PRINTF("address_parameters is empty\n"); | ||
return; | ||
} | ||
|
||
PRINTF("address_parameters: %.*H\n", params->address_parameters_length, params->address_parameters); | ||
|
||
if (params->address_to_check == NULL) { | ||
PRINTF("address_to_check is empty\n"); | ||
return; | ||
} | ||
|
||
PRINTF("address_to_check: %s\n", params->address_to_check); | ||
if (strlen(params->address_to_check) != ADDRESS_LENGTH) { | ||
PRINTF("address_to_check length should be %d, not %d\n", ADDRESS_LENGTH, strlen(params->address_to_check)); | ||
return; | ||
} | ||
|
||
// Check that the address to check is in the list of addresses in the device | ||
buffer_t cdata; | ||
cdata.ptr = params->address_parameters; | ||
cdata.size = params->address_parameters_length; | ||
if (get_public_key(&cdata) != 0) { | ||
PRINTF("get_public_key failed\n"); | ||
return; | ||
} | ||
|
||
|
||
PRINTF("addess_to_check matches within the addresses in the device\n"); | ||
params->result = 1; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifdef HAVE_SWAP | ||
|
||
#include <string.h> // memset, explicit_bzero | ||
#include "handle_swap_sign_transaction.h" | ||
#include "swap.h" | ||
#include "os.h" | ||
#include "constants.h" | ||
|
||
/* Set empty printable_amount on error, printable amount otherwise */ | ||
void swap_handle_get_printable_amount(get_printable_amount_parameters_t* params) { | ||
PRINTF("TODO: swap_handle_get_printable_amount\n"); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifdef HAVE_SWAP | ||
|
||
#include "handle_swap_sign_transaction.h" | ||
#include "display.h" | ||
#include "swap.h" | ||
#include "string.h" | ||
#include "os_lib.h" | ||
#include "constants.h" | ||
#include "os_utils.h" | ||
#include "globals.h" | ||
|
||
bool swap_copy_transaction_parameters(create_transaction_parameters_t* params) { | ||
PRINTF("TODO: swap_copy_transaction_parameters\n"); | ||
} | ||
|
||
void __attribute__((noreturn)) swap_finalize_exchange_sign_transaction(bool is_success) { | ||
PRINTF("TODO: swap_finalize_exchange_sign_transaction\n"); | ||
} | ||
|
||
#endif |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
Missing return statement Error