From e7f1eaafcbe917d7e124c8e0daff8a7065680196 Mon Sep 17 00:00:00 2001 From: "mcgreer%netscape.com" Date: Wed, 27 Sep 2000 23:04:01 +0000 Subject: [PATCH] shell script to run self-tests on ciphers supported by NSS. --- security/nss/tests/cipher/cipher.sh | 190 ++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100755 security/nss/tests/cipher/cipher.sh diff --git a/security/nss/tests/cipher/cipher.sh b/security/nss/tests/cipher/cipher.sh new file mode 100755 index 000000000000..132c85c48130 --- /dev/null +++ b/security/nss/tests/cipher/cipher.sh @@ -0,0 +1,190 @@ +#! /bin/ksh +# +# This is just a quick script so we can still run our testcases. +# Longer term we need a scriptable test environment.. +# +. ../common/init.sh +CURDIR=`pwd` + +CIPHERDIR=${HOSTDIR}/cipher +CIPHERTESTDIR=${CURDIR}/../../cmd/bltest + +echo "" >> ${RESULTS} + +#temporary files +TMP=${TMP-/tmp} + +#TEMPFILES="${NOISE_FILE}" + +# +# should also try to kill any running server +# +#trap "rm -f ${TEMPFILES}; exit" 2 3 + +mkdir -p ${CIPHERDIR} + +echo "" >> ${RESULTS} +echo "" >> ${RESULTS} + +bltest -T des_ecb -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DES ECB Encrypt"} +fi +bltest -T des_ecb -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DES ECB Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T des_cbc -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DES CBC Encrypt"} +fi +bltest -T des_cbc -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DES CBC Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T des3_ecb -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"3DES ECB Encrypt"} +fi +bltest -T des3_ecb -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"3DES ECB Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T des3_cbc -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"3DES CBC Encrypt"} +fi +bltest -T des3_cbc -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"3DES CBC Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T rc2_ecb -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC2 ECB Encrypt"} +fi +bltest -T rc2_ecb -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC2 ECB Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T rc2_cbc -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC2 CBC Encrypt"} +fi +bltest -T rc2_cbc -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC2 CBC Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T rc4 -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC4 Encrypt"} +fi +bltest -T rc4 -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RC4 Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T rsa -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RSA Encrypt"} +fi +bltest -T rsa -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"RSA Encrypt"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T dsa -E -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DSA Sign"} +fi +bltest -T dsa -D -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"DSA Verify"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T md2 -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"MD2 Hash"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T md5 -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"MD5 Hash"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +bltest -T sha1 -d ${CIPHERTESTDIR} +if [ $? -ne 0 ]; then + CIPHERFAILED=${CIPHERFAILED-"SHA1 Hash"} +fi +if [ -n "${CIPHERFAILED}" ]; then + echo "" >> ${RESULTS} +else + echo "" >> ${RESULTS} +fi + +echo "
Cipher Tests
Test CaseResult
DES ECBFailed ($CMSFAILED)
DES ECBPassed
DES CBCFailed ($CMSFAILED)
DES CBCPassed
3DES ECBFailed ($CMSFAILED)
3DES ECBPassed
3DES CBCFailed ($CMSFAILED)
3DES CBCPassed
RC2 ECBFailed ($CMSFAILED)
RC2 ECBPassed
RC2 CBCFailed ($CMSFAILED)
RC2 CBCPassed
RC4Failed ($CMSFAILED)
RC4Passed
RSAFailed ($CMSFAILED)
RSAPassed
DSAFailed ($CMSFAILED)
DSAPassed
MD2Failed ($CMSFAILED)
MD2Passed
MD5Failed ($CMSFAILED)
MD5Passed
SHA1Failed ($CMSFAILED)
SHA1Passed

" >> ${RESULTS} + +rm -f ${TEMPFILES} +cd ${CURDIR} + +echo "" >> ${RESULTS}