Skip to content

Commit

Permalink
Set max message len based on device
Browse files Browse the repository at this point in the history
Nano S can only handle up to 120 len
Others 200 and above
  • Loading branch information
coderofstuff committed Sep 15, 2023
1 parent 05940ff commit 6fa2ff6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += MAX_INPUT_COUNT=15
DEFINES += MAX_MESSAGE_LEN=120
else ifeq ($(TARGET_NAME),TARGET_STAX)
DEFINES += MAX_INPUT_COUNT=128
DEFINES += MAX_MESSAGE_LEN=200
else
DEFINES += MAX_INPUT_COUNT=128
DEFINES += MAX_MESSAGE_LEN=200
endif

# Application source files
Expand Down Expand Up @@ -76,7 +79,7 @@ VARIANT_PARAM = COIN
VARIANT_VALUES = KAS

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

########################################
# Application custom permissions #
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_compile_definitions(MAX_INPUT_COUNT=15 USB_SEGMENT_SIZE=64)
add_compile_definitions(MAX_INPUT_COUNT=15 MAX_MESSAGE_LEN=200 USB_SEGMENT_SIZE=64)

include(extra/TxParser.cmake)

Expand Down
5 changes: 0 additions & 5 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
*/
#define MAX_APPNAME_LEN 64

/**
* Maximum message length (bytes)
*/
#define MAX_MESSAGE_LEN 200

/**
* Maximum signature length (bytes).
* Schnorr signatures only have 64 bytes
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()

add_compile_definitions(TEST HAVE_HASH HAVE_BLAKE2 HAVE_ECC USB_SEGMENT_SIZE=64 MAX_INPUT_COUNT=15 IO_SEPROXYHAL_BUFFER_SIZE_B=128)
add_compile_definitions(TEST HAVE_HASH HAVE_BLAKE2 HAVE_ECC USB_SEGMENT_SIZE=64 MAX_INPUT_COUNT=15 MAX_MESSAGE_LEN=200 IO_SEPROXYHAL_BUFFER_SIZE_B=128)

include_directories(../src)
# include_directories(mock_includes)
Expand Down

0 comments on commit 6fa2ff6

Please sign in to comment.