Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: src/platform/vboot_reference/tests/gen_test_cases.sh

Issue 626011: Vboot Reference: Add a RSA verify benchmark. (Closed)
Patch Set: 80 Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 # Generate test cases for use for the RSA verify benchmark.
8
9 KEY_DIR=testkeys
10 TESTCASE_DIR=testcases
11 UTIL_DIR=../utils/
12 TEST_FILE=test_file
13 TEST_FILE_SIZE=1000000
14
15 hash_algos=( sha1 sha256 sha512 )
16 key_lengths=( 1024 2048 4096 8192 )
17
18 # Generate public key signatures and digest on an input file for
19 # various combinations of message digest algorithms and RSA key sizes.
20 function generate_test_signatures {
21 algorithmcounter=0
22 for keylen in ${key_lengths[@]}
23 do
24 for hashalgo in ${hash_algos[@]}
25 do
26 openssl dgst -${hashalgo} -binary -out $1.${hashalgo}.digest $1
27 ${UTIL_DIR}/signature_digest $algorithmcounter $1 | openssl rsautl -sign \
28 -pkcs -inkey ${KEY_DIR}/key_rsa${keylen}.pem \
29 > $1.rsa${keylen}_${hashalgo}.sig
30 let algorithmcounter=algorithmcounter+1
31 done
32 done
33 }
34
35 function pre_work {
36 # Generate a file with random bytes for signature tests.
37 echo "Generating test file..."
38 dd if=/dev/urandom of=${TESTCASE_DIR}/${TEST_FILE} bs=${TEST_FILE_SIZE} count= 1
39 }
40
41 if [ ! -d "$KEY_DIR" ]
42 then
43 echo "You must run gen_test_cases.sh to generate test keys first."
44 exit 1
45 fi
46
47 if [ ! -d "$TESTCASE_DIR" ]
48 then
49 mkdir "$TESTCASE_DIR"
50 fi
51
52 pre_work
53 echo "Generating test signatures..."
54 generate_test_signatures ${TESTCASE_DIR}/$TEST_FILE
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/tests/Makefile ('k') | src/platform/vboot_reference/tests/rsa_verify_benchmark.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698