Skip to content

Commit 11c5d27

Browse files
committed
fix(vbhash,deps): variant-aware boothash and resetprop-rs as git dep
prop.sh blindly trusted boot_hash.bin from any TrickyStore variant, including forks without boothash persistence. Now checks module.prop for TEESimulator-RS before deferring, with early validation and fallback to our own /data/adb/boot_hash if the file is invalid. Switches resetprop-rs from a vendored submodule to a cargo git dependency so builds always pull the latest commit.
1 parent 1951ba0 commit 11c5d27

5 files changed

Lines changed: 22 additions & 10 deletions

File tree

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

external/resetprop-rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

prop.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,32 @@ contains_reset_prop "vendor.boot.bootmode" "recovery" "unknown"
101101
contains_reset_prop "vendor.boot.mode" "recovery" "unknown"
102102

103103
if [ "$_ZEROMOUNT_ACTIVE" != "true" ]; then
104-
# VBMeta digest — prefer TEESimulator's persisted value, fall back to ours
105104
_hash_src=""
106105
hash_value=""
107-
if [ -f "$TS_DIR/boot_hash.bin" ]; then
106+
107+
# only defer to boot_hash.bin when our TEESimulator variant is active
108+
_ts_mod="/data/adb/modules/tricky_store"
109+
_ts_mp=$(cat "$_ts_mod/module.prop" 2>/dev/null)
110+
_teesim_ok=false
111+
case "$_ts_mp" in
112+
*TEESimulator-RS*)
113+
[ -d "$_ts_mod" ] && [ ! -f "$_ts_mod/disable" ] && [ ! -f "$_ts_mod/remove" ] && _teesim_ok=true ;;
114+
esac
115+
116+
if [ "$_teesim_ok" = "true" ] && [ -f "$TS_DIR/boot_hash.bin" ]; then
108117
hash_value=$(od -A n -t x1 "$TS_DIR/boot_hash.bin" 2>/dev/null | tr -d ' \n')
109-
[ -n "$hash_value" ] && _hash_src="teesim"
118+
if echo "$hash_value" | grep -qE '^[a-f0-9]{64}$'; then
119+
_hash_src="teesim"
120+
else
121+
hash_value=""
122+
fi
110123
fi
124+
111125
if [ -z "$hash_value" ] && [ -f "/data/adb/boot_hash" ]; then
112126
hash_value=$(grep -v '^#' "/data/adb/boot_hash" 2>/dev/null | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
113127
[ -n "$hash_value" ] && _hash_src="boot_hash"
114128
fi
129+
115130
if echo "$hash_value" | grep -qE '^[a-f0-9]{64}$'; then
116131
if resetprop -n ro.boot.vbmeta.digest "$hash_value" 2>/dev/null; then
117132
_PROP_SPOOF_COUNT=$((_PROP_SPOOF_COUNT + 1))

rust/Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ring = "0.17"
2020
rcgen = { version = "0.12", default-features = false, features = ["pem", "ring"] }
2121
rsa = { version = "0.9", default-features = false, features = ["std", "pem"] }
2222
rand = "0.8"
23-
resetprop = { path = "../external/resetprop-rs/crates/resetprop" }
23+
resetprop = { git = "https://github.com/Enginex0/resetprop-rs" }
2424

2525
[profile.dev]
2626
strip = false

0 commit comments

Comments
 (0)