Bug 1563258, tests: ensure CAVS test dirs are created, r=rrelyea
authorDaiki Ueno <dueno@redhat.com>
Wed, 03 Jul 2019 15:56:21 +0200
changeset 15242 085e429af86cc9e3808c076f0dd4a37ebe4a1a8c
parent 15241 009a7163c80a711bd681b155ecffa5962fd98a46
child 15243 777b6070fe76b1dc3c51b968e87bc39668fc0282
push id3454
push userdueno@redhat.com
push dateThu, 01 Aug 2019 12:18:33 +0000
reviewersrrelyea
bugs1563258
Bug 1563258, tests: ensure CAVS test dirs are created, r=rrelyea
tests/fips/cavs_scripts/aes.sh
tests/fips/cavs_scripts/aesgcm.sh
tests/fips/cavs_scripts/dsa.sh
tests/fips/cavs_scripts/ecdsa.sh
tests/fips/cavs_scripts/hmac.sh
tests/fips/cavs_scripts/ike.sh
tests/fips/cavs_scripts/kas.sh
tests/fips/cavs_scripts/rng.sh
tests/fips/cavs_scripts/rsa.sh
tests/fips/cavs_scripts/sha.sh
tests/fips/cavs_scripts/tdea.sh
tests/fips/cavs_scripts/tls.sh
--- a/tests/fips/cavs_scripts/aes.sh
+++ b/tests/fips/cavs_scripts/aes.sh
@@ -78,16 +78,18 @@ if [ ${COMMAND} = "verify" ]; then
     for request in $cbc_kat_requests $cbc_mct_requests $cbc_mmt_requests $ecb_kat_requests $ecb_mct_requests $ecb_mmt_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $cbc_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest aes kat cbc ${REQDIR}/$request > ${RSPDIR}/$response
 done
 for request in $cbc_mct_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
--- a/tests/fips/cavs_scripts/aesgcm.sh
+++ b/tests/fips/cavs_scripts/aesgcm.sh
@@ -51,16 +51,18 @@ if [ ${COMMAND} = "verify" ]; then
         fipstest aes gcm decrypt ${RSPDIR}/$name.rsp | grep FAIL
 	test 1 = $?
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $gcm_decrypt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest aes gcm decrypt ${REQDIR}/$request > ${RSPDIR}/$response
 done
 for request in $gcm_encrypt_intiv_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
--- a/tests/fips/cavs_scripts/dsa.sh
+++ b/tests/fips/cavs_scripts/dsa.sh
@@ -54,16 +54,18 @@ if [ ${COMMAND} = "verify" ]; then
     result=`expr $result + $last_result`
 # verify SigVer with known answer
     sh ./validate1.sh ${TESTDIR} SigVer.req ' ' '-e /^X.=/d -e /^Result.=.F/s;.(.*);;'
     last_result=$?
     result=`expr $result + $last_result`
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 request=KeyPair.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest dsa keypair ${REQDIR}/$request > ${RSPDIR}/$response
 
 request=PQGGen.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
--- a/tests/fips/cavs_scripts/ecdsa.sh
+++ b/tests/fips/cavs_scripts/ecdsa.sh
@@ -45,16 +45,18 @@ if [ ${COMMAND} = "verify" ]; then
     result=`expr $result + $last_result`
 # verify SigVer with known answer
     sh ./validate1.sh ${TESTDIR} SigVer.req ' ' '-e /^X.=/d -e /^Result.=.F/s;.(.*);; -e /^Result.=.P/s;.(.*);;'
     last_result=$?
     result=`expr $result + $last_result`
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 request=KeyPair.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest ecdsa keypair ${REQDIR}/$request > ${RSPDIR}/$response
 
 request=PKV.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
--- a/tests/fips/cavs_scripts/hmac.sh
+++ b/tests/fips/cavs_scripts/hmac.sh
@@ -26,14 +26,17 @@ if [ ${COMMAND} = "verify" ]; then
     result=0
     for request in $hmac_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
         result=`expr $result + $last_result`
     done
     exit $result
 fi
+
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $hmac_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest hmac ${REQDIR}/$request > ${RSPDIR}/$response
 done
 exit 0
--- a/tests/fips/cavs_scripts/ike.sh
+++ b/tests/fips/cavs_scripts/ike.sh
@@ -28,16 +28,18 @@ if [ ${COMMAND} = "verify" ]; then
     for request in $ike_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 request=ikev1_dsa.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest ikev1 ${REQDIR}/$request > ${RSPDIR}/$response
 request=ikev1_psk.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest ikev1-psk ${REQDIR}/$request > ${RSPDIR}/$response
--- a/tests/fips/cavs_scripts/kas.sh
+++ b/tests/fips/cavs_scripts/kas.sh
@@ -63,16 +63,18 @@ if [ ${COMMAND} = "verify" ]; then
     result=`expr $result + $last_result`
     # ecdh response verify
     sh ./validate1.sh ${TESTDIR} KASValidityTest_FFCEphem_NOKC_ZZOnly_resp.req ' ' '-e /^Result.=.F/s;.(.*);; -e /^Result.=.P/s;.(.*);;'
     last_result=$?
     result=`expr $result + $last_result`
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 request=KASFunctionTest_ECCEphemeralUnified_NOKC_ZZOnly_init.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest ecdh init-func ${REQDIR}/$request > ${RSPDIR}/$response
 
 request=KASFunctionTest_ECCEphemeralUnified_NOKC_ZZOnly_resp.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
--- a/tests/fips/cavs_scripts/rng.sh
+++ b/tests/fips/cavs_scripts/rng.sh
@@ -25,14 +25,17 @@ if [ ${COMMAND} = "verify" ]; then
     result=0;
     for request in $drbg_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
+
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $drbg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest drbg ${REQDIR}/$request > ${RSPDIR}/$response
 done
 exit 0
--- a/tests/fips/cavs_scripts/rsa.sh
+++ b/tests/fips/cavs_scripts/rsa.sh
@@ -33,16 +33,18 @@ if [ ${COMMAND} = "verify" ]; then
     last_result=$?
     result=`expr $result + $last_result`
 #
 # currently don't have a way to verify the RSA keygen
 #
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 request=SigGen15_186-3.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
 fipstest rsa siggen ${REQDIR}/$request > ${RSPDIR}/$response
 
 request=SigVer15_186-3.req
 response=`echo $request | sed -e "s/req/rsp/"`
 echo $request $response
--- a/tests/fips/cavs_scripts/sha.sh
+++ b/tests/fips/cavs_scripts/sha.sh
@@ -46,16 +46,18 @@ if [ ${COMMAND} = "verify" ]; then
     for request in $sha_ShortMsg_requests $sha_LongMsg_requests $sha_Monte_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $sha_ShortMsg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest sha ${REQDIR}/$request > ${RSPDIR}/$response
 done
 for request in $sha_LongMsg_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
--- a/tests/fips/cavs_scripts/tdea.sh
+++ b/tests/fips/cavs_scripts/tdea.sh
@@ -72,16 +72,18 @@ if [ ${COMMAND} = "verify" ]; then
     do
 	sh ./validate1.sh ${TESTDIR} $request "-e /^NumKeys/d"
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
 
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $cbc_kat_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest tdea kat cbc ${REQDIR}/$request > ${RSPDIR}/$response
 done
 for request in $cbc_mmt_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
--- a/tests/fips/cavs_scripts/tls.sh
+++ b/tests/fips/cavs_scripts/tls.sh
@@ -25,14 +25,17 @@ if [ ${COMMAND} = "verify" ]; then
     result=0
     for request in $tls_requests; do
 	sh ./validate1.sh ${TESTDIR} $request
 	last_result=$?
 	result=`expr $result + $last_result`
     done
     exit $result
 fi
+
+test -d "${RSPDIR}" || mkdir "${RSPDIR}"
+
 for request in $tls_requests; do
     response=`echo $request | sed -e "s/req/rsp/"`
     echo $request $response
     fipstest tls ${REQDIR}/$request > ${RSPDIR}/$response
 done
 exit 0