File nss-CAVS-helper_sripts_fixes.patch of Package mozilla-nss.972

# HG changeset patch
# Parent  5452a694348c977868dea77bdef310265065738a
Add GCM test and report missing request files.

diff --git a/cmd/fipstest/aes.sh b/cmd/fipstest/aes.sh
old mode 100644
new mode 100755
--- a/cmd/fipstest/aes.sh
+++ b/cmd/fipstest/aes.sh
@@ -7,16 +7,18 @@
 # A Bourne shell script for running the NIST AES Algorithm Validation Suite
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
 
+BASEDIR=$1
+
 cbc_kat_requests="
 CBCGFSbox128.req
 CBCGFSbox192.req
 CBCGFSbox256.req
 CBCKeySbox128.req
 CBCKeySbox192.req
 CBCKeySbox256.req
 CBCVarKey128.req
@@ -64,35 +66,59 @@ ecb_mmt_requests="
 ECBMMT128.req
 ECBMMT192.req
 ECBMMT256.req
 "
 
 for request in $ecb_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes kat ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes kat ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $ecb_mmt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes mmt ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes mmt ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $ecb_mct_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes mct ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes mct ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes kat cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes kat cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_mmt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes mmt cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes mmt cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_mct_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest aes mct cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest aes mct cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
diff --git a/cmd/fipstest/dsa.sh b/cmd/fipstest/dsa.sh
--- a/cmd/fipstest/dsa.sh
+++ b/cmd/fipstest/dsa.sh
@@ -7,32 +7,54 @@
 # A Bourne shell script for running the NIST DSA Validation System
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
 
+BASEDIR=$1
+
 request=KeyPair.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest dsa keypair $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest dsa keypair $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=PQGGen.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest dsa pqggen $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest dsa pqggen $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=PQGVer1863.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest dsa pqgver $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest dsa pqgver $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=SigGen.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest dsa siggen $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest dsa siggen $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=SigVer.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest dsa sigver $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest dsa sigver $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
diff --git a/cmd/fipstest/ecdsa.sh b/cmd/fipstest/ecdsa.sh
old mode 100644
new mode 100755
--- a/cmd/fipstest/ecdsa.sh
+++ b/cmd/fipstest/ecdsa.sh
@@ -7,27 +7,45 @@
 # A Bourne shell script for running the NIST ECDSA Validation System
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
 
+BASEDIR=$1
+
 request=KeyPair.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest ecdsa keypair $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest ecdsa keypair $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=PKV.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest ecdsa pkv $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest ecdsa pkv $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=SigGen.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest ecdsa siggen $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest ecdsa siggen $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=SigVer.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest ecdsa sigver $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest ecdsa sigver $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
diff --git a/cmd/fipstest/hmac.sh b/cmd/fipstest/hmac.sh
--- a/cmd/fipstest/hmac.sh
+++ b/cmd/fipstest/hmac.sh
@@ -6,19 +6,25 @@
 #
 # A Bourne shell script for running the NIST HMAC Algorithm Validation Suite
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
+
+BASEDIR=$1
                                
 hmac_requests="
 HMAC.req
 "
 
 for request in $hmac_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest hmac $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest hmac $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 
diff --git a/cmd/fipstest/rng.sh b/cmd/fipstest/rng.sh
--- a/cmd/fipstest/rng.sh
+++ b/cmd/fipstest/rng.sh
@@ -7,17 +7,24 @@
 # A Bourne shell script for running the NIST RNG Validation Suite
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
 
+BASEDIR=$1
+
 drbg_requests="
 Hash_DRBG.req
 "
 
 for request in $drbg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest drbg $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest drbg $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
+    
 done
diff --git a/cmd/fipstest/rsa.sh b/cmd/fipstest/rsa.sh
--- a/cmd/fipstest/rsa.sh
+++ b/cmd/fipstest/rsa.sh
@@ -7,23 +7,36 @@
 # A Bourne shell script for running the NIST RSA Validation System
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
 
+BASEDIR=$1
 
 request=SigGen15_186-3.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest rsa siggen $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest rsa siggen $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=SigVer15_186-3.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest rsa sigver $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest rsa sigver $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
 
 request=KeyGen_RandomProbablyPrime3_3.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
