Zondax / ledger-polkadot

Polkadot app for Ledger Nano S and X
Apache License 2.0
67 stars 32 forks source link

APDU Spec has Incorrect CLA #228

Open camfairchild opened 3 months ago

camfairchild commented 3 months ago

See permalink: https://github.com/Zondax/ledger-polkadot/blob/da683ae2fc150366680a5b31bd82c2dc845eb753/docs/APDUSPEC.md

The CLA in the above APDU spec is listed as: 0x90. However, the client code in https://github.com/Zondax/ledger-substrate-js uses 0xF9 (see below):

 static _params = {
    cla: 0xf9,
    ins: { ...PolkadotGenericApp._INS } as INSGeneric,
    p1Values: { ONLY_RETRIEVE: 0x00 as 0, SHOW_ADDRESS_IN_DEVICE: 0x01 as 1 },
    chunkSize: 250,
    requiredPathLengths: [5],
  }

https://github.com/Zondax/ledger-substrate-js/blob/cc988aecb8f1d80a2f1af1c302598f5a208b1007/src/generic_app.ts#L40C10-L40C14

I take this to mean the APDU spec should be updated

:link: zboto Link

camfairchild commented 3 months ago

I can confirm this using version 100.0.5 from Ledger Live. 0x90 returns an unsupported CLA code, while 0xF9 makes the call successfully.