build(deps): fix pkg-config skew, libusb include, libplist/libirecovery drift
Sync PKGCONFIG_DEPS with Makefile (add libcurl); normalize <libusb.h> include across 6 files; add compat shims for libplist 2.2/2.3 and libirecovery IRECV_SEND_OPT_DFU_NOTIFY_FINISH; add pacman/zypper/apk installer branches; drop bogus info->pid read in path_b_identity.c in favor of irecv_get_mode(). Extend the mock libirecovery to expose irecv_get_mode() so the mock test build keeps passing against the new call site. Add Makefile compile canaries that emit -DTP_PLIST_HAS_MEM_FREE, -DTP_PLIST_HAS_FMT_ARG, and -DTP_IRECV_HAS_NOTIFY_FINISH plus a .build-flags diagnostic file consumed by tr4mpass doctor. Files modified: - Makefile - start.sh - start-helpers.sh - include/compat/plist_compat.h (new) - include/compat/libirecovery_compat.h (new) - include/util/usb_helpers.h - include/util/plist_helpers.h - include/exploit/dfu_proto.h - include/device/device.h - include/device/usb_dfu.h - include/activation/activation.h - include/activation/record.h - src/bypass/path_b_identity.c - src/bypass/path_b.c - src/bypass/path_a_ramdisk.c - src/activation/session_online.c - tests/mocks/mock_irecv_sym.c - .gitignore Closes: #70, #74, #67, #54, #51, #44, #21, #55, #31, #24, #19
This commit is contained in:
parent
d18b57a66f
commit
9bd1a75b2d
18 changed files with 257 additions and 47 deletions
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <plist/plist.h>
|
||||
#include "compat/plist_compat.h"
|
||||
#include <libimobiledevice/libimobiledevice.h>
|
||||
#include <libimobiledevice/mobileactivation.h>
|
||||
#include "device/device.h"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#define RECORD_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <plist/plist.h>
|
||||
#include "compat/plist_compat.h"
|
||||
#include <libimobiledevice/lockdown.h>
|
||||
#include "device/device.h"
|
||||
|
||||
|
|
|
|||
28
include/compat/libirecovery_compat.h
Normal file
28
include/compat/libirecovery_compat.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef TP_LIBIRECOVERY_COMPAT_H
|
||||
#define TP_LIBIRECOVERY_COMPAT_H
|
||||
|
||||
/*
|
||||
* libirecovery_compat.h -- libirecovery API drift shim.
|
||||
*
|
||||
* Older libirecovery releases lacked IRECV_SEND_OPT_DFU_NOTIFY_FINISH,
|
||||
* the send-flag that instructs irecv_send_file() to terminate a DFU
|
||||
* transfer with a zero-length packet. The Makefile probes for the
|
||||
* symbol and passes -DTP_IRECV_HAS_NOTIFY_FINISH when present.
|
||||
*
|
||||
* When absent we provide a no-op flag value and set
|
||||
* TP_IRECV_NEEDS_MANUAL_ZLP=1 so callers can send the ZLP by hand
|
||||
* after irecv_send_file() returns.
|
||||
*/
|
||||
|
||||
#include <libirecovery.h>
|
||||
|
||||
#ifdef TP_IRECV_HAS_NOTIFY_FINISH
|
||||
#define TP_IRECV_NEEDS_MANUAL_ZLP 0
|
||||
#else
|
||||
#ifndef IRECV_SEND_OPT_DFU_NOTIFY_FINISH
|
||||
#define IRECV_SEND_OPT_DFU_NOTIFY_FINISH 0
|
||||
#endif
|
||||
#define TP_IRECV_NEEDS_MANUAL_ZLP 1
|
||||
#endif
|
||||
|
||||
#endif /* TP_LIBIRECOVERY_COMPAT_H */
|
||||
59
include/compat/plist_compat.h
Normal file
59
include/compat/plist_compat.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#ifndef TP_PLIST_COMPAT_H
|
||||
#define TP_PLIST_COMPAT_H
|
||||
|
||||
/*
|
||||
* plist_compat.h -- libplist API drift shim.
|
||||
*
|
||||
* libplist 2.3.0 introduced plist_mem_free() and expanded
|
||||
* plist_from_memory() to a 4-arg form that also reports the parsed
|
||||
* format. Older distros still ship 2.2.x, so we detect both at build
|
||||
* time. The Makefile runs compile canaries and passes
|
||||
* -DTP_PLIST_HAS_MEM_FREE / -DTP_PLIST_HAS_FMT_ARG when the installed
|
||||
* header provides them; the header falls back otherwise.
|
||||
*
|
||||
* Callers should:
|
||||
* - free plist-allocated buffers via plist_mem_free() (falls back
|
||||
* to free() when the symbol is unavailable)
|
||||
* - parse in-memory plists via tp_plist_from_memory(), which maps
|
||||
* to the 3-arg or 4-arg form as detected at build time.
|
||||
*/
|
||||
|
||||
#include <plist/plist.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef TP_PLIST_HAS_MEM_FREE
|
||||
/* Pre-2.3: no plist_mem_free(); libplist used plain malloc/free. */
|
||||
#ifndef plist_mem_free
|
||||
#define plist_mem_free(p) free(p)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static inline void tp_plist_mem_free(void *p)
|
||||
{
|
||||
if (p) plist_mem_free(p);
|
||||
}
|
||||
|
||||
#ifdef TP_PLIST_HAS_FMT_ARG
|
||||
/* 4-arg form: (data, length, out, format_out). */
|
||||
static inline int tp_plist_from_memory(const char *data,
|
||||
uint32_t length,
|
||||
plist_t *out,
|
||||
plist_format_t *fmt_out)
|
||||
{
|
||||
return (int)plist_from_memory(data, length, out, fmt_out);
|
||||
}
|
||||
#else
|
||||
/* Pre-2.3: 3-arg form; format_out is ignored because the older
|
||||
* API cannot report the parsed format.
|
||||
*/
|
||||
static inline int tp_plist_from_memory(const char *data,
|
||||
uint32_t length,
|
||||
plist_t *out,
|
||||
void *fmt_out)
|
||||
{
|
||||
(void)fmt_out;
|
||||
return (int)plist_from_memory(data, length, out);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TP_PLIST_COMPAT_H */
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include <stdint.h>
|
||||
#include <libimobiledevice/libimobiledevice.h>
|
||||
#include <libimobiledevice/lockdown.h>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include <libusb.h>
|
||||
|
||||
#define DEVICE_FIELD_LEN 128
|
||||
#define DEVICE_UDID_LEN 64
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include <libusb.h>
|
||||
|
||||
/* Apple USB identifiers */
|
||||
#define APPLE_VID 0x05AC
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include <libusb.h>
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* DFU class-specific request codes (USB DFU 1.1 spec, Table 3.2) */
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define PLIST_HELPERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <plist/plist.h>
|
||||
#include "compat/plist_compat.h"
|
||||
|
||||
/*
|
||||
* Retrieve a string value from a plist dict by key.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define USB_HELPERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include <libusb.h>
|
||||
|
||||
/*
|
||||
* Perform a USB control transfer with a data stage.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue