| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Run tests for cryptographic routine implementations - Message digests | 7 # Run tests for cryptographic routine implementations - Message digests |
| 8 # and RSA Signature verification. | 8 # and RSA Signature verification. |
| 9 | 9 |
| 10 return_code=0 | 10 return_code=0 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 function pre_work { | 66 function pre_work { |
| 67 # Generate a file with random bytes for signature tests. | 67 # Generate a file with random bytes for signature tests. |
| 68 echo "Generating test file..." | 68 echo "Generating test file..." |
| 69 dd if=/dev/urandom of=${TEST_FILE} bs=${TEST_FILE_SIZE} count=1 | 69 dd if=/dev/urandom of=${TEST_FILE} bs=${TEST_FILE_SIZE} count=1 |
| 70 echo "Generating signatures..." | 70 echo "Generating signatures..." |
| 71 generate_signatures $TEST_FILE | 71 generate_signatures $TEST_FILE |
| 72 } | 72 } |
| 73 | 73 |
| 74 function cleanup { | 74 function cleanup { |
| 75 rm ${TEST_FILE} ${TEST_FILE}.*.sig | 75 rm ${SCRIPT_DIR}/${TEST_FILE} ${SCRIPT_DIR}/${TEST_FILE}.*.sig |
| 76 } | 76 } |
| 77 | 77 |
| 78 # Determine script directory. | 78 # Determine script directory. |
| 79 if [[ $0 == '/'* ]]; | 79 if [[ $0 == '/'* ]]; |
| 80 then | 80 then |
| 81 SCRIPT_DIR="`dirname $0`" | 81 SCRIPT_DIR="`dirname $0`" |
| 82 elif [[ $0 == './'* ]]; | 82 elif [[ $0 == './'* ]]; |
| 83 then | 83 then |
| 84 SCRIPT_DIR="`pwd`" | 84 SCRIPT_DIR="`pwd`" |
| 85 else | 85 else |
| 86 SCRIPT_DIR="`pwd`"/"`dirname $0`" | 86 SCRIPT_DIR="`pwd`"/"`dirname $0`" |
| 87 fi | 87 fi |
| 88 UTIL_DIR=`dirname ${SCRIPT_DIR}`/utils | 88 UTIL_DIR=`dirname ${SCRIPT_DIR}`/utils |
| 89 KEY_DIR=${SCRIPT_DIR}/testkeys | 89 KEY_DIR=${SCRIPT_DIR}/testkeys |
| 90 TEST_DIR=${SCRIPT_DIR}/ |
| 90 | 91 |
| 91 echo "Generating test cases..." | 92 echo "Generating test cases..." |
| 92 pre_work | 93 pre_work |
| 93 | 94 |
| 94 echo | 95 echo |
| 95 echo "Testing signature verification..." | 96 echo "Testing signature verification..." |
| 96 test_signatures | 97 test_signatures |
| 97 | 98 |
| 98 echo | 99 echo |
| 99 echo "Testing high-level image verification..." | 100 echo "Testing high-level image verification..." |
| 100 test_verification | 101 test_verification |
| 101 | 102 |
| 102 echo | 103 echo |
| 103 echo "Cleaning up..." | 104 echo "Cleaning up..." |
| 104 #cleanup | 105 cleanup |
| 105 | 106 |
| 106 exit $return_code | 107 exit $return_code |
| 107 | 108 |
| OLD | NEW |