blob: cd7695f0bd62aae932245ea9e2803301a143a3c2 [file] [log] [blame]
Gaurav Shah445925f2010-03-19 16:19:09 -07001#!/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# Determine script directory.
Bill Richardson793e1b42010-08-20 07:58:43 -07008SCRIPT_DIR=$(dirname $(readlink -f "$0"))
Gaurav Shah445925f2010-03-19 16:19:09 -07009
vbendeb70e95092010-06-14 15:41:27 -070010ROOT_DIR="$(dirname ${SCRIPT_DIR})"
11BUILD_DIR="${ROOT_DIR}/build"
12UTIL_DIR="${BUILD_DIR}/utility"
13TEST_DIR="${BUILD_DIR}/tests"
Gaurav Shah445925f2010-03-19 16:19:09 -070014TESTKEY_DIR=${SCRIPT_DIR}/testkeys
15TESTCASE_DIR=${SCRIPT_DIR}/testcases
vbendeb70e95092010-06-14 15:41:27 -070016TESTKEY_SCRATCH_DIR=${TEST_DIR}/testkeys
17
18if [ ! -d ${TESTKEY_SCRATCH_DIR} ]; then
19 mkdir ${TESTKEY_SCRATCH_DIR}
20fi
Gaurav Shah445925f2010-03-19 16:19:09 -070021
22# Color output encodings.
23COL_RED='\E[31;1m'
24COL_GREEN='\E[32;1m'
25COL_YELLOW='\E[33;1m'
26COL_BLUE='\E[34;1m'
27COL_STOP='\E[0;m'
28
29hash_algos=( sha1 sha256 sha512 )
30key_lengths=( 1024 2048 4096 8192 )
31
Bill Richardsonf1372d92010-06-11 09:15:55 -070032function happy {
33 echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2
Gaurav Shah445925f2010-03-19 16:19:09 -070034}
Bill Richardsonf1372d92010-06-11 09:15:55 -070035
36function warning {
37 echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2
38}
39
40function error {
41 echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2
42 exit 1
43}
44
45function check_test_keys {
46 [ -d ${TESTKEY_DIR} ] || \
47 error "You must run gen_test_keys.sh to generate test keys first."
48}
49