Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Problem Installing Hello World Application - "Invalid sequence" #7

@davereikher

Description

@davereikher

I've recently upgraded the firmware on my Ledger Nano S to 1.4.1. When I'm trying to install the blue-app-helloworld app using make load, I get the following error:

(ledger) ➜  blue-app-helloworld git:(master) make load
TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100003
BOLOS_ENV=/home/dave/ledger/bolos_env
python -m ledgerblue.loadApp --appFlags 0x00 --tlv --targetId 0x31100003 --delete --fileName bin/app.hex --appName "Hello World" --appVersion 1.0.0 --dataSize `cat debug/app.map |grep _nvram_data_size | tr -s ' ' | cut -f2 -d' '` `ICONHEX=\`python /home/dave/ledger/nanos-secure-sdk/icon.py  hexbitmaponly 2>/dev/null\` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"` 
usage: loadApp.py [-h] [--targetId TARGETID] [--fileName FILENAME]
                  [--icon ICON] [--curve CURVE] [--path PATH]
                  [--appName APPNAME] [--signature SIGNATURE]
                  [--appFlags APPFLAGS] [--bootAddr BOOTADDR]
                  [--rootPrivateKey ROOTPRIVATEKEY] [--apdu] [--deployLegacy]
                  [--apilevel APILEVEL] [--delete] [--params]
                  [--appVersion APPVERSION]
loadApp.py: error: unrecognized arguments: --tlv --dataSize 0x00000000
Makefile:73: recipe for target 'load' failed
make: *** [load] Error 2

Also, when compiling manually and trying to install the app.hex binary in the bin folder, I get the following:

(ledger) ➜  bin git:(master) ✗ python -m ledgerblue.loadApp --targetId 0x31100003 --apdu --fileName app.hex --appName Hworld --appFlags 0x00 --icon ""
Generated random root public key : b'04d4f1df62b1ef928edc989d6601004505c8927709fafc74ecff4a237edc8761eb05bf4db8505f40fd9d0e6d518893bedf02680b905118d9f7e96b6a9d07f48d00'
=> e00400000431100003
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/loadApp.py", line 164, in <module>
    secret = getDeployedSecretV2(dongle, bytearray.fromhex(args.rootPrivateKey), args.targetId)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/deployed.py", line 85, in getDeployedSecretV2
    dongle.exchange(apdu)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/comm.py", line 116, in exchange
    response = unwrapResponseAPDU(0x0101, result, 64)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/ledgerWrapper.py", line 76, in unwrapResponseAPDU
    raise CommException("Invalid sequence")
ledgerblue.commException.CommException: Exception : Invalid sequence

I've printed the data argument at the beginning of the unwrapResponseAPDU method and it contains this bytearray:
bytearray(b'\x01\x01\x05\x00\xbf\x00\x01\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
so \x01\x01 is the channel, \x05 is the tag and \x00\xbf is the sequence, which is supposed to be 0, but it's not, so it fails.

The same happens with the checkGenuine script:

(ledger) ➜  bin git:(master) python -m ledgerblue.checkGenuine --targetId 0x31100003 --apdu                                                         
=> e00400000431100003
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/checkGenuine.py", line 129, in <module>
    secret = getDeployedSecretV2(dongle, bytearray.fromhex(args.rootPrivateKey), args.targetId, args.issuerKey)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/checkGenuine.py", line 40, in getDeployedSecretV2
    dongle.exchange(apdu)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/comm.py", line 116, in exchange
    response = unwrapResponseAPDU(0x0101, result, 64)
  File "/home/dave/ledger/ledger/lib/python3.5/site-packages/ledgerblue/ledgerWrapper.py", line 76, in unwrapResponseAPDU
    raise CommException("Invalid sequence")
ledgerblue.commException.CommException: Exception : Invalid sequence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions