tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sha.sh (1938B)


      1 #!/bin/sh
      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/.
      6 #
      7 # A Bourne shell script for running the NIST SHA Algorithm Validation Suite
      8 #
      9 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
     10 # variables appropriately so that the fipstest command and the NSPR and NSS
     11 # shared libraries/DLLs are on the search path.  Then run this script in the
     12 # directory where the REQUEST (.req) files reside.  The script generates the
     13 # RESPONSE (.rsp) files in the same directory.
     14 BASEDIR=${1-.}
     15 TESTDIR=${BASEDIR}/SHA
     16 COMMAND=${2-run}
     17 REQDIR=${TESTDIR}/req
     18 RSPDIR=${TESTDIR}/resp
     19 
     20 sha_ShortMsg_requests="
     21 SHA1ShortMsg.req
     22 SHA224ShortMsg.req
     23 SHA256ShortMsg.req
     24 SHA384ShortMsg.req
     25 SHA512ShortMsg.req
     26 "
     27 
     28 sha_LongMsg_requests="
     29 SHA1LongMsg.req
     30 SHA224LongMsg.req
     31 SHA256LongMsg.req
     32 SHA384LongMsg.req
     33 SHA512LongMsg.req
     34 "
     35 
     36 sha_Monte_requests="
     37 SHA1Monte.req
     38 SHA224Monte.req
     39 SHA256Monte.req
     40 SHA384Monte.req
     41 SHA512Monte.req
     42 "
     43 
     44 if [ ${COMMAND} = "verify" ]; then
     45    result=0
     46    for request in $sha_ShortMsg_requests $sha_LongMsg_requests $sha_Monte_requests; do
     47 sh ./validate1.sh ${TESTDIR} $request
     48 last_result=$?
     49 result=`expr $result + $last_result`
     50    done
     51    exit $result
     52 fi
     53 
     54 test -d "${RSPDIR}" || mkdir "${RSPDIR}"
     55 
     56 for request in $sha_ShortMsg_requests; do
     57    response=`echo $request | sed -e "s/req/rsp/"`
     58    echo $request $response
     59    fipstest sha ${REQDIR}/$request > ${RSPDIR}/$response
     60 done
     61 for request in $sha_LongMsg_requests; do
     62    response=`echo $request | sed -e "s/req/rsp/"`
     63    echo $request $response
     64    fipstest sha ${REQDIR}/$request > ${RSPDIR}/$response
     65 done
     66 for request in $sha_Monte_requests; do
     67    response=`echo $request | sed -e "s/req/rsp/"`
     68    echo $request $response
     69    fipstest sha ${REQDIR}/$request > ${RSPDIR}/$response
     70 done
     71 exit 0