"Fossies" - the Fresh Open Source Software Archive

Member "nss-3.37.3/nss/cmd/fipstest/aesgcm.sh" (5 Jun 2018, 2051 Bytes) of package /linux/misc/nss-3.37.3.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 # A Bourne shell script for running the NIST AES 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 
   15 BASEDIR=${1-.}
   16 TESTDIR=${BASEDIR}/AES_GCM
   17 COMMAND=${2-run}
   18 REQDIR=${TESTDIR}/req
   19 RSPDIR=${TESTDIR}/resp
   20 
   21 gcm_decrypt_requests="
   22 gcmDecrypt128.req
   23 gcmDecrypt192.req
   24 gcmDecrypt256.req
   25 "
   26 
   27 gcm_encrypt_extiv_requests="
   28 gcmEncryptExtIV128.req
   29 gcmEncryptExtIV192.req
   30 gcmEncryptExtIV256.req
   31 "
   32 gcm_encrypt_intiv_requests="
   33 "
   34 
   35 #gcm_encrypt_intiv_requests="
   36 #gcmEncryptIntIV128.req
   37 #gcmEncryptIntIV192.req
   38 #gcmEncryptIntIV256.req
   39 #"
   40 
   41 if [ ${COMMAND} = "verify" ]; then
   42     for request in $gcm_decrypt_requests $gcm_encrypt_extiv_requests; do
   43     sh ./validate1.sh ${TESTDIR} $request ' ' '-e /Reason:/d'
   44     done
   45     for request in $gcm_encrypt_intiv_requests; do
   46     name=`basename $request .req`
   47         echo ">>>>>  $name"
   48         fipstest aes gcm decrypt ${RSPDIR}/$name.rsp | grep FAIL
   49     done
   50     exit 0
   51 fi
   52 
   53 for request in $gcm_decrypt_requests; do
   54     response=`echo $request | sed -e "s/req/rsp/"`
   55     echo $request $response
   56     fipstest aes gcm decrypt ${REQDIR}/$request > ${RSPDIR}/$response
   57 done
   58 for request in $gcm_encrypt_intiv_requests; do
   59     response=`echo $request | sed -e "s/req/rsp/"`
   60     echo $request $response
   61     fipstest aes gcm encrypt_intiv ${REQDIR}/$request > ${RSPDIR}/$response
   62 done
   63 for request in $gcm_encrypt_extiv_requests; do
   64     response=`echo $request | sed -e "s/req/rsp/"`
   65     echo $request $response
   66     fipstest aes gcm encrypt_extiv ${REQDIR}/$request > ${RSPDIR}/$response
   67 done