OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Run verified boot firmware and kernel verification tests. |
| 8 |
| 9 # Load common constants and variables. |
| 10 . "$(dirname "$0")/common.sh" |
| 11 |
| 12 return_code=0 |
| 13 |
| 14 function test_vboot_common { |
| 15 ${TEST_DIR}/vboot_common_tests |
| 16 if [ $? -ne 0 ] |
| 17 then |
| 18 return_code=255 |
| 19 fi |
| 20 } |
| 21 |
| 22 function test_vboot_common2 { |
| 23 algorithmcounter=0 |
| 24 for keylen in ${key_lengths[@]} |
| 25 do |
| 26 for hashalgo in ${hash_algos[@]} |
| 27 do |
| 28 echo -e "For signing key ${COL_YELLOW}RSA-$keylen/$hashalgo${COL_STOP}:" |
| 29 ${TEST_DIR}/vboot_common2_tests $algorithmcounter \ |
| 30 ${TESTKEY_DIR}/key_rsa${keylen}.pem \ |
| 31 ${TESTKEY_DIR}/key_rsa${keylen}.keyb |
| 32 if [ $? -ne 0 ] |
| 33 then |
| 34 return_code=255 |
| 35 fi |
| 36 let algorithmcounter=algorithmcounter+1 |
| 37 done |
| 38 done |
| 39 } |
| 40 |
| 41 function test_vboot_common3 { |
| 42 # Test for various combinations of firmware signing algorithm and |
| 43 # kernel signing algorithm |
| 44 firmware_algorithmcounter=0 |
| 45 kernel_algorithmcounter=0 |
| 46 for firmware_keylen in ${key_lengths[@]} |
| 47 do |
| 48 for firmware_hashalgo in ${hash_algos[@]} |
| 49 do |
| 50 let kernel_algorithmcounter=0 |
| 51 for kernel_keylen in ${key_lengths[@]} |
| 52 do |
| 53 for kernel_hashalgo in ${hash_algos[@]} |
| 54 do |
| 55 echo -e "For ${COL_YELLOW}signing algorithm \ |
| 56 RSA-${firmware_keylen}/${firmware_hashalgo}${COL_STOP} \ |
| 57 and ${COL_YELLOW}data signing algorithm RSA-${kernel_keylen}/\ |
| 58 ${kernel_hashalgo}${COL_STOP}" |
| 59 ${TEST_DIR}/vboot_common3_tests \ |
| 60 $firmware_algorithmcounter $kernel_algorithmcounter \ |
| 61 ${TESTKEY_DIR}/key_rsa${firmware_keylen}.pem \ |
| 62 ${TESTKEY_DIR}/key_rsa${firmware_keylen}.keyb \ |
| 63 ${TESTKEY_DIR}/key_rsa${kernel_keylen}.pem \ |
| 64 ${TESTKEY_DIR}/key_rsa${kernel_keylen}.keyb |
| 65 if [ $? -ne 0 ] |
| 66 then |
| 67 return_code=255 |
| 68 fi |
| 69 let kernel_algorithmcounter=kernel_algorithmcounter+1 |
| 70 done |
| 71 done |
| 72 let firmware_algorithmcounter=firmware_algorithmcounter+1 |
| 73 done |
| 74 done |
| 75 } |
| 76 |
| 77 check_test_keys |
| 78 echo |
| 79 echo "Testing vboot_common tests which don't depend on keys..." |
| 80 test_vboot_common |
| 81 |
| 82 echo |
| 83 echo "Testing vboot_common tests which depend on one key..." |
| 84 test_vboot_common2 |
| 85 |
| 86 echo |
| 87 echo "Testing vboot_common tests which depend on two keys..." |
| 88 test_vboot_common3 |
| 89 |
| 90 |
| 91 exit $return_code |
OLD | NEW |