summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2022-03-30 13:06:39 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-11 20:46:05 +0000
commit73c8bc79ba1ac3b2b2b8cda828db913bee99cdba (patch)
tree3128168d0eee3f419979f3cebe1aec3285f5872f
parent402556b472e89d33c7abfdcaf8b03f739ce76cdc (diff)
downloadchrome-ec-stabilize-quickfix-14695.187.B-cr50_stab.tar.gz
Adding the encrypted cryptolib header to the RO created another match for the header magic pattern of 'fd ff ff ff'. One of the distinct properties of the fake header is filling up the signature field with 0x53 bytes, let's use this to filter out the fake header when looking for the RW. BUG=b:217564005,b:228839885 TEST=successfully processed Ti50 image with HW cryptolib included. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I83e4f7ad90ba1030ec4134db00485f10dc2fcdee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561025 Reviewed-by: Andrew Luo <aluo@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rwxr-xr-xutil/brescue.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/brescue.sh b/util/brescue.sh
index 16bf9cfbec..87fcac91d9 100755
--- a/util/brescue.sh
+++ b/util/brescue.sh
@@ -64,8 +64,11 @@ rw_offset() {
local base
src="$1"
+ # The second grep term filters out the 'fake' cryptolib header, which does
+ # not contain a valid signature, the signature field is filled with SSSSS
+ # (0x53...).
base=$(/usr/bin/od -Ax -t x1 -v "${src}" |
- grep -E '^....00 fd ff ff ff' |
+ grep -E '^....00 fd ff ff ff' | grep -v '00 fd ff ff ff 53 53 53' |
head -2 |
tail -1 |
sed 's/ .*//')