test_show_usbpd1.sh 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash -eux
  2. # Copyright 2015 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. DATADIR="${SCRIPTDIR}/data"
  10. TESTS="dingdong hoho minimuffin zinger"
  11. TESTKEYS=${SRCDIR}/tests/testkeys
  12. SIGS="1024 2048 4096 8192"
  13. HASHES="SHA1 SHA256 SHA512"
  14. set -o pipefail
  15. for s in $SIGS; do
  16. echo -n "$s " 1>&3
  17. for test in $TESTS; do
  18. infile=${DATADIR}/${test}.unsigned
  19. for h in $HASHES; do
  20. pemfile=${TESTKEYS}/key_rsa${s}.pem
  21. outfile=${TMP}.${test}_${s}_${h}.new
  22. # sign it
  23. ${FUTILITY} sign --type usbpd1 --pem ${pemfile} ${infile} ${outfile}
  24. # make sure it identifies correctly
  25. ${FUTILITY} verify ${outfile}
  26. done
  27. done
  28. done
  29. # cleanup
  30. rm -rf ${TMP}*
  31. exit 0