summaryrefslogtreecommitdiff
path: root/tests/futility/test_gbb_utility.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/futility/test_gbb_utility.sh')
-rwxr-xr-xtests/futility/test_gbb_utility.sh106
1 files changed, 53 insertions, 53 deletions
diff --git a/tests/futility/test_gbb_utility.sh b/tests/futility/test_gbb_utility.sh
index 3dc7d351..58855711 100755
--- a/tests/futility/test_gbb_utility.sh
+++ b/tests/futility/test_gbb_utility.sh
@@ -15,20 +15,20 @@ REPLACE="${BUILD_RUN}/tests/futility/binary_editor"
# First, let's test the basic functionality
# For simplicity, we'll use the same size for all properties.
-${FUTILITY} gbb_utility -c 16,0x10,16,0x10 ${TMP}.blob
+${FUTILITY} gbb -c 16,0x10,16,0x10 ${TMP}.blob
# Flags
-${FUTILITY} gbb_utility -s --flags=0xdeadbeef ${TMP}.blob
-${FUTILITY} gbb_utility -g --flags ${TMP}.blob | grep -i 0xdeadbeef
+${FUTILITY} gbb -s --flags=0xdeadbeef ${TMP}.blob
+${FUTILITY} gbb -g --flags ${TMP}.blob | grep -i 0xdeadbeef
# HWID length should include the terminating null - this is too long
-if ${FUTILITY} gbb_utility -s --hwid="0123456789ABCDEF" ${TMP}.blob; then
+if ${FUTILITY} gbb -s --hwid="0123456789ABCDEF" ${TMP}.blob; then
false;
fi
# This works
-${FUTILITY} gbb_utility -s --hwid="0123456789ABCDE" ${TMP}.blob
+${FUTILITY} gbb -s --hwid="0123456789ABCDE" ${TMP}.blob
# Read it back?
-${FUTILITY} gbb_utility -g ${TMP}.blob | grep "0123456789ABCDE"
+${FUTILITY} gbb -g ${TMP}.blob | grep "0123456789ABCDE"
# Same kind of tests for the other fields, but they need binary files.
@@ -36,20 +36,20 @@ ${FUTILITY} gbb_utility -g ${TMP}.blob | grep "0123456789ABCDE"
dd if=/dev/urandom bs=17 count=1 of=${TMP}.data1.toolong
dd if=/dev/urandom bs=17 count=1 of=${TMP}.data2.toolong
dd if=/dev/urandom bs=17 count=1 of=${TMP}.data3.toolong
-if ${FUTILITY} gbb_utility -s --rootkey ${TMP}.data1.toolong ${TMP}.blob; then false; fi
-if ${FUTILITY} gbb_utility -s --recoverykey ${TMP}.data2.toolong ${TMP}.blob; then false; fi
-if ${FUTILITY} gbb_utility -s --bmpfv ${TMP}.data3.toolong ${TMP}.blob; then false; fi
+if ${FUTILITY} gbb -s --rootkey ${TMP}.data1.toolong ${TMP}.blob; then false; fi
+if ${FUTILITY} gbb -s --recoverykey ${TMP}.data2.toolong ${TMP}.blob; then false; fi
+if ${FUTILITY} gbb -s --bmpfv ${TMP}.data3.toolong ${TMP}.blob; then false; fi
# shorter than max should be okay, though
dd if=/dev/urandom bs=10 count=1 of=${TMP}.data1.short
dd if=/dev/urandom bs=10 count=1 of=${TMP}.data2.short
dd if=/dev/urandom bs=10 count=1 of=${TMP}.data3.short
-${FUTILITY} gbb_utility -s \
+${FUTILITY} gbb -s \
--rootkey ${TMP}.data1.short \
--recoverykey ${TMP}.data2.short \
--bmpfv ${TMP}.data3.short ${TMP}.blob
# read 'em back
-${FUTILITY} gbb_utility -g \
+${FUTILITY} gbb -g \
--rootkey ${TMP}.read1 \
--recoverykey ${TMP}.read2 \
--bmpfv ${TMP}.read3 ${TMP}.blob
@@ -62,14 +62,14 @@ cmp -n 10 ${TMP}.data3.short ${TMP}.read3
dd if=/dev/urandom bs=16 count=1 of=${TMP}.data1
dd if=/dev/urandom bs=16 count=1 of=${TMP}.data2
dd if=/dev/urandom bs=16 count=1 of=${TMP}.data3
-${FUTILITY} gbb_utility -s --rootkey ${TMP}.data1 ${TMP}.blob
-${FUTILITY} gbb_utility -s --recoverykey ${TMP}.data2 ${TMP}.blob
-${FUTILITY} gbb_utility -s --bmpfv ${TMP}.data3 ${TMP}.blob
+${FUTILITY} gbb -s --rootkey ${TMP}.data1 ${TMP}.blob
+${FUTILITY} gbb -s --recoverykey ${TMP}.data2 ${TMP}.blob
+${FUTILITY} gbb -s --bmpfv ${TMP}.data3 ${TMP}.blob
# Read 'em back.
-${FUTILITY} gbb_utility -g --rootkey ${TMP}.read1 ${TMP}.blob
-${FUTILITY} gbb_utility -g --recoverykey ${TMP}.read2 ${TMP}.blob
-${FUTILITY} gbb_utility -g --bmpfv ${TMP}.read3 ${TMP}.blob
+${FUTILITY} gbb -g --rootkey ${TMP}.read1 ${TMP}.blob
+${FUTILITY} gbb -g --recoverykey ${TMP}.read2 ${TMP}.blob
+${FUTILITY} gbb -g --bmpfv ${TMP}.read3 ${TMP}.blob
# Verify
cmp ${TMP}.data1 ${TMP}.read1
cmp ${TMP}.data2 ${TMP}.read2
@@ -110,98 +110,98 @@ cmp ${TMP}.data3 ${TMP}.read3
# bad major_version
cat ${TMP}.blob | ${REPLACE} 0x4 2 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# header size too large
cat ${TMP}.blob | ${REPLACE} 0x8 0x81 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# header size too small
cat ${TMP}.blob | ${REPLACE} 0x8 0x7f > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# HWID not null-terminated is invalid
cat ${TMP}.blob | ${REPLACE} 0x8f 0x41 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# HWID of length zero is okay
cat ${TMP}.blob | ${REPLACE} 0x14 0x00 > ${TMP}.blob.ok
-${FUTILITY} gbb_utility ${TMP}.blob.ok
+${FUTILITY} gbb ${TMP}.blob.ok
# And HWID of length 1 consisting only of '\0' is okay, too.
cat ${TMP}.blob | ${REPLACE} 0x14 0x01 | ${REPLACE} 0x80 0x00 > ${TMP}.blob.ok
-${FUTILITY} gbb_utility ${TMP}.blob.ok
+${FUTILITY} gbb ${TMP}.blob.ok
# zero-length HWID not null-terminated is invalid
cat ${TMP}.blob | ${REPLACE} 0x8f 0x41 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# hwid_offset < GBB_HEADER_SIZE is invalid
cat ${TMP}.blob | ${REPLACE} 0x10 0x7f > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
cat ${TMP}.blob | ${REPLACE} 0x10 0x00 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# rootkey_offset < GBB_HEADER_SIZE is invalid
cat ${TMP}.blob | ${REPLACE} 0x18 0x7f > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
cat ${TMP}.blob | ${REPLACE} 0x18 0x00 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# bmpfv_offset < GBB_HEADER_SIZE is invalid
cat ${TMP}.blob | ${REPLACE} 0x20 0x7f > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
cat ${TMP}.blob | ${REPLACE} 0x20 0x00 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# recovery_key_offset < GBB_HEADER_SIZE is invalid
cat ${TMP}.blob | ${REPLACE} 0x28 0x7f > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
cat ${TMP}.blob | ${REPLACE} 0x28 0x00 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb ${TMP}.blob.bad; then false; fi
# hwid: offset + size == end of file is okay; beyond is invalid
cat ${TMP}.blob | ${REPLACE} 0x14 0x40 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g ${TMP}.blob.bad
+${FUTILITY} gbb -g ${TMP}.blob.bad
cat ${TMP}.blob | ${REPLACE} 0x14 0x41 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -g ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb -g ${TMP}.blob.bad; then false; fi
# rootkey: offset + size == end of file is okay; beyond is invalid
cat ${TMP}.blob | ${REPLACE} 0x1c 0x30 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g ${TMP}.blob.bad
+${FUTILITY} gbb -g ${TMP}.blob.bad
cat ${TMP}.blob | ${REPLACE} 0x1c 0x31 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -g ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb -g ${TMP}.blob.bad; then false; fi
# bmpfv: offset + size == end of file is okay; beyond is invalid
cat ${TMP}.blob | ${REPLACE} 0x24 0x20 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g ${TMP}.blob.bad
+${FUTILITY} gbb -g ${TMP}.blob.bad
cat ${TMP}.blob | ${REPLACE} 0x24 0x21 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -g ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb -g ${TMP}.blob.bad; then false; fi
# recovery_key: offset + size == end of file is okay; beyond is invalid
cat ${TMP}.blob | ${REPLACE} 0x2c 0x10 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g ${TMP}.blob.bad
+${FUTILITY} gbb -g ${TMP}.blob.bad
cat ${TMP}.blob | ${REPLACE} 0x2c 0x11 > ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -g ${TMP}.blob.bad; then false; fi
+if ${FUTILITY} gbb -g ${TMP}.blob.bad; then false; fi
# hwid_size == 0 doesn't complain, but can't be set
cat ${TMP}.blob | ${REPLACE} 0x14 0x00 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -s --hwid="A" ${TMP}.blob.bad; then false; fi
+${FUTILITY} gbb -g ${TMP}.blob.bad
+if ${FUTILITY} gbb -s --hwid="A" ${TMP}.blob.bad; then false; fi
# rootkey_size == 0 gives warning, gets nothing, can't be set
cat ${TMP}.blob | ${REPLACE} 0x1c 0x00 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g --rootkey ${TMP}.read1 ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -s --rootkey ${TMP}.data1 ${TMP}.blob.bad; then false; fi
+${FUTILITY} gbb -g --rootkey ${TMP}.read1 ${TMP}.blob.bad
+if ${FUTILITY} gbb -s --rootkey ${TMP}.data1 ${TMP}.blob.bad; then false; fi
# bmpfv_size == 0 gives warning, gets nothing, can't be set
cat ${TMP}.blob | ${REPLACE} 0x24 0x00 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g --bmpfv ${TMP}.read3 ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -s --bmpfv ${TMP}.data3 ${TMP}.blob.bad; then false; fi
+${FUTILITY} gbb -g --bmpfv ${TMP}.read3 ${TMP}.blob.bad
+if ${FUTILITY} gbb -s --bmpfv ${TMP}.data3 ${TMP}.blob.bad; then false; fi
# recovery_key_size == 0 gives warning, gets nothing, can't be set
cat ${TMP}.blob | ${REPLACE} 0x2c 0x00 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g --recoverykey ${TMP}.read2 ${TMP}.blob.bad
-if ${FUTILITY} gbb_utility -s --recoverykey ${TMP}.data2 ${TMP}.blob.bad; then false; fi
+${FUTILITY} gbb -g --recoverykey ${TMP}.read2 ${TMP}.blob.bad
+if ${FUTILITY} gbb -s --recoverykey ${TMP}.data2 ${TMP}.blob.bad; then false; fi
# GBB v1.2 adds a sha256 digest field in what was previously padding:
@@ -215,20 +215,20 @@ if ${FUTILITY} gbb_utility -s --recoverykey ${TMP}.data2 ${TMP}.blob.bad; then f
# See that the digest is updated properly.
hwid="123456789ABCDEF"
-${FUTILITY} gbb_utility -s --hwid=${hwid} ${TMP}.blob
+${FUTILITY} gbb -s --hwid=${hwid} ${TMP}.blob
expect=$(echo -n "$hwid" | sha256sum | cut -d ' ' -f 1)
[ $(echo -n ${expect} | wc -c) == "64" ]
-${FUTILITY} gbb_utility -g --digest ${TMP}.blob | grep ${expect}
+${FUTILITY} gbb -g --digest ${TMP}.blob | grep ${expect}
# Garble the digest, see that it's noticed.
# (assuming these zeros aren't present)
cat ${TMP}.blob | ${REPLACE} 0x33 0x00 0x00 0x00 0x00 0x00 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g --digest ${TMP}.blob.bad | grep '0000000000'
-${FUTILITY} gbb_utility -g --digest ${TMP}.blob.bad | grep 'invalid'
+${FUTILITY} gbb -g --digest ${TMP}.blob.bad | grep '0000000000'
+${FUTILITY} gbb -g --digest ${TMP}.blob.bad | grep 'invalid'
# Garble the HWID. The digest is unchanged, but now invalid.
cat ${TMP}.blob | ${REPLACE} 0x84 0x70 0x71 0x72 > ${TMP}.blob.bad
-${FUTILITY} gbb_utility -g --digest ${TMP}.blob.bad | grep 'invalid'
+${FUTILITY} gbb -g --digest ${TMP}.blob.bad | grep 'invalid'
# cleanup
rm -f ${TMP}*