Skip to content

Commit

Permalink
Added nanox compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jspada committed May 19, 2021
1 parent 20d53ee commit 843e809
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ EMULATOR=0
endif

ifeq ("$(EMULATOR_SDK)","")
ifeq ("$(NANO_MODEL)","nanox")
EMULATOR_SDK=1.2
else
EMULATOR_SDK=2.0
endif
endif

ifeq ("$(NO_EMULATOR_TESTS)","")
EMULATOR_TESTS=1
Expand Down Expand Up @@ -141,7 +145,7 @@ DEFINES += UNUSED\(x\)=\(void\)x
DEFINES += APPVERSION=\"$(APPVERSION)\"

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += BUILD_NANOX IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE

Expand Down
2 changes: 2 additions & 0 deletions src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
// GROUP_ORDER = 28948022309329048855892746252171976963363056481941647379679742748393362948097 (Fq, 0x94)
// FIELD_MODULUS = 28948022309329048855892746252171976963363056481941560715954676764349967630337 (Fp, 0x4c)

#ifndef BUILD_NANOX
#include <lcx_sha256.h>
#include <lcx_blake2.h>
#include <lcx_math.h>
#endif

#include "crypto.h"
#include "poseidon.h"
Expand Down
10 changes: 10 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ EMULATOR=1
else
EMULATOR=0
endif

ifeq ("$(EMULATOR_SDK)","")
ifeq ("$(NANO_MODEL)","nanox")
EMULATOR_SDK=1.2
else
EMULATOR_SDK=2.0
endif
endif

ifeq ("$(NO_EMULATOR_TESTS)","")
EMULATOR_TESTS=1
else
EMULATOR_TESTS=0
endif

ifeq ("$(NANO_MODEL)","nanos")
EMULATOR_MODEL=nanos
endif

ifeq ("$(NANO_MODEL)","nanox")
EMULATOR_MODEL=nanox
endif

ifeq ("$(EMULATOR_MODEL)","")
$(error Unknown NANO_MODEL '$(NANO_MODEL)')
endif

ifeq ("$(EMULATOR_MODEL)","")
$(error Environment variable EMULATOR_MODEL is not set (source ./prepare-devenv.sh))
endif
Expand Down

0 comments on commit 843e809

Please sign in to comment.