Skip to content

Commit 9269d78

Browse files
committed
Align rpi-eeprom-digest with usbboot
1 parent 1197a4a commit 9269d78

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

rpi-eeprom-digest

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ checkDependencies() {
2626
die "sha256sum not found. Try installing the coreutilities package."
2727
fi
2828

29-
if ! command -v openssl > /dev/null; then
30-
die "openssl not found. Try installing the openssl package."
31-
fi
32-
33-
if ! command -v xxd > /dev/null; then
34-
die "xxd not found. Try installing the xxd package."
35-
fi
29+
if [ -n "${KEY}" ] || [ "${VERIFY}" = 1 ]; then
30+
if ! command -v openssl > /dev/null; then
31+
die "openssl not found. Try installing the openssl package."
32+
fi
33+
34+
if ! command -v xxd > /dev/null; then
35+
die "xxd not found. Try installing the xxd package."
36+
fi
37+
fi
3638
}
3739

3840
usage() {
@@ -91,10 +93,9 @@ verifySig() {
9193
sig_file="${1}"
9294
[ -f "${sig_file}" ] || die "Signature file ${sig_file} not found"
9395
sig_hex="$(grep rsa2048 "${sig_file}" | cut -f 2 -d ' ')"
94-
echo ${sig_hex} | xxd -c 4096 -p -r > "${TMP_DIR}/sig.bin"
95-
9696
[ -n "${sig_hex}" ] || die "No RSA signature in ${sig_file}"
97-
sha256=$(sha256sum "${IMAGE}" | awk '{print $1}')
97+
98+
echo ${sig_hex} | xxd -c 4096 -p -r > "${TMP_DIR}/sig.bin"
9899
"${OPENSSL}" dgst -verify "${KEY}" -signature "${TMP_DIR}/sig.bin" "${IMAGE}" || die "${IMAGE} not verified"
99100
}
100101

0 commit comments

Comments
 (0)