1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/tests/sdr/sdr.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,111 @@ 1.4 +#! /bin/bash 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +######################################################################## 1.11 +# 1.12 +# mozilla/security/nss/tests/sdr/sdr.sh 1.13 +# 1.14 +# Script to start test basic functionallity of NSS sdr 1.15 +# 1.16 +# needs to work on all Unix and Windows platforms 1.17 +# 1.18 +# special strings 1.19 +# --------------- 1.20 +# FIXME ... known problems, search for this string 1.21 +# NOTE .... unexpected behavior 1.22 +# 1.23 +######################################################################## 1.24 + 1.25 +############################## sdr_init ################################ 1.26 +# local shell function to initialize this script 1.27 +######################################################################## 1.28 +sdr_init() 1.29 +{ 1.30 + SCRIPTNAME=sdr.sh 1.31 + if [ -z "${CLEANUP}" ] ; then 1.32 + CLEANUP="${SCRIPTNAME}" 1.33 + fi 1.34 + 1.35 + if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then 1.36 + cd ../common 1.37 + . ./init.sh 1.38 + fi 1.39 + SCRIPTNAME=sdr.sh 1.40 + 1.41 + #temporary files 1.42 + VALUE1=$HOSTDIR/tests.v1.$$ 1.43 + VALUE2=$HOSTDIR/tests.v2.$$ 1.44 + VALUE3=$HOSTDIR/tests.v3.$$ 1.45 + 1.46 + T1="Test1" 1.47 + T2="The quick brown fox jumped over the lazy dog" 1.48 + T3="1234567" 1.49 + 1.50 + SDRDIR=${HOSTDIR}/SDR 1.51 + D_SDR="SDR.$version" 1.52 + if [ ! -d ${SDRDIR} ]; then 1.53 + mkdir -p ${SDRDIR} 1.54 + fi 1.55 + 1.56 + PROFILE=. 1.57 + if [ -n "${MULTIACCESS_DBM}" ]; then 1.58 + PROFILE="multiaccess:${D_SDR}" 1.59 + fi 1.60 + 1.61 + cd ${SDRDIR} 1.62 + html_head "SDR Tests" 1.63 +} 1.64 + 1.65 +############################## sdr_main ################################ 1.66 +# local shell function to test NSS SDR 1.67 +######################################################################## 1.68 +sdr_main() 1.69 +{ 1.70 + echo "$SCRIPTNAME: Creating an SDR key/SDR Encrypt - Value 1" 1.71 + echo "sdrtest -d ${PROFILE} -o ${VALUE1} -t \"${T1}\"" 1.72 + ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE1} -t "${T1}" 1.73 + html_msg $? 0 "Creating SDR Key/Encrypt - Value 1" 1.74 + 1.75 + echo "$SCRIPTNAME: SDR Encrypt - Value 2" 1.76 + echo "sdrtest -d ${PROFILE} -o ${VALUE2} -t \"${T2}\"" 1.77 + ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE2} -t "${T2}" 1.78 + html_msg $? 0 "Encrypt - Value 2" 1.79 + 1.80 + echo "$SCRIPTNAME: SDR Encrypt - Value 3" 1.81 + echo "sdrtest -d ${PROFILE} -o ${VALUE3} -t \"${T3}\"" 1.82 + ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE3} -t "${T3}" 1.83 + html_msg $? 0 "Encrypt - Value 3" 1.84 + 1.85 + echo "$SCRIPTNAME: SDR Decrypt - Value 1" 1.86 + echo "sdrtest -d ${PROFILE} -i ${VALUE1} -t \"${T1}\"" 1.87 + ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE1} -t "${T1}" 1.88 + html_msg $? 0 "Decrypt - Value 1" 1.89 + 1.90 + echo "$SCRIPTNAME: SDR Decrypt - Value 2" 1.91 + echo "sdrtest -d ${PROFILE} -i ${VALUE2} -t \"${T2}\"" 1.92 + ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE2} -t "${T2}" 1.93 + html_msg $? 0 "Decrypt - Value 2" 1.94 + 1.95 + echo "$SCRIPTNAME: SDR Decrypt - Value 3" 1.96 + echo "sdrtest -d ${PROFILE} -i ${VALUE3} -t \"${T3}\"" 1.97 + ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE3} -t "${T3}" 1.98 + html_msg $? 0 "Decrypt - Value 3" 1.99 +} 1.100 + 1.101 +############################## sdr_cleanup ############################# 1.102 +# local shell function to finish this script (no exit since it might be 1.103 +# sourced) 1.104 +######################################################################## 1.105 +sdr_cleanup() 1.106 +{ 1.107 + html "</TABLE><BR>" 1.108 + cd ${QADIR} 1.109 + . common/cleanup.sh 1.110 +} 1.111 + 1.112 +sdr_init 1.113 +sdr_main 1.114 +sdr_cleanup