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