"Fossies" - the Fresh Open Source Software Archive

Member "nss-3.35/nss/cmd/fipstest/aes.sh" (18 Jan 2018, 2814 Bytes) of package /linux/misc/nss-3.35.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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 #
    8 # A Bourne shell script for running the NIST AES Algorithm Validation Suite
    9 #
   10 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
   11 # variables appropriately so that the fipstest command and the NSPR and NSS
   12 # shared libraries/DLLs are on the search path.  Then run this script in the
   13 # directory where the REQUEST (.req) files reside.  The script generates the
   14 # RESPONSE (.rsp) files in the same directory.
   15 
   16 BASEDIR=${1-.}
   17 TESTDIR=${BASEDIR}/AES
   18 COMMAND=${2-run}
   19 REQDIR=${TESTDIR}/req
   20 RSPDIR=${TESTDIR}/resp
   21 
   22 cbc_kat_requests="
   23 CBCGFSbox128.req
   24 CBCGFSbox192.req
   25 CBCGFSbox256.req
   26 CBCKeySbox128.req
   27 CBCKeySbox192.req
   28 CBCKeySbox256.req
   29 CBCVarKey128.req
   30 CBCVarKey192.req
   31 CBCVarKey256.req
   32 CBCVarTxt128.req
   33 CBCVarTxt192.req
   34 CBCVarTxt256.req
   35 "
   36 
   37 cbc_mct_requests="
   38 CBCMCT128.req
   39 CBCMCT192.req
   40 CBCMCT256.req
   41 "
   42 
   43 cbc_mmt_requests="
   44 CBCMMT128.req
   45 CBCMMT192.req
   46 CBCMMT256.req
   47 "
   48 
   49 ecb_kat_requests="
   50 ECBGFSbox128.req
   51 ECBGFSbox192.req
   52 ECBGFSbox256.req
   53 ECBKeySbox128.req
   54 ECBKeySbox192.req
   55 ECBKeySbox256.req
   56 ECBVarKey128.req
   57 ECBVarKey192.req
   58 ECBVarKey256.req
   59 ECBVarTxt128.req
   60 ECBVarTxt192.req
   61 ECBVarTxt256.req
   62 "
   63 
   64 ecb_mct_requests="
   65 ECBMCT128.req
   66 ECBMCT192.req
   67 ECBMCT256.req
   68 "
   69 
   70 ecb_mmt_requests="
   71 ECBMMT128.req
   72 ECBMMT192.req
   73 ECBMMT256.req
   74 "
   75 
   76 if [ ${COMMAND} = "verify" ]; then
   77     for request in $cbc_kat_requests $cbc_mct_requests $cbc_mmt_requests $ecb_kat_requests $ecb_mct_requests $ecb_mmt_requests; do
   78     sh ./validate1.sh ${TESTDIR} $request
   79     done
   80     exit 0
   81 fi
   82 
   83 for request in $cbc_kat_requests; do
   84     response=`echo $request | sed -e "s/req/rsp/"`
   85     echo $request $response
   86     fipstest aes kat cbc ${REQDIR}/$request > ${RSPDIR}/$response
   87 done
   88 for request in $cbc_mct_requests; do
   89     response=`echo $request | sed -e "s/req/rsp/"`
   90     echo $request $response
   91     fipstest aes mct cbc ${REQDIR}/$request > ${RSPDIR}/$response
   92 done
   93 for request in $cbc_mmt_requests; do
   94     response=`echo $request | sed -e "s/req/rsp/"`
   95     echo $request $response
   96     fipstest aes mmt cbc ${REQDIR}/$request > ${RSPDIR}/$response
   97 done
   98 for request in $ecb_kat_requests; do
   99     response=`echo $request | sed -e "s/req/rsp/"`
  100     echo $request $response
  101     fipstest aes kat ecb ${REQDIR}/$request > ${RSPDIR}/$response
  102 done
  103 for request in $ecb_mct_requests; do
  104     response=`echo $request | sed -e "s/req/rsp/"`
  105     echo $request $response
  106     fipstest aes mct ecb ${REQDIR}/$request > ${RSPDIR}/$response
  107 done
  108 for request in $ecb_mmt_requests; do
  109     response=`echo $request | sed -e "s/req/rsp/"`
  110     echo $request $response
  111     fipstest aes mmt ecb ${REQDIR}/$request > ${RSPDIR}/$response
  112 done