test_show_vs_verify.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash -eux
  2. # Copyright 2014 The Chromium OS Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. me=${0##*/}
  6. TMP="$me.tmp"
  7. # Work in scratch directory
  8. cd "$OUTDIR"
  9. # some stuff we'll need
  10. DEVKEYS=${SRCDIR}/tests/devkeys
  11. # The show command exits with 0 if the data is consistent.
  12. # The verify command exits with 0 only if all the data is verified.
  13. #### keyblock
  14. ${FUTILITY} show ${DEVKEYS}/firmware.keyblock
  15. if ${FUTILITY} verify ${DEVKEYS}/firmware.keyblock ; then false; fi
  16. ${FUTILITY} verify ${DEVKEYS}/firmware.keyblock \
  17. --publickey ${DEVKEYS}/root_key.vbpubk
  18. #### firmware vblock
  19. # Get some bits to look at
  20. ${FUTILITY} dump_fmap -x ${SCRIPTDIR}/data/bios_peppy_mp.bin \
  21. GBB:${TMP}.gbb VBLOCK_A:${TMP}.vblock_a FW_MAIN_A:${TMP}.fw_main_a
  22. ${FUTILITY} gbb_utility -g -k ${TMP}.rootkey ${TMP}.gbb
  23. ${FUTILITY} show ${TMP}.vblock_a
  24. ${FUTILITY} show ${TMP}.vblock_a --publickey ${TMP}.rootkey
  25. ${FUTILITY} show ${TMP}.vblock_a \
  26. --publickey ${TMP}.rootkey \
  27. --fv ${TMP}.fw_main_a
  28. if ${FUTILITY} verify ${TMP}.vblock_a ; then false ; fi
  29. if ${FUTILITY} verify ${TMP}.vblock_a \
  30. --publickey ${TMP}.rootkey ; then false ; fi
  31. ${FUTILITY} verify ${TMP}.vblock_a \
  32. --publickey ${TMP}.rootkey \
  33. --fv ${TMP}.fw_main_a
  34. #### kernel partition
  35. ${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin
  36. ${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin \
  37. --publickey ${DEVKEYS}/kernel_subkey.vbpubk
  38. ${FUTILITY} show ${SCRIPTDIR}/data/rec_kernel_part.bin \
  39. --publickey ${DEVKEYS}/recovery_key.vbpubk
  40. if ${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin ; then false ; fi
  41. if ${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin \
  42. --publickey ${DEVKEYS}/kernel_subkey.vbpubk ; then false ; fi
  43. ${FUTILITY} verify ${SCRIPTDIR}/data/rec_kernel_part.bin \
  44. --publickey ${DEVKEYS}/recovery_key.vbpubk
  45. # cleanup
  46. rm -rf ${TMP}*
  47. exit 0