summaryrefslogtreecommitdiffstats
path: root/nss/tests/ec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 05:42:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 05:42:23 +0000
commitf21331c8511c3a464bc0a6eb26367e1b43cae692 (patch)
tree71cc0d26e3e94ab289567db2071b0f247995d2ee /nss/tests/ec
parentInitial commit. (diff)
downloadnss-upstream/2%3.99.tar.xz
nss-upstream/2%3.99.zip
Adding upstream version 2:3.99.upstream/2%3.99
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'nss/tests/ec')
-rwxr-xr-xnss/tests/ec/ec.sh37
-rwxr-xr-xnss/tests/ec/ecperf.sh52
-rwxr-xr-xnss/tests/ec/ectest.sh93
3 files changed, 182 insertions, 0 deletions
diff --git a/nss/tests/ec/ec.sh b/nss/tests/ec/ec.sh
new file mode 100755
index 0000000..9869b65
--- /dev/null
+++ b/nss/tests/ec/ec.sh
@@ -0,0 +1,37 @@
+#! /bin/bash
+#
+# 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/.
+
+########################################################################
+#
+# tests/ec/ec.sh
+#
+# needs to work on all Unix and Windows platforms
+# this is a meta script to drive all ec tests
+#
+# special strings
+# ---------------
+# FIXME ... known problems, search for this string
+# NOTE .... unexpected behavior
+#
+########################################################################
+
+############################## run_tests ###############################
+# run test suites defined in ECTESTS variable
+########################################################################
+run_ec_tests()
+{
+ for ECTEST in ${ECTESTS}
+ do
+ SCRIPTNAME=${ECTEST}.sh
+ echo "Running ec tests for ${ECTEST}"
+ echo "TIMESTAMP ${ECTEST} BEGIN: `date`"
+ (cd ${QADIR}/ec; . ./${SCRIPTNAME} 2>&1)
+ echo "TIMESTAMP ${ECTEST} END: `date`"
+ done
+}
+
+ECTESTS="ecperf ectest"
+run_ec_tests
diff --git a/nss/tests/ec/ecperf.sh b/nss/tests/ec/ecperf.sh
new file mode 100755
index 0000000..501488e
--- /dev/null
+++ b/nss/tests/ec/ecperf.sh
@@ -0,0 +1,52 @@
+#! /bin/bash
+#
+# 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/.
+
+########################################################################
+#
+# tests/ec/ecperf.sh
+#
+# needs to work on all Unix and Windows platforms
+#
+# special strings
+# ---------------
+# FIXME ... known problems, search for this string
+# NOTE .... unexpected behavior
+#
+########################################################################
+
+############################## ecperf_init #############################
+# local shell function to initialize this script
+########################################################################
+
+ecperf_init()
+{
+ SCRIPTNAME="ecperf.sh"
+ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ] ; then
+ cd ../common
+ . ./init.sh
+ fi
+ SCRIPTNAME="ecperf.sh"
+ html_head "ecperf test"
+}
+
+ecperf_cleanup()
+{
+ html "</TABLE><BR>"
+ cd ${QADIR}
+ . common/cleanup.sh
+}
+
+ecperf_init
+ECPERF_OUT=$(ecperf 2>&1)
+echo "$ECPERF_OUT"
+ECPERF_OUT=`echo $ECPERF_OUT | grep -i 'failed\|Assertion failure'`
+# TODO: this is a perf test we don't check for performance here but only failed
+if [ -n "$ECPERF_OUT" ] ; then
+ html_failed "ec(perf) test"
+else
+ html_passed "ec(perf) test"
+fi
+ecperf_cleanup
diff --git a/nss/tests/ec/ectest.sh b/nss/tests/ec/ectest.sh
new file mode 100755
index 0000000..e107605
--- /dev/null
+++ b/nss/tests/ec/ectest.sh
@@ -0,0 +1,93 @@
+#! /bin/bash
+#
+# 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/.
+
+########################################################################
+#
+# tests/ec/ectest.sh
+#
+# needs to work on all Unix and Windows platforms
+#
+# special strings
+# ---------------
+# FIXME ... known problems, search for this string
+# NOTE .... unexpected behavior
+#
+########################################################################
+
+############################## ectest_init #############################
+# local shell function to initialize this script
+########################################################################
+
+ectest_init()
+{
+ SCRIPTNAME="ectest.sh"
+ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ] ; then
+ cd ../common
+ . ./init.sh
+ fi
+ SCRIPTNAME="ectest.sh"
+ html_head "freebl and pk11 ectest tests"
+}
+
+ectest_cleanup()
+{
+ html "</TABLE><BR>"
+ cd ${QADIR}
+ . common/cleanup.sh
+}
+
+ectest_genkeydb_test()
+{
+ certutil -N -d "${HOSTDIR}" -f "${R_PWFILE}" 2>&1
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
+ curves=( \
+ "curve25519" \
+ "secp256r1" \
+ "secp384r1" \
+ "secp521r1" \
+ )
+ for curve in "${curves[@]}"; do
+ echo "Test $curve key generation using certutil ..."
+ certutil -G -d "${HOSTDIR}" -k ec -q $curve -f "${R_PWFILE}" -z ${NOISE_FILE}
+ if [ $? -ne 0 ]; then
+ html_failed "ec test certutil keygen - $curve"
+ else
+ html_passed "ec test certutil keygen - $curve"
+ fi
+ done
+ echo "Test sect571r1 key generation using certutil that should fail because it's not implemented ..."
+ certutil -G -d "${HOSTDIR}" -k ec -q sect571r1 -f "${R_PWFILE}" -z ${NOISE_FILE}
+ if [ $? -eq 0 ]; then
+ html_failed "ec test certutil keygen - $curve"
+ else
+ html_passed "ec test certutil keygen - $curve"
+ fi
+}
+
+ectest_init
+ectest_genkeydb_test
+# TODO: expose individual tests and failures instead of overall
+if [ -f ${BINDIR}/fbectest ]; then
+ FB_ECTEST_OUT=$(fbectest -n -d 2>&1)
+ FB_ECTEST_OUT=`echo $FB_ECTEST_OUT | grep -i 'not okay\|Assertion failure'`
+ if [ -n "$FB_ECTEST_OUT" ] ; then
+ html_failed "freebl ec tests"
+ else
+ html_passed "freebl ec tests"
+ fi
+fi
+if [ -f ${BINDIR}/pk11ectest ]; then
+ PK11_ECTEST_OUT=$(pk11ectest -n -d 2>&1)
+ PK11_ECTEST_OUT=`echo $PK11_ECTEST_OUT | grep -i 'not okay\|Assertion failure'`
+ if [ -n "$PK11_ECTEST_OUT" ] ; then
+ html_failed "pk11 ec tests"
+ else
+ html_passed "pk11 ec tests"
+ fi
+fi
+ectest_cleanup