summaryrefslogtreecommitdiffstats
path: root/security/nss/tests/libpkix/sample_apps
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /security/nss/tests/libpkix/sample_apps
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'security/nss/tests/libpkix/sample_apps')
-rwxr-xr-xsecurity/nss/tests/libpkix/sample_apps/README77
-rwxr-xr-xsecurity/nss/tests/libpkix/sample_apps/cert8.dbbin0 -> 65536 bytes
-rwxr-xr-xsecurity/nss/tests/libpkix/sample_apps/key3.dbbin0 -> 32768 bytes
-rwxr-xr-xsecurity/nss/tests/libpkix/sample_apps/runPerf.sh143
-rwxr-xr-xsecurity/nss/tests/libpkix/sample_apps/secmod.dbbin0 -> 32768 bytes
5 files changed, 220 insertions, 0 deletions
diff --git a/security/nss/tests/libpkix/sample_apps/README b/security/nss/tests/libpkix/sample_apps/README
new file mode 100755
index 0000000000..012e7bf7eb
--- /dev/null
+++ b/security/nss/tests/libpkix/sample_apps/README
@@ -0,0 +1,77 @@
+# 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/.
+
+This directory contains both sample applications and performance evaluation
+applications.
+
+SAMPLE APPLICATIONS
+
+Currently, there are two performance applications: libpkix_buildThreads and
+nss_threads. And three sample applications: dumpcert, dumpcrl and
+validateChain..
+
+============================================================================
+
+USAGE: dumpcert <certFile>
+ Parses a certificate located at <certFile> and displays it.
+
+Source: <root>/tests/sample_apps/dumpcert.c
+Binary: <root>/bin/sample_apps/dumpcert
+
+============================================================================
+
+USAGE: dumpcrl <crlFile>
+ Parses a CRL located at <crlFile> and displays it.
+
+Source: <root>/tests/sample_apps/dumpcrl.c
+Binary: <root>/bin/sample_apps/dumpcrl
+
+============================================================================
+
+USAGE: validateChain <trustedCert> <cert_1> <cert_2> ... <cert_n>
+ Validates a chain of n certificates using the given trust anchor.
+
+Source: <root>/tests/sample_apps/validateChain.c
+Binary: <root>/bin/sample_apps/validateChain
+
+============================================================================
+
+PERFORMANCE EVALUATION APPLICATIONS
+
+============================================================================
+
+USAGE: libpkix_buildthreads <duration> <threads> <eecertNickname>
+
+ Sets up and runs a PKIX_BuildChain call for the number of seconds
+ specified by <duration> using the number of threads specified by
+ <threads>. This application assumes that the NSS certutil application
+ has already been run to create the NSS databases and that the
+ various nicknames on the command line have been associated with
+ certificates in the NSS databases. The NSS databases MUST reside
+ in the directory where this file is located and MUST be named
+ "cert8.db", "key3.db", and "secmod.db". There must exist a nickname
+ in the databases which has been marked as trusted.
+
+Source: <root>/perf/libpkix_buildthreads/libpkix_buildthreads.c
+Binary: <root>/perf/libpkix_buildthreads/*.OBJ/libpkix_buildthreads
+
+============================================================================
+
+USAGE: nssThreads <duration> <threads> <eecertNickname>
+
+ Sets up and runs a CERT_VerifyCertificate call for the number of
+ seconds specified by <duration> using the number of threads specified
+ by <threads>. This application assumes that the NSS certutil
+ application has already been run to create the NSS databases and that
+ the various nicknames on the command line have been associated with
+ certificates in the NSS databases. The NSS databases MUST reside
+ in the directory where this file is located and MUST be named
+ "cert8.db", "key3.db", and "secmod.db". There must exist a nickname in
+ the databases which has been marked as trusted.
+
+Source: <root>/perf/nss_threads/nss_threads.c
+Binary: <root>/perf/nss_threads/*.OBJ/nss_threads
+
+============================================================================
+
diff --git a/security/nss/tests/libpkix/sample_apps/cert8.db b/security/nss/tests/libpkix/sample_apps/cert8.db
new file mode 100755
index 0000000000..b39de42f18
--- /dev/null
+++ b/security/nss/tests/libpkix/sample_apps/cert8.db
Binary files differ
diff --git a/security/nss/tests/libpkix/sample_apps/key3.db b/security/nss/tests/libpkix/sample_apps/key3.db
new file mode 100755
index 0000000000..9c03916ee8
--- /dev/null
+++ b/security/nss/tests/libpkix/sample_apps/key3.db
Binary files differ
diff --git a/security/nss/tests/libpkix/sample_apps/runPerf.sh b/security/nss/tests/libpkix/sample_apps/runPerf.sh
new file mode 100755
index 0000000000..27b55215e3
--- /dev/null
+++ b/security/nss/tests/libpkix/sample_apps/runPerf.sh
@@ -0,0 +1,143 @@
+#!/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/.
+#
+# runPerf.sh
+#
+
+curdir=`pwd`
+cd ../common
+. ./libpkix_init.sh > /dev/null
+cd ${curdir}
+
+numtests=0
+passed=0
+testunit=PERFORMANCE
+
+totalErrors=0
+loopErrors=0
+
+ParseArgs $*
+
+testHeadingEcho
+
+Display "\nRunning executables at ${DIST_BIN}"
+Display "Using libraries at ${LD_LIBRARY_PATH}"
+
+
+# Check the performance data ...
+perfTest()
+{
+
+ Display ""
+ Display "*******************************************************************************"
+ Display "START OF PKIX PERFORMANCE SCENARIOS ${memText}"
+Display "*******************************************************************************"
+ Display ""
+
+ while read perfPgm args; do
+ numtests=`expr ${numtests} + 1`
+ Display "Running ${perfPgm} ${args}"
+ if [ ${checkmem} -eq 1 ]; then
+ dbx -C -c "runargs $args; check -all ;run;exit" ${DIST_BIN}/${perfPgm} > ${testOut} 2>&1
+ else
+ ${DIST_BIN}/${perfPgm} ${args} > ${testOut} 2>&1
+ fi
+
+ # Examine output file to see if test failed and keep track of number
+ # of failures and names of failed tests. This assumes that the test
+ # uses our utility library for displaying information
+
+ outputCount=`cat ${testOut} | grep "per second"`
+
+ if [ $? -ne 0 ]; then
+ errors=`expr ${errors} + 1`
+ failedpgms="${failedpgms}${perfPgm} ${args}\n"
+ cat ${testOut}
+ else
+ Display ${outputCount}
+ passed=`expr ${passed} + 1`
+ fi
+
+ if [ ${checkmem} -eq 1 ]; then
+ grep "(actual leaks:" ${testOut} > ${testOutMem} 2>&1
+ if [ $? -ne 0 ]; then
+ prematureErrors=`expr ${prematureErrors} + 1`
+ failedprematurepgms="${failedprematurepgms}${perfPgm} "
+ Display "...program terminated prematurely (unable to check for memory leak errors) ..."
+ else
+ grep "(actual leaks: 1 total size: 4 bytes)" ${testOut} > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ memErrors=`expr ${memErrors} + 1`
+ failedmempgms="${failedmempgms}${perfPgm} "
+ Display ${testOutMem}
+ fi
+ fi
+ fi
+ done
+ return ${errors}
+}
+
+
+# If there is race condition bug, may this test catch it...
+loopTest()
+{
+ totalLoop=10
+
+ Display ""
+ Display "*******************************************************************************"
+ Display "START OF TESTS FOR PKIX PERFORMANCE SANITY LOOP (${totalLoop} times)"
+Display "*******************************************************************************"
+ Display ""
+
+ errors=0
+ iLoop=0
+ perfPgm="${DIST_BIN}/pkixutil libpkix_buildthreads -d . 5 8 ValidCertificatePathTest1EE"
+
+ while [ $iLoop -lt $totalLoop ]
+ do
+ iLoop=`expr $iLoop + 1`
+ numtests=`expr ${numtests} + 1`
+
+ Display "Running ${perfPgm}"
+ ${perfPgm} > ${testOut} 2>&1
+ Display `cat ${testOut} | grep "per second"`
+
+ outputCount=`cat ${testOut} | grep "per second"`
+
+ if [ $? -ne 0 ]; then
+ errors=`expr ${errors} + 1`
+ failedpgms="${failedpgms} ${perfPgm}\n"
+ cat ${testOut}
+ else
+ passed=`expr ${passed} + 1`
+ fi
+ done
+
+ return ${errors}
+
+}
+
+#main
+perfTest <<EOF
+pkixutil libpkix_buildthreads -d . 5 1 ValidCertificatePathTest1EE
+pkixutil libpkix_buildthreads -d . 5 8 ValidCertificatePathTest1EE
+pkixutil nss_threads -d . 5 1 ValidCertificatePathTest1EE
+pkixutil nss_threads -d . 5 8 ValidCertificatePathTest1EE
+EOF
+
+totalErrors=$?
+html_msg ${totalErrors} 0 "&nbsp;&nbsp;&nbsp;performance test: passed ${passed} of ${numtests} tests"
+
+numtests=0
+passed=0
+loopTest
+loopErrors=$?
+totalErrors=`expr ${totalErrors} + ${loopErrors}`
+html_msg ${totalErrors} 0 "&nbsp;&nbsp;&nbsp;loop test: passed ${passed} of ${numtests} tests"
+
+testEndingEcho
+
+exit ${totalErrors}
diff --git a/security/nss/tests/libpkix/sample_apps/secmod.db b/security/nss/tests/libpkix/sample_apps/secmod.db
new file mode 100755
index 0000000000..772583d58b
--- /dev/null
+++ b/security/nss/tests/libpkix/sample_apps/secmod.db
Binary files differ