Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #! /bin/bash
2 #
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 ########################################################################
8 #
9 # mozilla/security/nss/tests/sdr/sdr.sh
10 #
11 # Script to start test basic functionallity of NSS sdr
12 #
13 # needs to work on all Unix and Windows platforms
14 #
15 # special strings
16 # ---------------
17 # FIXME ... known problems, search for this string
18 # NOTE .... unexpected behavior
19 #
20 ########################################################################
22 ############################## sdr_init ################################
23 # local shell function to initialize this script
24 ########################################################################
25 sdr_init()
26 {
27 SCRIPTNAME=sdr.sh
28 if [ -z "${CLEANUP}" ] ; then
29 CLEANUP="${SCRIPTNAME}"
30 fi
32 if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
33 cd ../common
34 . ./init.sh
35 fi
36 SCRIPTNAME=sdr.sh
38 #temporary files
39 VALUE1=$HOSTDIR/tests.v1.$$
40 VALUE2=$HOSTDIR/tests.v2.$$
41 VALUE3=$HOSTDIR/tests.v3.$$
43 T1="Test1"
44 T2="The quick brown fox jumped over the lazy dog"
45 T3="1234567"
47 SDRDIR=${HOSTDIR}/SDR
48 D_SDR="SDR.$version"
49 if [ ! -d ${SDRDIR} ]; then
50 mkdir -p ${SDRDIR}
51 fi
53 PROFILE=.
54 if [ -n "${MULTIACCESS_DBM}" ]; then
55 PROFILE="multiaccess:${D_SDR}"
56 fi
58 cd ${SDRDIR}
59 html_head "SDR Tests"
60 }
62 ############################## sdr_main ################################
63 # local shell function to test NSS SDR
64 ########################################################################
65 sdr_main()
66 {
67 echo "$SCRIPTNAME: Creating an SDR key/SDR Encrypt - Value 1"
68 echo "sdrtest -d ${PROFILE} -o ${VALUE1} -t \"${T1}\""
69 ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE1} -t "${T1}"
70 html_msg $? 0 "Creating SDR Key/Encrypt - Value 1"
72 echo "$SCRIPTNAME: SDR Encrypt - Value 2"
73 echo "sdrtest -d ${PROFILE} -o ${VALUE2} -t \"${T2}\""
74 ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE2} -t "${T2}"
75 html_msg $? 0 "Encrypt - Value 2"
77 echo "$SCRIPTNAME: SDR Encrypt - Value 3"
78 echo "sdrtest -d ${PROFILE} -o ${VALUE3} -t \"${T3}\""
79 ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE3} -t "${T3}"
80 html_msg $? 0 "Encrypt - Value 3"
82 echo "$SCRIPTNAME: SDR Decrypt - Value 1"
83 echo "sdrtest -d ${PROFILE} -i ${VALUE1} -t \"${T1}\""
84 ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE1} -t "${T1}"
85 html_msg $? 0 "Decrypt - Value 1"
87 echo "$SCRIPTNAME: SDR Decrypt - Value 2"
88 echo "sdrtest -d ${PROFILE} -i ${VALUE2} -t \"${T2}\""
89 ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE2} -t "${T2}"
90 html_msg $? 0 "Decrypt - Value 2"
92 echo "$SCRIPTNAME: SDR Decrypt - Value 3"
93 echo "sdrtest -d ${PROFILE} -i ${VALUE3} -t \"${T3}\""
94 ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE3} -t "${T3}"
95 html_msg $? 0 "Decrypt - Value 3"
96 }
98 ############################## sdr_cleanup #############################
99 # local shell function to finish this script (no exit since it might be
100 # sourced)
101 ########################################################################
102 sdr_cleanup()
103 {
104 html "</TABLE><BR>"
105 cd ${QADIR}
106 . common/cleanup.sh
107 }
109 sdr_init
110 sdr_main
111 sdr_cleanup