Skip to content

Commit

Permalink
Merge pull request #561 from LedgerHQ/cev/remove_wallet_id
Browse files Browse the repository at this point in the history
Remove old WALLET_ID support
  • Loading branch information
cedelavergne-ledger authored Mar 28, 2024
2 parents a84d4f5 + 4330654 commit cef5d2c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 45 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ else
DEFINES += HAVE_BAGL
DEFINES += HAVE_UX_FLOW
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_WALLET_ID_SDK
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=32
else
DEFINES += HAVE_GLO096
Expand Down
3 changes: 1 addition & 2 deletions src/apdu_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
#define P2_EIP712_LEGACY_IMPLEM 0x00
#define P2_EIP712_FULL_IMPLEM 0x01

#define COMMON_CLA 0xB0
#define COMMON_INS_GET_WALLET_ID 0x04
#define COMMON_CLA 0xB0

#define APDU_RESPONSE_OK 0x9000
#define APDU_RESPONSE_ERROR_NO_INFO 0x6a00
Expand Down
42 changes: 0 additions & 42 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,38 +130,6 @@ extraInfo_t *getKnownToken(uint8_t *contractAddress) {
return NULL;
}

#ifndef HAVE_WALLET_ID_SDK

unsigned int const U_os_perso_seed_cookie[] = {
0xda7aba5e,
0xc1a551c5,
};

void handleGetWalletId(volatile unsigned int *tx) {
unsigned char t[64];
cx_ecfp_256_private_key_t priv;
cx_ecfp_256_public_key_t pub;
// seed => pubkey
CX_ASSERT(bip32_derive_with_seed_init_privkey_256(HDW_NORMAL,
CX_CURVE_256K1,
U_os_perso_seed_cookie,
2,
&priv,
NULL,
NULL,
0));
// priv key => pubkey
CX_ASSERT(cx_ecfp_generate_pair_no_throw(CX_CURVE_256K1, &pub, &priv, 1));
// pubkey -> sha512
cx_hash_sha512(pub.W, sizeof(pub.W), t, sizeof(t));
// ! cookie !
memmove(G_io_apdu_buffer, t, 64);
*tx = 64;
THROW(0x9000);
}

#endif // HAVE_WALLET_ID_SDK

const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32) {
if (*dataLength < 1) {
PRINTF("Invalid data\n");
Expand Down Expand Up @@ -197,16 +165,6 @@ void handleApdu(unsigned int *flags, unsigned int *tx) {

BEGIN_TRY {
TRY {
#ifndef HAVE_WALLET_ID_SDK

if ((G_io_apdu_buffer[OFFSET_CLA] == COMMON_CLA) &&
(G_io_apdu_buffer[OFFSET_INS] == COMMON_INS_GET_WALLET_ID)) {
handleGetWalletId(tx);
return;
}

#endif // HAVE_WALLET_ID_SDK

if (G_io_apdu_buffer[OFFSET_CLA] != CLA) {
THROW(0x6E00);
}
Expand Down

0 comments on commit cef5d2c

Please sign in to comment.