Minor fixes after review
This commit is contained in:
@@ -58,6 +58,9 @@
|
||||
#define OFFSET_LC 4
|
||||
#define OFFSET_CDATA 5
|
||||
|
||||
#define ERR_APDU_EMPTY 0x6982
|
||||
#define ERR_APDU_SIZE_MISMATCH 0x6983
|
||||
|
||||
void handleGetPublicKey(uint8_t p1,
|
||||
uint8_t p2,
|
||||
const uint8_t *dataBuffer,
|
||||
|
||||
@@ -770,9 +770,11 @@ void app_main(void) {
|
||||
// no apdu received, well, reset the session, and reset the
|
||||
// bootloader configuration
|
||||
if (rx == 0) {
|
||||
THROW(0x6982);
|
||||
THROW(ERR_APDU_EMPTY);
|
||||
}
|
||||
if (rx > OFFSET_LC && rx != (G_io_apdu_buffer[OFFSET_LC] + 5)) {
|
||||
THROW(ERR_APDU_SIZE_MISMATCH);
|
||||
}
|
||||
PRINTF("New APDU received:\n%.*H\n", rx, G_io_apdu_buffer);
|
||||
|
||||
handleApdu(&flags, &tx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user