File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2+ set -e
23
34if [ -z " ${1} " -o -z " ${2} " ]
45then
4647 outfile=" ${file_prefix} _${SIGNED_SUFFIX} "
4748
4849 espsecure.py sign_data --version 2 --pub-key ${PUBKEYS} --signature ${sig_files} --output " ${outfile} " " ${infile} "
49- espsecure.py signature_info_v2 " ${outfile} "
50-
50+ digests=" "
5151 for pubkey in ${PUBKEYS}
5252 do
53+ # Verify the signature
5354 espsecure.py verify_signature --version 2 --keyfile " ${pubkey} " " ${outfile} "
54- done
55+ # Capture the signature digest
56+ digest=$( espsecure.py digest_sbv2_public_key --keyfile " ${pubkey} " -o digest.bin > /dev/null && cat digest.bin | od -A n -t x1 | tr -d ' \n' && rm -f digest.bin)
57+ digests=" $digests $digest "
58+ done
59+ # Make sure the signature digests match
60+ digests=$( echo ${digests} | tr ' ' ' \n' | sort)
61+ file_digests=$( espsecure.py signature_info_v2 " ${outfile} " | grep " Public key digest for block " | cut -d\: -f2 | sed " s/ //g" | sort)
62+ if [ " ${digests} " != " ${file_digests} " ]; then
63+ echo " mismatched digests:"
64+ echo " digests:"
65+ echo ${digests}
66+ echo " expected:"
67+ echo ${file_digests}
68+ exit 2
69+ fi
5570 done
5671
57- sha256sum " ${FILE_PREFIX} " _* _" ${SIGNED_SUFFIX} "
5872done
73+ sha256sum " ${FILE_PREFIX} " _* _" ${SIGNED_SUFFIX} "
5974
6075# Copy main fw binaries that have been signed, consistent with v1
6176cp " ${FILE_PREFIX} _ble_jade_${SIGNED_SUFFIX} " " ${BLEDIR} /jade_${SIGNED_SUFFIX} "
You can’t perform that action at this time.
0 commit comments