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