From a32e86ffd4b675264839803ece089f0428257193 Mon Sep 17 00:00:00 2001 From: Charles-Edouard de la Vergne Date: Fri, 2 Aug 2024 16:43:08 +0200 Subject: [PATCH] Return a dedicated error if Ledger-PKI APDU received but feature not enabled --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index 38876d7..8478e0d 100644 --- a/src/main.c +++ b/src/main.c @@ -150,6 +150,15 @@ void handleApdu(unsigned int *flags, unsigned int *tx) { BEGIN_TRY { TRY { +#ifndef HAVE_LEDGER_PKI + if ((G_io_apdu_buffer[OFFSET_CLA] == 0xB0 && (G_io_apdu_buffer[OFFSET_INS] == 0x06))) { + // Ledger-PKI APDU not yet caught by the running OS. + // Command code not supported + PRINTF("Ledger-PKI not yet supported!\n"); + THROW(0x911C); + } +#endif // HAVE_LEDGER_PKI + if (G_io_apdu_buffer[OFFSET_CLA] != CLA) { THROW(0x6E00); }