Skip to content

Commit

Permalink
Fixing some functions and configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoccmartins committed Jan 17, 2025
1 parent d1e2b8b commit 87862bf
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ VARIANT_PARAM = COIN
VARIANT_VALUES = APTOS

# Enabling DEBUG flag will enable PRINTF and disable optimizations
#DEBUG = 1
DEBUG = 1
TEST_PUBLIC_KEY = 1
TESTING = 1

ENABLE_SWAP = 1

########################################
# Application custom permissions #
Expand Down
2 changes: 2 additions & 0 deletions src/handler/get_public_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
*
*/
int handler_get_public_key(buffer_t *cdata, bool display);

int get_public_key(buffer_t *cdata);
17 changes: 11 additions & 6 deletions src/swap/handle_check_address.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifdef HAVE_SWAP
#include <string.h>
#include "swap.h"
#include "get_public_key.h"
#include "../handler/get_public_key.h"
#include "os.h"

#define ADDRESS_LENGTH 32

Expand All @@ -15,27 +17,30 @@ void swap_handle_check_address(check_address_parameters_t *params) {
return;
}

PRINTF("address_parameters: %.*H", params->address_parameters_length, params->address_parameters);
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", params->address_to_check);
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", ADDRESS_LENGTH, strlen(params->address_to_check));
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
if (get_public_key() != 0) {
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 mathces within the addresses in the device\n");
PRINTF("addess_to_check matches within the addresses in the device\n");
params->result = 1;
}

Expand Down
14 changes: 14 additions & 0 deletions src/swap/handle_get_printable_amount.c
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
20 changes: 20 additions & 0 deletions src/swap/handle_swap_sign_transaction.c
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");

Check failure

Code scanning / CodeQL

Missing return statement Error

Function swap_copy_transaction_parameters should return a value of type bool but does not return a value here
}

void __attribute__((noreturn)) swap_finalize_exchange_sign_transaction(bool is_success) {
PRINTF("TODO: swap_finalize_exchange_sign_transaction\n");
}

#endif
Empty file.

0 comments on commit 87862bf

Please sign in to comment.