summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@google.com>2018-03-14 13:21:24 -0700
committerMichael Halcrow <mhalcrow@google.com>2018-03-14 13:21:24 -0700
commitc00f862be77e6cb5b6f2feb3f38013ee8fd7d223 (patch)
tree708af673537aa009bde87b3403e7edfc0c44ef93
parente1570d21c879e3320bfca60447ea52b018f7adc7 (diff)
downloadfsverity-c00f862be77e6cb5b6f2feb3f38013ee8fd7d223.tar.gz
Complete mkfsverity.sh script so that we get a final executable test
script for the file size in question. Signed-off-by: Michael Halcrow <mhalcrow@google.com>
-rwxr-xr-xfsveritysetup.py2
-rwxr-xr-xfull-run-fsverity.sh2
-rwxr-xr-xmkfsverity.sh8
3 files changed, 8 insertions, 4 deletions
diff --git a/fsveritysetup.py b/fsveritysetup.py
index 69306ed..c386068 100755
--- a/fsveritysetup.py
+++ b/fsveritysetup.py
@@ -393,7 +393,7 @@ class FSVerityGenerator(object):
# Finish the output file by writing the header offset field.
hdr_offset = HeaderOffset()
- hdr_offset.hdr_offset = len(header) + len(extensions)
+ hdr_offset.hdr_offset = len(header) + len(extensions) + ctypes.sizeof(hdr_offset)
outfile.write(serialize_struct(hdr_offset))
# Compute the fs-verity measurement.
diff --git a/full-run-fsverity.sh b/full-run-fsverity.sh
index 33d286e..14bb3dc 100755
--- a/full-run-fsverity.sh
+++ b/full-run-fsverity.sh
@@ -7,7 +7,7 @@ dd if=/dev/zero of=/root/f2fs.img seek=$(($1<16384000?128000:$1/128)) bs=512 cou
mount -o loop /root/f2fs.img /mnt/f2fs
cp /root/output-$1.apk /mnt/f2fs/output-$1.apk
make
-./fsverityset /mnt/f2fs/output-$1.apk $1
+./fsverityset /mnt/f2fs/output-$1.apk
./fsveritymeasure /mnt/f2fs/output-$1.apk $2
sync
echo 3 > /proc/sys/vm/drop_caches
diff --git a/mkfsverity.sh b/mkfsverity.sh
index 85dc55c..426981d 100755
--- a/mkfsverity.sh
+++ b/mkfsverity.sh
@@ -88,5 +88,9 @@ done
cmd+=("${ELISIONS[@]/#/--elide=}")
-echo "${cmd[@]}"
-"${cmd[@]}"
+TORUN="${cmd[@]}"
+OUTPUT="$($TORUN)"
+MEASUREMENT=`echo ${OUTPUT} | grep -o -w -E '[[:alnum:]]{64}' | sed -n 2p`
+echo "#!/bin/sh" > ${SIZE}.sh
+echo "./full-run-fsverity.sh ${SIZE} ${MEASUREMENT}" >> ${SIZE}.sh
+chmod 755 ${SIZE}.sh