vb2_rsa_tests.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Copyright (c) 2010 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. #
  6. # Run tests for RSA Signature verification.
  7. # Load common constants and variables.
  8. . "$(dirname "$0")/common.sh"
  9. set -e
  10. return_code=0
  11. TEST_FILE=${TESTCASE_DIR}/test_file
  12. function test_signatures {
  13. algorithmcounter=0
  14. for keylen in ${key_lengths[@]}
  15. do
  16. for hashalgo in ${hash_algos[@]}
  17. do
  18. echo -e "For ${COL_YELLOW}RSA-$keylen and $hashalgo${COL_STOP}:"
  19. ${BIN_DIR}/verify_data $algorithmcounter \
  20. ${TESTKEY_DIR}/key_rsa${keylen}.keyb \
  21. ${TEST_FILE}.rsa${keylen}_${hashalgo}.sig \
  22. ${TEST_FILE}
  23. if [ $? -ne 0 ]
  24. then
  25. return_code=255
  26. fi
  27. let algorithmcounter=algorithmcounter+1
  28. done
  29. done
  30. echo -e "Peforming ${COL_YELLOW}PKCS #1 v1.5 Padding Tests${COL_STOP}..."
  31. ${TEST_DIR}/vb20_rsa_padding_tests ${TESTKEY_DIR}/rsa_padding_test_pubkey.keyb
  32. }
  33. check_test_keys
  34. echo "Testing signature verification..."
  35. test_signatures
  36. exit $return_code