tor-browser

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

rsa.sh (2023B)


      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 RSA Validation System
      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}/RSA2
     16 COMMAND=${2-run}
     17 REQDIR=${TESTDIR}/req
     18 RSPDIR=${TESTDIR}/resp
     19 
     20 if [ ${COMMAND} = "verify" ]; then
     21    result=0
     22 #verify the signatures. The fax file does not have any known answers, so
     23 #use our own verify function.
     24    name=SigGen15_186-3
     25    echo ">>>>>  $name"
     26    fipstest rsa sigver ${RSPDIR}/$name.rsp | grep ^Result.=.F
     27    test 1 = $?
     28    last_result=$?
     29    result=`expr $result + $last_result`
     30 #The Fax file has the private exponent and the salt value, remove it
     31 #also remove the false reason
     32    sh ./validate1.sh ${TESTDIR} SigVer15_186-3.req ' ' '-e /^SaltVal/d -e/^d.=/d -e /^p.=/d -e /^q.=/d -e /^EM.with/d -e /^Result.=.F/s;.(.*);;'
     33    last_result=$?
     34    result=`expr $result + $last_result`
     35 #
     36 # currently don't have a way to verify the RSA keygen
     37 #
     38    exit $result
     39 fi
     40 
     41 test -d "${RSPDIR}" || mkdir "${RSPDIR}"
     42 
     43 request=SigGen15_186-3.req
     44 response=`echo $request | sed -e "s/req/rsp/"`
     45 echo $request $response
     46 fipstest rsa siggen ${REQDIR}/$request > ${RSPDIR}/$response
     47 
     48 request=SigVer15_186-3.req
     49 response=`echo $request | sed -e "s/req/rsp/"`
     50 echo $request $response
     51 fipstest rsa sigver ${REQDIR}/$request > ${RSPDIR}/$response
     52 
     53 #request=KeyGen_186-3.req
     54 request=KeyGen_RandomProbablyPrime3_3.req
     55 response=`echo $request | sed -e "s/req/rsp/"`
     56 echo $request $response
     57 fipstest rsa keypair ${REQDIR}/$request > ${RSPDIR}/$response