mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
Align rpi-eeprom-digest with usbboot
This commit is contained in:
@@ -26,6 +26,7 @@ checkDependencies() {
|
|||||||
die "sha256sum not found. Try installing the coreutilities package."
|
die "sha256sum not found. Try installing the coreutilities package."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${KEY}" ] || [ "${VERIFY}" = 1 ]; then
|
||||||
if ! command -v openssl > /dev/null; then
|
if ! command -v openssl > /dev/null; then
|
||||||
die "openssl not found. Try installing the openssl package."
|
die "openssl not found. Try installing the openssl package."
|
||||||
fi
|
fi
|
||||||
@@ -33,6 +34,7 @@ checkDependencies() {
|
|||||||
if ! command -v xxd > /dev/null; then
|
if ! command -v xxd > /dev/null; then
|
||||||
die "xxd not found. Try installing the xxd package."
|
die "xxd not found. Try installing the xxd package."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@@ -91,10 +93,9 @@ verifySig() {
|
|||||||
sig_file="${1}"
|
sig_file="${1}"
|
||||||
[ -f "${sig_file}" ] || die "Signature file ${sig_file} not found"
|
[ -f "${sig_file}" ] || die "Signature file ${sig_file} not found"
|
||||||
sig_hex="$(grep rsa2048 "${sig_file}" | cut -f 2 -d ' ')"
|
sig_hex="$(grep rsa2048 "${sig_file}" | cut -f 2 -d ' ')"
|
||||||
echo ${sig_hex} | xxd -c 4096 -p -r > "${TMP_DIR}/sig.bin"
|
|
||||||
|
|
||||||
[ -n "${sig_hex}" ] || die "No RSA signature in ${sig_file}"
|
[ -n "${sig_hex}" ] || die "No RSA signature in ${sig_file}"
|
||||||
sha256=$(sha256sum "${IMAGE}" | awk '{print $1}')
|
|
||||||
|
echo ${sig_hex} | xxd -c 4096 -p -r > "${TMP_DIR}/sig.bin"
|
||||||
"${OPENSSL}" dgst -verify "${KEY}" -signature "${TMP_DIR}/sig.bin" "${IMAGE}" || die "${IMAGE} not verified"
|
"${OPENSSL}" dgst -verify "${KEY}" -signature "${TMP_DIR}/sig.bin" "${IMAGE}" || die "${IMAGE} not verified"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user