LedgerHQ / ledger-sample-apps

Sample Applications for Ledger Nano S and Ledger Blue
Apache License 2.0
55 stars 26 forks source link

Can't compile the sample-apps using the 1.4.2 firmware #8

Open richgrove opened 6 years ago

richgrove commented 6 years ago

I installed the nano secure SDK nano-1421 tag for my updated ledger firmware 1.4.2. "make" on the sample apps got the error messages like:

vagrant@vagrant-ubuntu-trusty-64:~/apps/blue-sample-apps/blue-app-helloperso$ make
TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100003
BOLOS_ENV=/opt/bolos
BOLOS_ENV=/opt/bolos
Prepare directories
[DEP]  dep/usbd_ioreq.d
[DEP]  dep/usbd_impl.d
[DEP]  dep/usbd_hid.d
[DEP]  dep/usbd_ctlreq.d
[DEP]  dep/usbd_core.d
[DEP]  dep/usbd_conf.d
[DEP]  dep/usbd_ccid_if.d
[DEP]  dep/usbd_ccid_core.d
[DEP]  dep/usbd_ccid_cmd.d
[DEP]  dep/u2f_io.d
[DEP]  dep/u2f_impl.d
[DEP]  dep/syscalls.d
[DEP]  dep/pic_internal.d
[DEP]  dep/pic.d
[DEP]  dep/os_printf.d
[DEP]  dep/os_io_seproxyhal.d
/opt/bolos/nanos-secure-sdk/src/os_io_seproxyhal.c:316:10: warning: TODO use real ticker event interval here instead of the x100ms
      multiplier [-W#warnings]
        #warning TODO use real ticker event interval here instead of the x100ms multiplier
         ^
1 warning generated.
[DEP]  dep/os.d
[DEP]  dep/main.d
[DEP]  dep/cx_compliance_141.d
TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100003
BOLOS_ENV=/opt/bolos
BOLOS_ENV=/opt/bolos
[CC]      obj/cx_compliance_141.o
[CC]      obj/main.o
src/main.c:513:71: error: too few arguments to function call, expected 6, have 5
    cx_hash(&u.shasha.header, CX_LAST, publicKey.W, 33, privateKeyData);
    ~~~~~~~                                                           ^
/opt/bolos/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
src/main.c:515:67: error: too few arguments to function call, expected 6, have 5
    cx_hash(&u.riprip.header, CX_LAST, privateKeyData, 32, tmp + 1);
    ~~~~~~~                                                       ^
/opt/bolos/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
src/main.c:518:63: error: too few arguments to function call, expected 6, have 5
    cx_hash(&u.shasha.header, CX_LAST, tmp, 21, privateKeyData);
    ~~~~~~~                                                   ^
/opt/bolos/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
src/main.c:520:74: error: too few arguments to function call, expected 6, have 5
    cx_hash(&u.shasha.header, CX_LAST, privateKeyData, 32, privateKeyData);
    ~~~~~~~                                                              ^
/opt/bolos/nanos-secure-sdk/include/cx.h:329:9: note: 'cx_hash' declared here
SYSCALL int cx_hash(cx_hash_t *hash PLENGTH(scc__cx_scc_struct_size_hash__hash),
        ^
4 errors generated.
make: *** [obj/main.o] Error 1

Other apps had the similar build errors. Please help to update those sample apps to be able to build on the 1.4.2 firmware. Thanks.

btchip commented 6 years ago

Can you try adding DEFINES += CX_COMPLIANCE_141 to the Makefile ? This should solve most of the build issues (also possibly missing a new parameter NULL for the cx_ecdsa_sign primitives). This will be merged shortly.

richgrove commented 6 years ago

In order to fix those errors to make the 1.4.2 compiler compatible, it's not a simple flag update. Please see the changes done in LedgerHQ/bolos-app-win_hello, in the 4 days ago. The source codes have been modified. Could you help to do so? It's easy to see those compiler errors as soon as you use the nano-1421 tag from the nano-secure-sdk repo. Thanks.

razi-rais commented 6 years ago

Facing exactly the same issue as @richgrove. I have changed the Makefile as per @btchip suggestion, but now receiving following error:

TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100003
BOLOS_ENV=/home/super/nano/
BOLOS_ENV=/home/super/nano/
[LINK] bin/app.elf
obj/main.o: In function `derive':
/home/super/nano/blue-sample-apps/blue-app-helloperso/src/main.c:513: undefined reference to `cx_hash_X'
/home/super/nano/blue-sample-apps/blue-app-helloperso/src/main.c:515: undefined reference to `cx_hash_X'
/home/super/nano/blue-sample-apps/blue-app-helloperso/src/main.c:518: undefined reference to `cx_hash_X'
/home/super/nano/blue-sample-apps/blue-app-helloperso/src/main.c:520: undefined reference to `cx_hash_X'
collect2: error: ld returned 1 exit status
/home/super/nano/nanos-secure-sdk/Makefile.rules_generic:59: recipe for target 'bin/app.elf' failed
make: *** [bin/app.elf] Error 1
rudi-cilibrasi commented 6 years ago

@razi-rais to fix that error I think you can do a make clean and then a make. I am able to build the app. Unfortunately it locks up as soon as it starts on the "Open non genuine app" screen like most (all?) sample apps. Is there a way to get samplesign OR helloperso working on 1.4.2?

hantuzun commented 6 years ago

We're second to @rudi-cilibrasi 's comment above. Exactly the same. Could somebody please shed some light on this issue please?

tzarebczan commented 6 years ago

I'm also getting stuck on "Open non genuine app" on a custom app. Any guidelines?

btchip commented 6 years ago

Please let me know if the latest modifications work

charry1729 commented 5 years ago

I'm also getting stuck on "Open non genuine app" on a custom app.