-fipstest rsa keygen $request > $response
+if [ -f $BASEDIR/req/$request ]; then
+    fipstest rsa keygen $BASEDIR/req/$request > $BASEDIR/resp/$response
+else
+    echo "WARNING: Cannot find $request"
+fi
diff --git a/cmd/fipstest/sha.sh b/cmd/fipstest/sha.sh
--- a/cmd/fipstest/sha.sh
+++ b/cmd/fipstest/sha.sh
@@ -6,16 +6,18 @@
 #
 # A Bourne shell script for running the NIST SHA Algorithm Validation Suite
 #
 # Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
 # variables appropriately so that the fipstest command and the NSPR and NSS
 # shared libraries/DLLs are on the search path.  Then run this script in the
 # directory where the REQUEST (.req) files reside.  The script generates the
 # RESPONSE (.rsp) files in the same directory.
+
+BASEDIR=$1
                                
 sha_ShortMsg_requests="
 SHA1ShortMsg.req
 SHA224ShortMsg.req
 SHA256ShortMsg.req
 SHA384ShortMsg.req
 SHA512ShortMsg.req
 "
@@ -33,21 +35,33 @@ SHA1Monte.req
 SHA224Monte.req
 SHA256Monte.req
 SHA384Monte.req
 SHA512Monte.req
 "
 for request in $sha_ShortMsg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest sha $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest sha $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $sha_LongMsg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest sha $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest sha $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $sha_Monte_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest sha $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest sha $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 
diff --git a/cmd/fipstest/tdea.sh b/cmd/fipstest/tdea.sh
old mode 100644
new mode 100755
--- a/cmd/fipstest/tdea.sh
+++ b/cmd/fipstest/tdea.sh
@@ -13,16 +13,19 @@
 # RESPONSE (.rsp) files in the same directory.
 
 #CBC_Known_Answer_tests
 #Initial Permutation KAT  
 #Permutation Operation KAT 
 #Subsitution Table KAT    
 #Variable Key KAT         
 #Variable PlainText KAT   
+
+BASEDIR=$1
+
 cbc_kat_requests="
 TCBCinvperm.req   
 TCBCpermop.req    
 TCBCsubtab.req    
 TCBCvarkey.req    
 TCBCvartext.req   
 "
 
@@ -57,35 +60,59 @@ ecb_mmt_requests="
 TECBMMT1.req
 TECBMMT2.req
 TECBMMT3.req
 "
 
 for request in $ecb_mmt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea mmt ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea mmt ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $ecb_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea kat ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea kat ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $ecb_monte_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea mct ecb $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea mct ecb $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_mmt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea mmt cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea mmt cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea kat cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea kat cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
 for request in $cbc_monte_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
-    fipstest tdea mct cbc $request > $response
+    if [ -f $BASEDIR/req/$request ]; then
+        fipstest tdea mct cbc $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
 done
diff --git a/cmd/pk11gcmtest/gcm.sh b/cmd/pk11gcmtest/gcm.sh
new file mode 100644
--- /dev/null
+++ b/cmd/pk11gcmtest/gcm.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#
+# A Bourne shell script for running the NIST AES Algorithm Validation Suite
+#
+# Before you run the script, set your PATH, LD_LIBRARY_PATH, ... environment
+# variables appropriately so that the fipstest command and the NSPR and NSS
+# shared libraries/DLLs are on the search path.  Then run this script in the
+# directory where the REQUEST (.req) files reside.  The script generates the
+# RESPONSE (.rsp) files in the same directory.
+
+BASEDIR=$1
+
+gcm_requests="
+gcmDecrypt128.req
+gcmDecrypt192.req
+gcmDecrypt256.req
+gcmEncryptExtIV128.req
+gcmEncryptExtIV192.req
+gcmEncryptExtIV256.req
+"
+
+for request in $gcm_requests; do
+    response=`echo $request | sed -e "s/req/rsp/"`
+    echo $request $response
+    if [ -f $BASEDIR/req/$request ]; then
+        pk11gcmtest aes kat gcm $BASEDIR/req/$request > $BASEDIR/resp/$response
+    else
+        echo "WARNING: Cannot find $request"
+    fi
+done
+