Skip to content

Commit 007ee44

Browse files
Merge pull request #1049 from LedgerHQ/fix-usb-u2f
[u2f]: user presence handling cannot be enable in the OS
2 parents 7fab0be + 9df70b6 commit 007ee44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib_stusb/src/usbd_ledger_hid_u2f.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,15 @@ USBD_StatusTypeDef USBD_LEDGER_HID_U2F_send_message(USBD_HandleTypeDef *pdev,
413413

414414
uint8_t cmd = 0;
415415
const uint8_t *tx_buffer = message;
416-
const uint8_t status[2] = {0x69, 0x85};
417416
uint16_t tx_length = message_length;
418417

419418
switch (packet_type) {
420419
case OS_IO_PACKET_TYPE_USB_U2F_HID_APDU:
421420
cmd = U2F_COMMAND_MSG;
421+
// Cannot enable user presence handling in the OS, see OS issues/555 for more information
422+
#ifndef HAVE_BOLOS
422423
if ((message_length == 2) && (message[0] == 0xFF) && (message[1] == 0xFF)) {
424+
const uint8_t status[2] = {0x69, 0x85};
423425
tx_buffer = status;
424426
handle->user_presence = LEDGER_HID_U2F_USER_PRESENCE_ASKING;
425427
}
@@ -431,6 +433,7 @@ USBD_StatusTypeDef USBD_LEDGER_HID_U2F_send_message(USBD_HandleTypeDef *pdev,
431433
return USBD_OK;
432434
}
433435
}
436+
#endif // !HAVE_BOLOS
434437
break;
435438

436439
case OS_IO_PACKET_TYPE_USB_U2F_HID_CBOR:
@@ -611,6 +614,8 @@ int32_t USBD_LEDGER_HID_U2F_data_ready(USBD_HandleTypeDef *pdev,
611614
USBD_LEDGER_HID_U2F_send_message(
612615
pdev, cookie, OS_IO_PACKET_TYPE_USB_U2F_HID_APDU, error_msg, 2, 0);
613616
}
617+
// Cannot enable user presence handling in the OS, see OS issues/555 for more information
618+
#ifndef HAVE_BOLOS
614619
else if (handle->user_presence == LEDGER_HID_U2F_USER_PRESENCE_ASKING) {
615620
if (handle->message_crc == crc) {
616621
error_msg[0] = 0x69;
@@ -636,6 +641,7 @@ int32_t USBD_LEDGER_HID_U2F_data_ready(USBD_HandleTypeDef *pdev,
636641
}
637642
handle->user_presence = LEDGER_HID_U2F_USER_PRESENCE_IDLE;
638643
}
644+
#endif // !HAVE_BOLOS
639645
else if (max_length < handle->transport_data.rx_message_length - 2) {
640646
error_msg[1] = CTAP1_ERR_INVALID_LENGTH;
641647
USBD_LEDGER_HID_U2F_send_message(

0 commit comments

Comments
 (0)