Skip to content
Open
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
get in (`HMGAPI_HOMELO`). The guard is checked on every pass, not only when the lease changes,
and put back first in INPUT after the stock firewall reloads; `route_localnet` is on only
while it's there.
- **HMG-API's own HTTPS** (`/data/hmgapi/lib/libhmgapi_fetch.so`, `core/fetch`): Android 4.4's
Java TLS can't reach GitHub, so the engine uses the unit's own `libssl.so` (TLS 1.2), on a
socket marked for home Wi-Fi only, with its own DNS lookup on home Wi-Fi's server. Tested
first as a mod on an Ioniq 5 US 260507 (HMG-API rc.10): the catalogue and three packages
over home Wi-Fi, each with its SHA-256. Each socket has home Wi-Fi's mark and is bound to
`wlan0`, or the call fails (never an unmarked socket on the main table's mobile data, even
before the fwmark rule is in), with 20 s send and receive timeouts (connect, the handshake,
each read). The DNS server comes from home Wi-Fi's lease (there only while its route is up,
not a leftover `dhcp.wlan0.dns1`), asked on the same kind of socket. An answer the server
didn't end with a TLS close counts only when its Content-Length or last chunk says it is
whole; chunk sizes are hex digits only (a negative one passed the cap), and a broken body
leaves no `.part`. Each call has its own answer file, opened `O_EXCL` and `O_NOFOLLOW`.

## 1.1.0 (2026-11-28)

Expand Down
19 changes: 15 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ loader() {
md5sum "$OUT/libhmgapi_hook.so"
}

fetchlib() {
# libhmgapi_fetch.so (core/fetch/fetch.c): the engine's HTTPS through the unit's own libssl; no libc
# or system headers, only dlopen/dlsym from the unit's libdl (the loader's stand-in)
sh core/loader/syslib-stubs.sh "$OUT/syslib" >/dev/null
clang --target=armv7a-linux-androideabi -mthumb -march=armv7-a -mfloat-abi=softfp -Os -fPIC \
-ffreestanding -fno-builtin -nostdlib -shared -fno-stack-protector -fno-exceptions -fno-asynchronous-unwind-tables -fuse-ld=lld \
-Wl,-z,now -Wl,--no-rosegment -Wl,--hash-style=sysv -Wl,-z,defs -Wl,--build-id=none -Wl,-soname,libhmgapi_fetch.so \
-o "$OUT/libhmgapi_fetch.so" core/fetch/fetch.c "$OUT/syslib/libdl.so"
md5sum "$OUT/libhmgapi_fetch.so"
}

runtime() {
rm -rf "$OUT/classes" "$OUT/runtime-stubs" && mkdir -p "$OUT/classes" "$OUT/runtime-stubs"
# stubs/: signatures of the car's own classes the runtime extends (compile only, never in the jar)
Expand Down Expand Up @@ -95,7 +106,7 @@ lpatch() { OUT="$OUT" sh tools/lpatch/build.sh; }
payload() {
P="$OUT/payload"
rm -rf "$P" && mkdir -p "$P"
for f in hmgapid lpatch app_process libhmgapi_hook.so hmgapi-hook.jar HmgApi.apk; do
for f in hmgapid lpatch app_process libhmgapi_hook.so libhmgapi_fetch.so hmgapi-hook.jar HmgApi.apk; do
[ -f "$OUT/$f" ] || { echo "payload: no out/$f (build it first)"; exit 1; }
cp "$OUT/$f" "$P/"
done
Expand All @@ -120,7 +131,7 @@ payload() {
(cd "$P" && find maps -type f | LC_ALL=C sort | xargs md5sum > MAPS.md5)
sed -n 's/.*HMGAPI_VERSION = "\(.*\)";/\1/p' core/runtime/java/hmgapi/engine/Engine.java > "$P/VERSION"
echo "$(git rev-parse --short HEAD 2>/dev/null || echo local)$(git diff --quiet HEAD 2>/dev/null || echo +) $(date -u +%Y-%m-%d)" > "$P/BUILD"
(cd "$P" && md5sum hmgapid lpatch app_process libhmgapi_hook.so hmgapi-hook.jar HmgApi.apk install.sh uninstall.sh lib.sh stock.txt app-pending.sh app-open.sh hook-check.sh boot.sh MAPS.md5 $(find nemesis -type f | LC_ALL=C sort) > MANIFEST)
(cd "$P" && md5sum hmgapid lpatch app_process libhmgapi_hook.so libhmgapi_fetch.so hmgapi-hook.jar HmgApi.apk install.sh uninstall.sh lib.sh stock.txt app-pending.sh app-open.sh hook-check.sh boot.sh MAPS.md5 $(find nemesis -type f | LC_ALL=C sort) > MANIFEST)
echo "payload $(cat "$P/VERSION") ($(cat "$P/BUILD")): $P"
}

Expand Down Expand Up @@ -166,11 +177,11 @@ sdk() {
}

if [ $# -eq 0 ]; then
set -- hmgapid zygote loader runtime client mods app lpatch payload
set -- hmgapid zygote loader fetchlib runtime client mods app lpatch payload
fi
for part in "$@"; do
case $part in
hmgapid|zygote|loader|runtime|client|mods|app|lpatch|payload|sdk) $part ;;
hmgapid|zygote|loader|fetchlib|runtime|client|mods|app|lpatch|payload|sdk) $part ;;
*) echo "unknown part: $part"; exit 2 ;;
esac
done
Loading
Loading