summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-12-02 22:57:21 +0000
committerwtc%netscape.com <devnull@localhost>2002-12-02 22:57:21 +0000
commit434e96a52af883d3de3c8dfa2cadb5399b68848a (patch)
treeae3084d1de25f239c6b5901d7f7cfe9a51ba47df
parentc2b1b2e3adf530cd731c57f2aafbffb76335ffc1 (diff)
parentd52ffc22348f9c888f9c4a64ec74c7d786894956 (diff)
downloadnss-hg-434e96a52af883d3de3c8dfa2cadb5399b68848a.tar.gz
Bug 181913: disable the makefile rule for .s for OS/2 so that .asm files
are used when there are same-named .s files in the same directory. The patch is contributed by Javier Pedemonte <pedemont@us.ibm.com>.
-rw-r--r--dbm/src/nsres.c6
-rw-r--r--security/coreconf/README3
-rw-r--r--security/coreconf/SunOS5.mk3
-rw-r--r--security/coreconf/WIN32.mk7
-rw-r--r--security/coreconf/config.mk2
-rwxr-xr-xsecurity/coreconf/release.pl7
-rw-r--r--security/coreconf/rules.mk8
-rw-r--r--security/dbm/Makefile80
-rw-r--r--security/dbm/config/config.mk67
-rw-r--r--security/dbm/include/Makefile76
-rw-r--r--security/dbm/include/manifest.mn57
-rw-r--r--security/dbm/manifest.mn (renamed from security/coreconf/platform.mk)15
-rw-r--r--security/dbm/src/Makefile76
-rw-r--r--security/dbm/src/config.mk63
-rw-r--r--security/dbm/src/dirent.c348
-rw-r--r--security/dbm/src/dirent.h97
-rw-r--r--security/dbm/src/manifest.mn61
-rw-r--r--security/dbm/tests/Makefile69
-rw-r--r--security/nss/cmd/bltest/blapitest.c138
-rw-r--r--security/nss/cmd/bltest/tests/sha256/ciphertext01
-rw-r--r--security/nss/cmd/bltest/tests/sha256/ciphertext11
-rw-r--r--security/nss/cmd/bltest/tests/sha256/numtests1
-rw-r--r--security/nss/cmd/bltest/tests/sha256/plaintext01
-rw-r--r--security/nss/cmd/bltest/tests/sha256/plaintext11
-rw-r--r--security/nss/cmd/bltest/tests/sha384/ciphertext01
-rw-r--r--security/nss/cmd/bltest/tests/sha384/ciphertext11
-rw-r--r--security/nss/cmd/bltest/tests/sha384/numtests1
-rw-r--r--security/nss/cmd/bltest/tests/sha384/plaintext01
-rw-r--r--security/nss/cmd/bltest/tests/sha384/plaintext11
-rw-r--r--security/nss/cmd/bltest/tests/sha512/ciphertext02
-rw-r--r--security/nss/cmd/bltest/tests/sha512/ciphertext12
-rw-r--r--security/nss/cmd/bltest/tests/sha512/numtests1
-rw-r--r--security/nss/cmd/bltest/tests/sha512/plaintext01
-rw-r--r--security/nss/cmd/bltest/tests/sha512/plaintext11
-rw-r--r--security/nss/cmd/vfychain/Makefile82
-rw-r--r--security/nss/cmd/vfychain/manifest.mn51
-rw-r--r--security/nss/cmd/vfychain/vfychain.c435
-rw-r--r--security/nss/lib/cryptohi/hasht.h15
-rw-r--r--security/nss/lib/cryptohi/sechash.c42
-rw-r--r--security/nss/lib/freebl/blapi.h52
-rw-r--r--security/nss/lib/freebl/ldvector.c44
-rw-r--r--security/nss/lib/freebl/loader.c275
-rw-r--r--security/nss/lib/freebl/loader.h49
-rw-r--r--security/nss/lib/freebl/manifest.mn1
-rw-r--r--security/nss/lib/pk11wrap/debug_module.c1420
-rw-r--r--security/nss/lib/softoken/alghmac.c2
-rw-r--r--security/nss/lib/softoken/dbmshim.c43
-rw-r--r--security/nss/lib/softoken/pkcs11i.h4
-rw-r--r--security/nss/lib/softoken/pkcs11n.h10
-rw-r--r--security/nss/lib/softoken/rawhash.c24
-rw-r--r--security/nss/lib/util/secoid.c26
-rw-r--r--security/nss/lib/util/secoidt.h8
-rw-r--r--security/nss/pkg/solaris/Makefile56
-rw-r--r--security/nss/pkg/solaris/Makefile.com33
-rw-r--r--security/nss/pkg/solaris/Makefile.targ26
-rw-r--r--security/nss/pkg/solaris/SUNWtls/Makefile16
-rw-r--r--security/nss/pkg/solaris/SUNWtls/pkgdepend28
-rw-r--r--security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl34
-rw-r--r--security/nss/pkg/solaris/SUNWtls/prototype_com32
-rw-r--r--security/nss/pkg/solaris/SUNWtls/prototype_i38630
-rw-r--r--security/nss/pkg/solaris/SUNWtls/prototype_sparc33
-rw-r--r--security/nss/pkg/solaris/SUNWtlsx/Makefile16
-rw-r--r--security/nss/pkg/solaris/SUNWtlsx/pkgdepend31
-rw-r--r--security/nss/pkg/solaris/SUNWtlsx/pkginfo.tmpl35
-rw-r--r--security/nss/pkg/solaris/SUNWtlsx/prototype_com28
-rw-r--r--security/nss/pkg/solaris/SUNWtlsx/prototype_sparc37
-rw-r--r--security/nss/pkg/solaris/bld_awk_pkginfo.ksh105
-rw-r--r--security/nss/pkg/solaris/common_files/copyright28
-rw-r--r--security/nss/tests/cipher/cipher.txt3
-rw-r--r--security/nss/tests/cmdtests/cmdtests.sh132
70 files changed, 3401 insertions, 1085 deletions
diff --git a/dbm/src/nsres.c b/dbm/src/nsres.c
index e383d58e5..4b4dae4a2 100644
--- a/dbm/src/nsres.c
+++ b/dbm/src/nsres.c
@@ -79,8 +79,7 @@ NSRESHANDLE NSResCreateTable(const char *filename, NSRESTHREADINFO *threadinfo)
flag = O_RDWR | O_CREAT;
- hres = (RESHANDLE) malloc ( sizeof(struct RESDATABASE) );
- memset(hres, 0, sizeof(struct RESDATABASE));
+ hres = (RESHANDLE) calloc ( 1, sizeof(struct RESDATABASE) );
if (threadinfo && threadinfo->lock && threadinfo->fn_lock
&& threadinfo->fn_unlock)
@@ -111,8 +110,7 @@ NSRESHANDLE NSResOpenTable(const char *filename, NSRESTHREADINFO *threadinfo)
flag = O_RDONLY; /* only open database for reading */
- hres = (RESHANDLE) malloc ( sizeof(struct RESDATABASE) );
- memset(hres, 0, sizeof(struct RESDATABASE));
+ hres = (RESHANDLE) calloc ( 1, sizeof(struct RESDATABASE) );
if (threadinfo && threadinfo->lock && threadinfo->fn_lock
&& threadinfo->fn_unlock)
diff --git a/security/coreconf/README b/security/coreconf/README
index dcacd2a85..100a38501 100644
--- a/security/coreconf/README
+++ b/security/coreconf/README
@@ -232,9 +232,6 @@ OVERVIEW of "config.mk":
$(OS_CONFIG).mk <architecture>-specific macros
(dependent upon <architecture> tags)
- platform.mk source and release <platform> tags
- (dependent upon <architecture> tags)
-
tree.mk release <tree> tags
(dependent upon <architecture> tags)
diff --git a/security/coreconf/SunOS5.mk b/security/coreconf/SunOS5.mk
index 47ed8333f..a0179bc5e 100644
--- a/security/coreconf/SunOS5.mk
+++ b/security/coreconf/SunOS5.mk
@@ -57,7 +57,6 @@ ifeq ($(USE_64), 1)
else
ARCHFLAG=-xarch=v9
endif
- LD=/usr/ccs/bin/ld
else
ifdef NS_USE_GCC
ifdef USE_HYBRID
@@ -74,6 +73,8 @@ else
endif
endif
+LD=/usr/ccs/bin/ld
+
#
# The default implementation strategy for Solaris is classic nspr.
#
diff --git a/security/coreconf/WIN32.mk b/security/coreconf/WIN32.mk
index 1c438cf64..a61a9f8c7 100644
--- a/security/coreconf/WIN32.mk
+++ b/security/coreconf/WIN32.mk
@@ -73,6 +73,13 @@ ifdef BUILD_OPT
OPTIMIZER += -O2
DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS += -OUT:"$@"
+ #
+ # Add symbolic information for a profiler
+ #
+ ifdef MOZ_PROFILE
+ OPTIMIZER += -Z7
+ DLLFLAGS += -DEBUG -DEBUGTYPE:CV
+ endif
else
#
# Define USE_DEBUG_RTL if you want to use the debug runtime library
diff --git a/security/coreconf/config.mk b/security/coreconf/config.mk
index 01b633be8..949d27ef6 100644
--- a/security/coreconf/config.mk
+++ b/security/coreconf/config.mk
@@ -70,9 +70,7 @@ endif
# [4.0] Master "Core Components" source and release <platform> tags #
# (dependent upon <architecture> tags) #
#######################################################################
-ifndef PLATFORM
PLATFORM = $(OBJDIR_NAME)
-endif
#######################################################################
# [5.0] Master "Core Components" release <tree> tags #
diff --git a/security/coreconf/release.pl b/security/coreconf/release.pl
index 0a16727e1..34df755e2 100755
--- a/security/coreconf/release.pl
+++ b/security/coreconf/release.pl
@@ -59,13 +59,6 @@ foreach $jarfile (split(/ /,$var{FILES}) ) {
}
}
-# don't compress jar files containing classes since some java
-# implementations do not implement decompression correctly
- if ( ($jarfile eq 'xpclass.jar') || ($jarfile eq 'xpclass_dbg.jar') ) {
- $zipoptions .= ' -0';
- }
-
-
# just in case the directory ends in a /, remove it
if ($jardir =~ /\/$/) {
chop $jardir;
diff --git a/security/coreconf/rules.mk b/security/coreconf/rules.mk
index c53c1ffc5..4b4568790 100644
--- a/security/coreconf/rules.mk
+++ b/security/coreconf/rules.mk
@@ -87,6 +87,10 @@ import::
"$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \
"$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|" \
"$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|"
+# On Mac OS X ranlib needs to be rerun after static libs are moved.
+ifeq ($(OS_TARGET),Darwin)
+ find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \;
+endif
export::
+$(LOOP_OVER_DIRS)
@@ -323,7 +327,7 @@ SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(addprefix $(dir)/,$(shell $
endif
endif
-$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
+$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS)
@$(MAKE_OBJDIR)
rm -f $@
ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1)
@@ -414,11 +418,13 @@ else
$(CC) -o $@ -c $(CFLAGS) $<
endif
+ifndef XP_OS2_VACPP
ifneq (,$(filter-out WIN%,$(OS_TARGET)))
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s
@$(MAKE_OBJDIR)
$(AS) -o $@ $(ASFLAGS) -c $<
endif
+endif
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm
@$(MAKE_OBJDIR)
diff --git a/security/dbm/Makefile b/security/dbm/Makefile
new file mode 100644
index 000000000..34cd6d899
--- /dev/null
+++ b/security/dbm/Makefile
@@ -0,0 +1,80 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+coreconf_hack:
+ cd ../coreconf; gmake
+ gmake import
+
+RelEng_bld: coreconf_hack
+ gmake
diff --git a/security/dbm/config/config.mk b/security/dbm/config/config.mk
new file mode 100644
index 000000000..753364931
--- /dev/null
+++ b/security/dbm/config/config.mk
@@ -0,0 +1,67 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+#
+# These macros are defined by mozilla's configure script.
+# We define them manually here.
+#
+
+DEFINES += -DSTDC_HEADERS -DHAVE_STRERROR
+
+#
+# Most platforms have snprintf, so it's simpler to list the exceptions.
+#
+HAVE_SNPRINTF = 1
+#
+# OSF1 V4.0D doesn't have snprintf but V5.0A does.
+#
+ifeq ($(OS_TARGET)$(OS_RELEASE),OSF1V4.0D)
+HAVE_SNPRINTF =
+endif
+ifdef HAVE_SNPRINTF
+DEFINES += -DHAVE_SNPRINTF
+endif
+
+ifeq (,$(filter-out IRIX Linux,$(OS_TARGET)))
+DEFINES += -DHAVE_SYS_CDEFS_H
+endif
+
+ifeq (,$(filter-out DGUX NCR ReliantUNIX SCO_SV SCOOS UNIXWARE,$(OS_TARGET)))
+DEFINES += -DHAVE_SYS_BYTEORDER_H
+endif
+
+#
+# None of the platforms that we are interested in need to
+# define HAVE_MEMORY_H.
+#
diff --git a/security/dbm/include/Makefile b/security/dbm/include/Makefile
new file mode 100644
index 000000000..ba4dd8ddf
--- /dev/null
+++ b/security/dbm/include/Makefile
@@ -0,0 +1,76 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+
+
diff --git a/security/dbm/include/manifest.mn b/security/dbm/include/manifest.mn
new file mode 100644
index 000000000..886fedd98
--- /dev/null
+++ b/security/dbm/include/manifest.mn
@@ -0,0 +1,57 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+CORE_DEPTH = ../..
+
+VPATH = $(CORE_DEPTH)/../dbm/include
+
+MODULE = dbm
+
+EXPORTS = nsres.h \
+ cdefs.h \
+ mcom_db.h \
+ ncompat.h \
+ winfile.h \
+ $(NULL)
+
+PRIVATE_EXPORTS = hsearch.h \
+ page.h \
+ extern.h \
+ ndbm.h \
+ queue.h \
+ hash.h \
+ mpool.h \
+ search.h \
+ $(NULL)
+
diff --git a/security/coreconf/platform.mk b/security/dbm/manifest.mn
index a4826d315..11f4f4237 100644
--- a/security/coreconf/platform.mk
+++ b/security/dbm/manifest.mn
@@ -1,3 +1,4 @@
+#! gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
@@ -31,8 +32,14 @@
# GPL.
#
-#######################################################################
-# Master "Core Components" <platform> tag #
-#######################################################################
+CORE_DEPTH = ..
-PLATFORM = $(OBJDIR_NAME)
+MODULE = dbm
+
+IMPORTS = nspr20/v4.1.2
+
+RELEASE = dbm
+
+DIRS = include \
+ src \
+ $(NULL)
diff --git a/security/dbm/src/Makefile b/security/dbm/src/Makefile
new file mode 100644
index 000000000..8fce98394
--- /dev/null
+++ b/security/dbm/src/Makefile
@@ -0,0 +1,76 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/dbm/config/config.mk
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+include config.mk
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+
+
diff --git a/security/dbm/src/config.mk b/security/dbm/src/config.mk
new file mode 100644
index 000000000..370fd75d6
--- /dev/null
+++ b/security/dbm/src/config.mk
@@ -0,0 +1,63 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+DEFINES += -DMEMMOVE -D__DBINTERFACE_PRIVATE $(SECURITY_FLAG)
+
+INCLUDES += -I$(CORE_DEPTH)/../dbm/include
+
+#
+# Currently, override TARGETS variable so that only static libraries
+# are specifed as dependencies within rules.mk.
+#
+
+TARGETS = $(LIBRARY)
+SHARED_LIBRARY =
+IMPORT_LIBRARY =
+PURE_LIBRARY =
+PROGRAM =
+
+ifdef SHARED_LIBRARY
+ ifeq (,$(filter-out WINNT WIN95 WINCE,$(OS_TARGET))) # list omits WIN16
+ DLLBASE=/BASE:0x30000000
+ RES=$(OBJDIR)/dbm.res
+ RESNAME=../include/dbm.rc
+ endif
+ ifeq ($(DLL_SUFFIX),dll)
+ DEFINES += -D_DLL
+ endif
+endif
+
+ifeq ($(OS_TARGET),AIX)
+ OS_LIBS += -lc_r
+endif
diff --git a/security/dbm/src/dirent.c b/security/dbm/src/dirent.c
new file mode 100644
index 000000000..001a48c5c
--- /dev/null
+++ b/security/dbm/src/dirent.c
@@ -0,0 +1,348 @@
+#ifdef OS2
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <dirent.h>
+#include <errno.h>
+
+/*#ifndef __EMX__
+#include <libx.h>
+#endif */
+
+#define INCL_DOSFILEMGR
+#define INCL_DOSERRORS
+#include <os2.h>
+
+#if OS2 >= 2
+# define FFBUF FILEFINDBUF3
+# define Word ULONG
+ /*
+ * LS20 recommends a request count of 100, but according to the
+ * APAR text it does not lead to missing files, just to funny
+ * numbers of returned entries.
+ *
+ * LS30 HPFS386 requires a count greater than 2, or some files
+ * are missing (those starting with a character less that '.').
+ *
+ * Novell looses entries which overflow the buffer. In previous
+ * versions of dirent2, this could have lead to missing files
+ * when the average length of 100 directory entries was 40 bytes
+ * or more (quite unlikely for files on a Novell server).
+ *
+ * Conclusion: Make sure that the entries all fit into the buffer
+ * and that the buffer is large enough for more than 2 entries
+ * (each entry is at most 300 bytes long). And ignore the LS20
+ * effect.
+ */
+# define Count 25
+# define BufSz (25 * (sizeof(FILEFINDBUF3)+1))
+#else
+# define FFBUF FILEFINDBUF
+# define Word USHORT
+# define BufSz 1024
+# define Count 3
+#endif
+
+#if defined(__IBMC__) || defined(__IBMCPP__)
+ #define error(rc) _doserrno = rc, errno = EOS2ERR
+#elif defined(MICROSOFT)
+ #define error(rc) _doserrno = rc, errno = 255
+#else
+ #define error(rc) errno = 255
+#endif
+
+struct _dirdescr {
+ HDIR handle; /* DosFindFirst handle */
+ char fstype; /* filesystem type */
+ Word count; /* valid entries in <ffbuf> */
+ long number; /* absolute number of next entry */
+ int index; /* relative number of next entry */
+ FFBUF * next; /* pointer to next entry */
+ char name[MAXPATHLEN+3]; /* directory name */
+ unsigned attrmask; /* attribute mask for seekdir */
+ struct dirent entry; /* buffer for directory entry */
+ BYTE ffbuf[BufSz];
+};
+
+/*
+ * Return first char of filesystem type, or 0 if unknown.
+ */
+static char
+getFSType(const char *path)
+{
+ static char cache[1+26];
+ char drive[3], info[512];
+ Word unit, infolen;
+ char r;
+
+ if (isalpha(path[0]) && path[1] == ':') {
+ unit = toupper(path[0]) - '@';
+ path += 2;
+ } else {
+ ULONG driveMap;
+#if OS2 >= 2
+ if (DosQueryCurrentDisk(&unit, &driveMap))
+#else
+ if (DosQCurDisk(&unit, &driveMap))
+#endif
+ return 0;
+ }
+
+ if ((path[0] == '\\' || path[0] == '/')
+ && (path[1] == '\\' || path[1] == '/'))
+ return 0;
+
+ if (cache [unit])
+ return cache [unit];
+
+ drive[0] = '@' + unit;
+ drive[1] = ':';
+ drive[2] = '\0';
+ infolen = sizeof info;
+#if OS2 >= 2
+ if (DosQueryFSAttach(drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen))
+ return 0;
+ if (infolen >= sizeof(FSQBUFFER2)) {
+ FSQBUFFER2 *p = (FSQBUFFER2 *)info;
+ r = p->szFSDName[p->cbName];
+ } else
+#else
+ if (DosQFSAttach((PSZ)drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen, 0))
+ return 0;
+ if (infolen >= 9) {
+ char *p = info + sizeof(USHORT);
+ p += sizeof(USHORT) + *(USHORT *)p + 1 + sizeof(USHORT);
+ r = *p;
+ } else
+#endif
+ r = 0;
+ return cache [unit] = r;
+}
+
+char *
+abs_path(const char *name, char *buffer, int len)
+{
+ char buf[4];
+ if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') {
+ buf[0] = name[0];
+ buf[1] = name[1];
+ buf[2] = '.';
+ buf[3] = '\0';
+ name = buf;
+ }
+#if OS2 >= 2
+ if (DosQueryPathInfo((PSZ)name, FIL_QUERYFULLNAME, buffer, len))
+#else
+ if (DosQPathInfo((PSZ)name, FIL_QUERYFULLNAME, (PBYTE)buffer, len, 0L))
+#endif
+ return NULL;
+ return buffer;
+}
+
+DIR *
+openxdir(const char *path, unsigned att_mask)
+{
+ DIR *dir;
+ char name[MAXPATHLEN+3];
+ Word rc;
+
+ dir = malloc(sizeof(DIR));
+ if (dir == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ strncpy(name, path, MAXPATHLEN);
+ name[MAXPATHLEN] = '\0';
+ switch (name[strlen(name)-1]) {
+ default:
+ strcat(name, "\\");
+ case '\\':
+ case '/':
+ case ':':
+ ;
+ }
+ strcat(name, ".");
+ if (!abs_path(name, dir->name, MAXPATHLEN+1))
+ strcpy(dir->name, name);
+ if (dir->name[strlen(dir->name)-1] == '\\')
+ strcat(dir->name, "*");
+ else
+ strcat(dir->name, "\\*");
+
+ dir->fstype = getFSType(dir->name);
+ dir->attrmask = att_mask | A_DIR;
+
+ dir->handle = HDIR_CREATE;
+ dir->count = 100;
+#if OS2 >= 2
+ rc = DosFindFirst(dir->name, &dir->handle, dir->attrmask,
+ dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD);
+#else
+ rc = DosFindFirst((PSZ)dir->name, &dir->handle, dir->attrmask,
+ (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0);
+#endif
+ switch (rc) {
+ default:
+ free(dir);
+ error(rc);
+ return NULL;
+ case NO_ERROR:
+ case ERROR_NO_MORE_FILES:
+ ;
+ }
+
+ dir->number = 0;
+ dir->index = 0;
+ dir->next = (FFBUF *)dir->ffbuf;
+
+ return (DIR *)dir;
+}
+
+DIR *
+opendir(const char *pathname)
+{
+ return openxdir(pathname, 0);
+}
+
+struct dirent *
+readdir(DIR *dir)
+{
+ static int dummy_ino = 2;
+
+ if (dir->index == dir->count) {
+ Word rc;
+ dir->count = 100;
+#if OS2 >= 2
+ rc = DosFindNext(dir->handle, dir->ffbuf,
+ sizeof dir->ffbuf, &dir->count);
+#else
+ rc = DosFindNext(dir->handle, (PFILEFINDBUF)dir->ffbuf,
+ sizeof dir->ffbuf, &dir->count);
+#endif
+ if (rc) {
+ error(rc);
+ return NULL;
+ }
+
+ dir->index = 0;
+ dir->next = (FFBUF *)dir->ffbuf;
+ }
+
+ if (dir->index == dir->count)
+ return NULL;
+
+ memcpy(dir->entry.d_name, dir->next->achName, dir->next->cchName);
+ dir->entry.d_name[dir->next->cchName] = '\0';
+ dir->entry.d_ino = dummy_ino++;
+ dir->entry.d_reclen = dir->next->cchName;
+ dir->entry.d_namlen = dir->next->cchName;
+ dir->entry.d_size = dir->next->cbFile;
+ dir->entry.d_attribute = dir->next->attrFile;
+ dir->entry.d_time = *(USHORT *)&dir->next->ftimeLastWrite;
+ dir->entry.d_date = *(USHORT *)&dir->next->fdateLastWrite;
+
+ switch (dir->fstype) {
+ case 'F': /* FAT */
+ case 'C': /* CDFS */
+ if (dir->next->attrFile & FILE_DIRECTORY)
+ strupr(dir->entry.d_name);
+ else
+ strlwr(dir->entry.d_name);
+ }
+
+#if OS2 >= 2
+ dir->next = (FFBUF *)((BYTE *)dir->next + dir->next->oNextEntryOffset);
+#else
+ dir->next = (FFBUF *)((BYTE *)dir->next->achName + dir->next->cchName + 1);
+#endif
+ ++dir->number;
+ ++dir->index;
+
+ return &dir->entry;
+}
+
+long
+telldir(DIR *dir)
+{
+ return dir->number;
+}
+
+void
+seekdir(DIR *dir, long off)
+{
+ if (dir->number > off) {
+ char name[MAXPATHLEN+2];
+ Word rc;
+
+ DosFindClose(dir->handle);
+
+ strcpy(name, dir->name);
+ strcat(name, "*");
+
+ dir->handle = HDIR_CREATE;
+ dir->count = 32767;
+#if OS2 >= 2
+ rc = DosFindFirst(name, &dir->handle, dir->attrmask,
+ dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD);
+#else
+ rc = DosFindFirst((PSZ)name, &dir->handle, dir->attrmask,
+ (PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0);
+#endif
+ switch (rc) {
+ default:
+ error(rc);
+ return;
+ case NO_ERROR:
+ case ERROR_NO_MORE_FILES:
+ ;
+ }
+
+ dir->number = 0;
+ dir->index = 0;
+ dir->next = (FFBUF *)dir->ffbuf;
+ }
+
+ while (dir->number < off && readdir(dir))
+ ;
+}
+
+void
+closedir(DIR *dir)
+{
+ DosFindClose(dir->handle);
+ free(dir);
+}
+
+/*****************************************************************************/
+
+#ifdef TEST
+
+main(int argc, char **argv)
+{
+ int i;
+ DIR *dir;
+ struct dirent *ep;
+
+ for (i = 1; i < argc; ++i) {
+ dir = opendir(argv[i]);
+ if (!dir)
+ continue;
+ while (ep = readdir(dir))
+ if (strchr("\\/:", argv[i] [strlen(argv[i]) - 1]))
+ printf("%s%s\n", argv[i], ep->d_name);
+ else
+ printf("%s/%s\n", argv[i], ep->d_name);
+ closedir(dir);
+ }
+
+ return 0;
+}
+
+#endif
+
+#endif /* OS2 */
+
diff --git a/security/dbm/src/dirent.h b/security/dbm/src/dirent.h
new file mode 100644
index 000000000..07a6c0ac8
--- /dev/null
+++ b/security/dbm/src/dirent.h
@@ -0,0 +1,97 @@
+#ifndef __DIRENT_H__
+#define __DIRENT_H__
+/*
+ * @(#)msd_dir.h 1.4 87/11/06 Public Domain.
+ *
+ * A public domain implementation of BSD directory routines for
+ * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
+ * August 1897
+ *
+ * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
+ * and returns 2 more pieces of information - file size & attribute.
+ * Plus a little reshuffling of some #define's positions December 1987
+ *
+ * Some modifications by Martin Junius 02-14-89
+ *
+ * AK900712
+ * AK910410 abs_path - make absolute path
+ *
+ */
+
+#ifdef __EMX__
+#include <sys/param.h>
+#else
+#if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC)
+#include <stdio.h>
+#ifdef MAXPATHLEN
+ #undef MAXPATHLEN
+#endif
+#define MAXPATHLEN (FILENAME_MAX*4)
+#define MAXNAMLEN FILENAME_MAX
+
+#else
+#include <param.h>
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* attribute stuff */
+#ifndef A_RONLY
+# define A_RONLY 0x01
+# define A_HIDDEN 0x02
+# define A_SYSTEM 0x04
+# define A_LABEL 0x08
+# define A_DIR 0x10
+# define A_ARCHIVE 0x20
+#endif
+
+struct dirent {
+#if defined(OS2) || defined(WIN32) /* use the layout of EMX to avoid trouble */
+ int d_ino; /* Dummy */
+ int d_reclen; /* Dummy, same as d_namlen */
+ int d_namlen; /* length of name */
+ char d_name[MAXNAMLEN + 1];
+ unsigned long d_size;
+ unsigned short d_attribute; /* attributes (see above) */
+ unsigned short d_time; /* modification time */
+ unsigned short d_date; /* modification date */
+#else
+ char d_name[MAXNAMLEN + 1]; /* garentee null termination */
+ char d_attribute; /* .. extension .. */
+ unsigned long d_size; /* .. extension .. */
+#endif
+};
+
+typedef struct _dirdescr DIR;
+/* the structs do not have to be defined here */
+
+extern DIR *opendir(const char *);
+extern DIR *openxdir(const char *, unsigned);
+extern struct dirent *readdir(DIR *);
+extern void seekdir(DIR *, long);
+extern long telldir(DIR *);
+extern void closedir(DIR *);
+#define rewinddir(dirp) seekdir(dirp, 0L)
+
+extern char * abs_path(const char *name, char *buffer, int len);
+
+#ifndef S_IFMT
+#define S_IFMT ( S_IFDIR | S_IFREG )
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/security/dbm/src/manifest.mn b/security/dbm/src/manifest.mn
new file mode 100644
index 000000000..80f2abfd0
--- /dev/null
+++ b/security/dbm/src/manifest.mn
@@ -0,0 +1,61 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+CORE_DEPTH = ../..
+
+VPATH = $(CORE_DEPTH)/../dbm/src
+
+MODULE = dbm
+
+#
+# memmove.c, snprintf.c, and strerror.c are not in CSRCS because
+# the Standard C Library has memmove and strerror and DBM is not
+# using snprintf.
+#
+
+CSRCS = db.c \
+ h_bigkey.c \
+ h_func.c \
+ h_log2.c \
+ h_page.c \
+ hash.c \
+ hash_buf.c \
+ hsearch.c \
+ mktemp.c \
+ ndbm.c \
+ nsres.c \
+ dirent.c \
+ $(NULL)
+
+LIBRARY_NAME = dbm
diff --git a/security/dbm/tests/Makefile b/security/dbm/tests/Makefile
new file mode 100644
index 000000000..fe132e19c
--- /dev/null
+++ b/security/dbm/tests/Makefile
@@ -0,0 +1,69 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+DEPTH = ../..
+CORE_DEPTH = ../..
+
+VPATH = $(CORE_DEPTH)/../dbm/tests
+
+MODULE = dbm
+
+CSRCS = lots.c
+
+PROGRAM = lots
+
+include $(DEPTH)/coreconf/config.mk
+
+include $(DEPTH)/dbm/config/config.mk
+
+ifeq (,$(filter-out WIN%,$(OS_TARGET)))
+LIBDBM = ../src/$(PLATFORM)/dbm$(STATIC_LIB_SUFFIX)
+else
+LIBDBM = ../src/$(PLATFORM)/libdbm$(STATIC_LIB_SUFFIX)
+endif
+
+INCLUDES += -I$(CORE_DEPTH)/../dbm/include
+
+LDFLAGS = $(LDOPTS) $(LIBDBM)
+
+include $(DEPTH)/coreconf/rules.mk
+
+lots.pure: lots
+ purify $(CC) -o lots.pure $(CFLAGS) $(OBJS) $(MYLIBS)
+
+crash: crash.o $(MYLIBS)
+ $(CC) -o crash $(CFLAGS) $^
+
+crash.pure: crash.o $(MYLIBS)
+ purify $(CC) -o crash.pure $(CFLAGS) $^
+
diff --git a/security/nss/cmd/bltest/blapitest.c b/security/nss/cmd/bltest/blapitest.c
index dfb511986..b3000b257 100644
--- a/security/nss/cmd/bltest/blapitest.c
+++ b/security/nss/cmd/bltest/blapitest.c
@@ -1256,6 +1256,123 @@ finish:
}
SECStatus
+SHA256_restart(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ SECStatus rv = SECSuccess;
+ SHA256Context *cx, *cx_cpy;
+ unsigned char *cxbytes;
+ unsigned int len;
+ unsigned int i, quarter;
+ cx = SHA256_NewContext();
+ SHA256_Begin(cx);
+ /* divide message by 4, restarting 3 times */
+ quarter = (src_length + 3)/ 4;
+ for (i=0; i < 4 && src_length > 0; i++) {
+ SHA256_Update(cx, src + i*quarter, PR_MIN(quarter, src_length));
+ len = SHA256_FlattenSize(cx);
+ cxbytes = PORT_Alloc(len);
+ SHA256_Flatten(cx, cxbytes);
+ cx_cpy = SHA256_Resurrect(cxbytes, NULL);
+ if (!cx_cpy) {
+ PR_fprintf(PR_STDERR, "%s: SHA256_Resurrect failed!\n", progName);
+ rv = SECFailure;
+ goto finish;
+ }
+ rv = PORT_Memcmp(cx, cx_cpy, len);
+ if (rv) {
+ SHA256_DestroyContext(cx_cpy, PR_TRUE);
+ PR_fprintf(PR_STDERR, "%s: SHA256_restart failed!\n", progName);
+ goto finish;
+ }
+ SHA256_DestroyContext(cx_cpy, PR_TRUE);
+ PORT_Free(cxbytes);
+ src_length -= quarter;
+ }
+ SHA256_End(cx, dest, &len, MD5_LENGTH);
+finish:
+ SHA256_DestroyContext(cx, PR_TRUE);
+ return rv;
+}
+
+SECStatus
+SHA384_restart(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ SECStatus rv = SECSuccess;
+ SHA384Context *cx, *cx_cpy;
+ unsigned char *cxbytes;
+ unsigned int len;
+ unsigned int i, quarter;
+ cx = SHA384_NewContext();
+ SHA384_Begin(cx);
+ /* divide message by 4, restarting 3 times */
+ quarter = (src_length + 3)/ 4;
+ for (i=0; i < 4 && src_length > 0; i++) {
+ SHA384_Update(cx, src + i*quarter, PR_MIN(quarter, src_length));
+ len = SHA384_FlattenSize(cx);
+ cxbytes = PORT_Alloc(len);
+ SHA384_Flatten(cx, cxbytes);
+ cx_cpy = SHA384_Resurrect(cxbytes, NULL);
+ if (!cx_cpy) {
+ PR_fprintf(PR_STDERR, "%s: SHA384_Resurrect failed!\n", progName);
+ rv = SECFailure;
+ goto finish;
+ }
+ rv = PORT_Memcmp(cx, cx_cpy, len);
+ if (rv) {
+ SHA384_DestroyContext(cx_cpy, PR_TRUE);
+ PR_fprintf(PR_STDERR, "%s: SHA384_restart failed!\n", progName);
+ goto finish;
+ }
+ SHA384_DestroyContext(cx_cpy, PR_TRUE);
+ PORT_Free(cxbytes);
+ src_length -= quarter;
+ }
+ SHA384_End(cx, dest, &len, MD5_LENGTH);
+finish:
+ SHA384_DestroyContext(cx, PR_TRUE);
+ return rv;
+}
+
+SECStatus
+SHA512_restart(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ SECStatus rv = SECSuccess;
+ SHA512Context *cx, *cx_cpy;
+ unsigned char *cxbytes;
+ unsigned int len;
+ unsigned int i, quarter;
+ cx = SHA512_NewContext();
+ SHA512_Begin(cx);
+ /* divide message by 4, restarting 3 times */
+ quarter = (src_length + 3)/ 4;
+ for (i=0; i < 4 && src_length > 0; i++) {
+ SHA512_Update(cx, src + i*quarter, PR_MIN(quarter, src_length));
+ len = SHA512_FlattenSize(cx);
+ cxbytes = PORT_Alloc(len);
+ SHA512_Flatten(cx, cxbytes);
+ cx_cpy = SHA512_Resurrect(cxbytes, NULL);
+ if (!cx_cpy) {
+ PR_fprintf(PR_STDERR, "%s: SHA512_Resurrect failed!\n", progName);
+ rv = SECFailure;
+ goto finish;
+ }
+ rv = PORT_Memcmp(cx, cx_cpy, len);
+ if (rv) {
+ SHA512_DestroyContext(cx_cpy, PR_TRUE);
+ PR_fprintf(PR_STDERR, "%s: SHA512_restart failed!\n", progName);
+ goto finish;
+ }
+ SHA512_DestroyContext(cx_cpy, PR_TRUE);
+ PORT_Free(cxbytes);
+ src_length -= quarter;
+ }
+ SHA512_End(cx, dest, &len, MD5_LENGTH);
+finish:
+ SHA512_DestroyContext(cx, PR_TRUE);
+ return rv;
+}
+
+SECStatus
pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file,
int keysize, int exponent)
{
@@ -1371,8 +1488,29 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
return SECSuccess;
break;
case bltestSHA256:
+ restart = cipherInfo->params.hash.restart;
+ SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
+ SHA256_LENGTH);
+ cipherInfo->cipher.hashCipher = (restart) ? SHA256_restart
+ : SHA256_HashBuf;
+ return SECSuccess;
+ break;
case bltestSHA384:
+ restart = cipherInfo->params.hash.restart;
+ SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
+ SHA384_LENGTH);
+ cipherInfo->cipher.hashCipher = (restart) ? SHA384_restart
+ : SHA384_HashBuf;
+ return SECSuccess;
+ break;
case bltestSHA512:
+ restart = cipherInfo->params.hash.restart;
+ SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
+ SHA512_LENGTH);
+ cipherInfo->cipher.hashCipher = (restart) ? SHA512_restart
+ : SHA512_HashBuf;
+ return SECSuccess;
+ break;
default:
return SECFailure;
}
diff --git a/security/nss/cmd/bltest/tests/sha256/ciphertext0 b/security/nss/cmd/bltest/tests/sha256/ciphertext0
new file mode 100644
index 000000000..07e2ff14f
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha256/ciphertext0
@@ -0,0 +1 @@
+ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=
diff --git a/security/nss/cmd/bltest/tests/sha256/ciphertext1 b/security/nss/cmd/bltest/tests/sha256/ciphertext1
new file mode 100644
index 000000000..2ab6e1da5
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha256/ciphertext1
@@ -0,0 +1 @@
+JI1qYdIGOLjlwCaTDD5gOaM85Flk/yFn9uzt1BnbBsE=
diff --git a/security/nss/cmd/bltest/tests/sha256/numtests b/security/nss/cmd/bltest/tests/sha256/numtests
new file mode 100644
index 000000000..0cfbf0888
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha256/numtests
@@ -0,0 +1 @@
+2
diff --git a/security/nss/cmd/bltest/tests/sha256/plaintext0 b/security/nss/cmd/bltest/tests/sha256/plaintext0
new file mode 100644
index 000000000..8baef1b4a
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha256/plaintext0
@@ -0,0 +1 @@
+abc
diff --git a/security/nss/cmd/bltest/tests/sha256/plaintext1 b/security/nss/cmd/bltest/tests/sha256/plaintext1
new file mode 100644
index 000000000..afb5dce5d
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha256/plaintext1
@@ -0,0 +1 @@
+abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
diff --git a/security/nss/cmd/bltest/tests/sha384/ciphertext0 b/security/nss/cmd/bltest/tests/sha384/ciphertext0
new file mode 100644
index 000000000..c94f91e22
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha384/ciphertext0
@@ -0,0 +1 @@
+ywB1P0WjXou1oD1pmsZQBycsMqsO3tFjGotgWkP/W+2AhgcroefMI1i67KE0yCWn
diff --git a/security/nss/cmd/bltest/tests/sha384/ciphertext1 b/security/nss/cmd/bltest/tests/sha384/ciphertext1
new file mode 100644
index 000000000..833f06d84
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha384/ciphertext1
@@ -0,0 +1 @@
+CTMMM/cRR+g9GS/Hgs0bR1MRGxc7OwXSL6CAhuOw9xL8x8caVX4tuWbD6fqRdGA5
diff --git a/security/nss/cmd/bltest/tests/sha384/numtests b/security/nss/cmd/bltest/tests/sha384/numtests
new file mode 100644
index 000000000..0cfbf0888
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha384/numtests
@@ -0,0 +1 @@
+2
diff --git a/security/nss/cmd/bltest/tests/sha384/plaintext0 b/security/nss/cmd/bltest/tests/sha384/plaintext0
new file mode 100644
index 000000000..8baef1b4a
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha384/plaintext0
@@ -0,0 +1 @@
+abc
diff --git a/security/nss/cmd/bltest/tests/sha384/plaintext1 b/security/nss/cmd/bltest/tests/sha384/plaintext1
new file mode 100644
index 000000000..94fcc2b29
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha384/plaintext1
@@ -0,0 +1 @@
+abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu
diff --git a/security/nss/cmd/bltest/tests/sha512/ciphertext0 b/security/nss/cmd/bltest/tests/sha512/ciphertext0
new file mode 100644
index 000000000..8b626e237
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha512/ciphertext0
@@ -0,0 +1,2 @@
+3a81oZNherrMQXNJriBBMRLm+k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9
+RU1EI2Q86A4qmslPpUyknw==
diff --git a/security/nss/cmd/bltest/tests/sha512/ciphertext1 b/security/nss/cmd/bltest/tests/sha512/ciphertext1
new file mode 100644
index 000000000..c02d1752d
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha512/ciphertext1
@@ -0,0 +1,2 @@
+jpWbddrjE9qM9PcoFPwUP493ecbrn3+hcpmurbaIkBhQHSieSQD35DMbmd7EtUM6
+x9Mp7rbdJlReluVbh0vpCQ==
diff --git a/security/nss/cmd/bltest/tests/sha512/numtests b/security/nss/cmd/bltest/tests/sha512/numtests
new file mode 100644
index 000000000..0cfbf0888
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha512/numtests
@@ -0,0 +1 @@
+2
diff --git a/security/nss/cmd/bltest/tests/sha512/plaintext0 b/security/nss/cmd/bltest/tests/sha512/plaintext0
new file mode 100644
index 000000000..8baef1b4a
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha512/plaintext0
@@ -0,0 +1 @@
+abc
diff --git a/security/nss/cmd/bltest/tests/sha512/plaintext1 b/security/nss/cmd/bltest/tests/sha512/plaintext1
new file mode 100644
index 000000000..94fcc2b29
--- /dev/null
+++ b/security/nss/cmd/bltest/tests/sha512/plaintext1
@@ -0,0 +1 @@
+abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu
diff --git a/security/nss/cmd/vfychain/Makefile b/security/nss/cmd/vfychain/Makefile
new file mode 100644
index 000000000..8a0332d89
--- /dev/null
+++ b/security/nss/cmd/vfychain/Makefile
@@ -0,0 +1,82 @@
+#! gmake
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+include ../platlibs.mk
+
+ifeq (,$(filter-out WINNT WIN95 WIN16,$(OS_TARGET))) # omits WINCE
+ifndef BUILD_OPT
+LDFLAGS += /subsystem:console /profile /debug /machine:I386 /incremental:no
+OS_CFLAGS += -D_CONSOLE
+endif
+endif
+
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+#include ../platlibs.mk
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+include ../platrules.mk
+
diff --git a/security/nss/cmd/vfychain/manifest.mn b/security/nss/cmd/vfychain/manifest.mn
new file mode 100644
index 000000000..1cdcc4de8
--- /dev/null
+++ b/security/nss/cmd/vfychain/manifest.mn
@@ -0,0 +1,51 @@
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+
+CORE_DEPTH = ../../..
+
+# MODULE public and private header directories are implicitly REQUIRED.
+MODULE = nss
+
+# This next line is used by .mk files
+# and gets translated into $LINCS in manifest.mnw
+# The MODULE is always implicitly required.
+# Listing it here in REQUIRES makes it appear twice in the cc command line.
+REQUIRES = seccmd
+
+# DIRS =
+
+CSRCS = vfychain.c
+DEFINES += -DDLL_PREFIX=\"$(DLL_PREFIX)\" -DDLL_SUFFIX=\"$(DLL_SUFFIX)\"
+
+PROGRAM = vfychain
+
diff --git a/security/nss/cmd/vfychain/vfychain.c b/security/nss/cmd/vfychain/vfychain.c
new file mode 100644
index 000000000..831e198dc
--- /dev/null
+++ b/security/nss/cmd/vfychain/vfychain.c
@@ -0,0 +1,435 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Netscape security libraries.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1994-2000 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ */
+
+/****************************************************************************
+ * Read in a cert chain from one or more files, and verify the chain for
+ * some usage.
+ * *
+ * This code was modified from other code also kept in the NSS directory.
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#if defined(XP_UNIX)
+#include <unistd.h>
+#endif
+
+#include "prerror.h"
+
+#include "nssrenam.h"
+#include "pk11func.h"
+#include "seccomon.h"
+#include "secutil.h"
+#include "secmod.h"
+#include "secitem.h"
+#include "cert.h"
+
+
+/* #include <stdlib.h> */
+/* #include <errno.h> */
+/* #include <fcntl.h> */
+/* #include <stdarg.h> */
+
+#include "nspr.h"
+#include "plgetopt.h"
+#include "prio.h"
+#include "nss.h"
+
+/* #include "vfyutil.h" */
+
+#define RD_BUF_SIZE (60 * 1024)
+
+int verbose;
+
+char *password = NULL;
+
+/* Function: char * myPasswd()
+ *
+ * Purpose: This function is our custom password handler that is called by
+ * SSL when retreiving private certs and keys from the database. Returns a
+ * pointer to a string that with a password for the database. Password pointer
+ * should point to dynamically allocated memory that will be freed later.
+ */
+char *
+myPasswd(PK11SlotInfo *info, PRBool retry, void *arg)
+{
+ char * passwd = NULL;
+
+ if ( (!retry) && arg ) {
+ passwd = PORT_Strdup((char *)arg);
+ }
+ return passwd;
+}
+
+static void
+Usage(const char *progName)
+{
+ fprintf(stderr,
+ "Usage: %s [-d dbdir] certfile [certfile ...]\n",
+ progName);
+ exit(1);
+}
+
+/**************************************************************************
+**
+** Error and information routines.
+**
+**************************************************************************/
+
+void
+errWarn(char *function)
+{
+ PRErrorCode errorNumber = PR_GetError();
+ const char * errorString = SECU_Strerror(errorNumber);
+
+ fprintf(stderr, "Error in function %s: %d\n - %s\n",
+ function, errorNumber, errorString);
+}
+
+void
+exitErr(char *function)
+{
+ errWarn(function);
+ /* Exit gracefully. */
+ NSS_Shutdown();
+ PR_Cleanup();
+ exit(1);
+}
+
+static char *
+bestCertName(CERTCertificate *cert) {
+ if (cert->nickname) {
+ return cert->nickname;
+ }
+ if (cert->emailAddr) {
+ return cert->emailAddr;
+ }
+ return cert->subjectName;
+}
+
+void
+printCertProblems(FILE *outfile, CERTCertDBHandle *handle,
+ CERTCertificate *cert, PRBool checksig,
+ SECCertUsage certUsage, void *pinArg)
+{
+ CERTVerifyLog log;
+ CERTVerifyLogNode *node = NULL;
+ unsigned int depth = (unsigned int)-1;
+ unsigned int flags = 0;
+ char * errstr = NULL;
+ PRErrorCode err = PORT_GetError();
+
+ log.arena = PORT_NewArena(512);
+ log.head = log.tail = NULL;
+ log.count = 0;
+ CERT_VerifyCert(handle, cert, checksig, certUsage,
+ PR_Now(), pinArg, &log);
+
+ if (log.count > 0) {
+ fprintf(outfile,"PROBLEM WITH THE CERT CHAIN:\n");
+ for (node = log.head; node; node = node->next) {
+ if (depth != node->depth) {
+ depth = node->depth;
+ fprintf(outfile,"CERT %d. %s %s:\n", depth,
+ bestCertName(node->cert),
+ depth ? "[Certificate Authority]": "");
+ if (verbose) {
+ const char * emailAddr;
+ emailAddr = CERT_GetFirstEmailAddress(node->cert);
+ if (emailAddr) {
+ fprintf(outfile,"Email Address(es): ");
+ do {
+ fprintf(outfile, "%s\n", emailAddr);
+ emailAddr = CERT_GetNextEmailAddress(node->cert,
+ emailAddr);
+ } while (emailAddr);
+ }
+ }
+ }
+ fprintf(outfile," ERROR %d: %s\n", node->error,
+ SECU_Strerror(node->error));
+ errstr = NULL;
+ switch (node->error) {
+ case SEC_ERROR_INADEQUATE_KEY_USAGE:
+ flags = (unsigned int)node->arg;
+ switch (flags) {
+ case KU_DIGITAL_SIGNATURE:
+ errstr = "Cert cannot sign.";
+ break;
+ case KU_KEY_ENCIPHERMENT:
+ errstr = "Cert cannot encrypt.";
+ break;
+ case KU_KEY_CERT_SIGN:
+ errstr = "Cert cannot sign other certs.";
+ break;
+ default:
+ errstr = "[unknown usage].";
+ break;
+ }
+ case SEC_ERROR_INADEQUATE_CERT_TYPE:
+ flags = (unsigned int)node->arg;
+ switch (flags) {
+ case NS_CERT_TYPE_SSL_CLIENT:
+ case NS_CERT_TYPE_SSL_SERVER:
+ errstr = "Cert cannot be used for SSL.";
+ break;
+ case NS_CERT_TYPE_SSL_CA:
+ errstr = "Cert cannot be used as an SSL CA.";
+ break;
+ case NS_CERT_TYPE_EMAIL:
+ errstr = "Cert cannot be used for SMIME.";
+ break;
+ case NS_CERT_TYPE_EMAIL_CA:
+ errstr = "Cert cannot be used as an SMIME CA.";
+ break;
+ case NS_CERT_TYPE_OBJECT_SIGNING:
+ errstr = "Cert cannot be used for object signing.";
+ break;
+ case NS_CERT_TYPE_OBJECT_SIGNING_CA:
+ errstr = "Cert cannot be used as an object signing CA.";
+ break;
+ default:
+ errstr = "[unknown usage].";
+ break;
+ }
+ case SEC_ERROR_UNKNOWN_ISSUER:
+ case SEC_ERROR_UNTRUSTED_ISSUER:
+ case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
+ errstr = node->cert->issuerName;
+ break;
+ default:
+ break;
+ }
+ if (errstr) {
+ fprintf(stderr," %s\n",errstr);
+ }
+ CERT_DestroyCertificate(node->cert);
+ }
+ }
+ PORT_SetError(err); /* restore original error code */
+}
+
+typedef struct certMemStr {
+ struct certMemStr * next;
+ CERTCertificate * cert;
+} certMem;
+
+certMem * theCerts;
+
+void
+rememberCert(CERTCertificate * cert)
+{
+ certMem * newCertMem = PORT_ZNew(certMem);
+ if (newCertMem) {
+ newCertMem->next = theCerts;
+ newCertMem->cert = cert;
+ theCerts = newCertMem;
+ }
+}
+
+void
+forgetCerts(void)
+{
+ certMem * oldCertMem;
+ while (oldCertMem = theCerts) {
+ theCerts = oldCertMem->next;
+ CERT_DestroyCertificate(oldCertMem->cert);
+ PORT_Free(oldCertMem);
+ }
+ theCerts = NULL;
+}
+
+
+CERTCertificate *
+readCertFile(const char * fileName, PRBool isAscii)
+{
+ unsigned char * pb;
+ CERTCertificate * cert = NULL;
+ CERTCertDBHandle *defaultDB = NULL;
+ PRFileDesc* fd;
+ PRInt32 cc = -1;
+ PRInt32 total;
+ PRInt32 remaining;
+ SECItem item;
+ static unsigned char certBuf[RD_BUF_SIZE];
+
+ fd = PR_Open(fileName, PR_RDONLY, 0777);
+ if (!fd) {
+ PRIntn err = PR_GetError();
+ fprintf(stderr, "open of %s failed, %d = %s\n",
+ fileName, err, SECU_Strerror(err));
+ return cert;
+ }
+ /* read until EOF or buffer is full */
+ pb = certBuf;
+ while (0 < (remaining = (sizeof certBuf) - (pb - certBuf))) {
+ cc = PR_Read(fd, pb, remaining);
+ if (cc == 0)
+ break;
+ if (cc < 0) {
+ PRIntn err = PR_GetError();
+ fprintf(stderr, "read of %s failed, %d = %s\n",
+ fileName, err, SECU_Strerror(err));
+ break;
+ }
+ /* cc > 0 */
+ pb += cc;
+ }
+ PR_Close(fd);
+ if (cc < 0)
+ return cert;
+ if (!remaining || cc > 0) { /* file was too big. */
+ fprintf(stderr, "cert file %s was too big.\n");
+ return cert;
+ }
+ total = pb - certBuf;
+ if (!total) { /* file was empty */
+ fprintf(stderr, "cert file %s was empty.\n");
+ return cert;
+ }
+ if (isAscii) {
+ /* convert from Base64 to binary here ... someday */
+ }
+ item.type = siBuffer;
+ item.data = certBuf;
+ item.len = total;
+ defaultDB = CERT_GetDefaultCertDB();
+ cert = CERT_NewTempCertificate(defaultDB, &item,
+ NULL /* nickname */,
+ PR_FALSE /* isPerm */,
+ PR_TRUE /* copyDER */);
+ if (!cert) {
+ PRIntn err = PR_GetError();
+ fprintf(stderr, "couldn't import %s, %d = %s\n",
+ fileName, err, SECU_Strerror(err));
+ }
+ return cert;
+}
+
+int
+main(int argc, char *argv[], char *envp[])
+{
+ char * certDir = NULL;
+ char * progName = NULL;
+ char * cipherString = NULL;
+ CERTCertificate * cert;
+ CERTCertificate * firstCert = NULL;
+ CERTCertDBHandle * defaultDB = NULL;
+ PRBool isAscii = PR_FALSE;
+ SECStatus secStatus;
+ SECCertUsage certUsage = certUsageSSLServer;
+ PLOptState * optstate;
+ PLOptStatus status;
+
+ PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
+
+ progName = PL_strdup(argv[0]);
+
+ optstate = PL_CreateOptState(argc, argv, "ad:ru:w:v");
+ while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
+ switch(optstate->option) {
+ case 0 : /* positional parameter */ goto breakout;
+ case 'a' : isAscii = PR_TRUE; break;
+ case 'd' : certDir = PL_strdup(optstate->value); break;
+ case 'r' : isAscii = PR_FALSE; break;
+ case 'u' : certUsage = (SECCertUsage)PORT_Atoi(optstate->value); break;
+ case 'w' : password = PL_strdup(optstate->value); break;
+ case 'v' : verbose++; break;
+ default : Usage(progName); break;
+ }
+ }
+breakout:
+ if (status != PL_OPT_OK)
+ Usage(progName);
+
+ /* Set our password function callback. */
+ PK11_SetPasswordFunc(myPasswd);
+
+ /* Initialize the NSS libraries. */
+ if (certDir) {
+ secStatus = NSS_Init(certDir);
+ } else {
+ secStatus = NSS_NoDB_Init(NULL);
+
+ /* load the builtins */
+ SECMOD_AddNewModule("Builtins", DLL_PREFIX"nssckbi."DLL_SUFFIX, 0, 0);
+ }
+ if (secStatus != SECSuccess) {
+ exitErr("NSS_Init");
+ }
+
+
+ while (status == PL_OPT_OK) {
+ switch(optstate->option) {
+ default : Usage(progName); break;
+ case 'a' : isAscii = PR_TRUE; break;
+ case 'r' : isAscii = PR_FALSE; break;
+ case 0 : /* positional parameter */
+ cert = readCertFile(optstate->value, isAscii);
+ if (!cert)
+ goto punt;
+ rememberCert(cert);
+ if (!firstCert)
+ firstCert = cert;
+ break;
+ }
+ status = PL_GetNextOpt(optstate);
+ }
+ if (status == PL_OPT_BAD || !firstCert)
+ Usage(progName);
+
+ /* NOW, verify the cert chain. */
+ defaultDB = CERT_GetDefaultCertDB();
+ secStatus = CERT_VerifyCert(defaultDB, firstCert,
+ PR_TRUE /* check sig */,
+ certUsage,
+ PR_Now(),
+ NULL, /* wincx */
+ NULL); /* error log */
+
+ if (secStatus != SECSuccess) {
+ PRIntn err = PR_GetError();
+ fprintf(stderr, "Chain is bad, %d = %s\n", err, SECU_Strerror(err));
+ printCertProblems(stderr, defaultDB, firstCert,
+ PR_TRUE, certUsage, NULL);
+ } else {
+ fprintf(stderr, "Chain is good!\n");
+ }
+
+punt:
+ forgetCerts();
+ NSS_Shutdown();
+ PR_Cleanup();
+ return 0;
+}
diff --git a/security/nss/lib/cryptohi/hasht.h b/security/nss/lib/cryptohi/hasht.h
index 143e37486..852ee706e 100644
--- a/security/nss/lib/cryptohi/hasht.h
+++ b/security/nss/lib/cryptohi/hasht.h
@@ -47,10 +47,13 @@ typedef struct HASHContextStr HASHContext;
* NOTE the order must match the definition of SECHashObjects[]!
*/
typedef enum {
- HASH_AlgNULL = 0,
- HASH_AlgMD2 = 1,
- HASH_AlgMD5 = 2,
- HASH_AlgSHA1 = 3,
+ HASH_AlgNULL = 0,
+ HASH_AlgMD2 = 1,
+ HASH_AlgMD5 = 2,
+ HASH_AlgSHA1 = 3,
+ HASH_AlgSHA256 = 4,
+ HASH_AlgSHA384 = 5,
+ HASH_AlgSHA512 = 6,
HASH_AlgTOTAL
} HASH_HashType;
@@ -60,6 +63,10 @@ typedef enum {
#define MD2_LENGTH 16
#define MD5_LENGTH 16
#define SHA1_LENGTH 20
+#define SHA256_LENGTH 32
+#define SHA384_LENGTH 48
+#define SHA512_LENGTH 64
+#define HASH_LENGTH_MAX SHA512_LENGTH
/*
* Structure to hold hash computation info and routines
diff --git a/security/nss/lib/cryptohi/sechash.c b/security/nss/lib/cryptohi/sechash.c
index 36ee1efd2..715f840cf 100644
--- a/security/nss/lib/cryptohi/sechash.c
+++ b/security/nss/lib/cryptohi/sechash.c
@@ -87,6 +87,21 @@ sha1_NewContext(void) {
return (void *) PK11_CreateDigestContext(SEC_OID_SHA1);
}
+static void *
+sha256_NewContext(void) {
+ return (void *) PK11_CreateDigestContext(SEC_OID_SHA256);
+}
+
+static void *
+sha384_NewContext(void) {
+ return (void *) PK11_CreateDigestContext(SEC_OID_SHA384);
+}
+
+static void *
+sha512_NewContext(void) {
+ return (void *) PK11_CreateDigestContext(SEC_OID_SHA512);
+}
+
const SECHashObject SECHashObjects[] = {
{ 0,
(void * (*)(void)) null_hash_new_context,
@@ -124,6 +139,33 @@ const SECHashObject SECHashObjects[] = {
(void (*)(void *, unsigned char *, unsigned int *, unsigned int))
PK11_DigestFinal
},
+ { SHA256_LENGTH,
+ (void * (*)(void)) sha256_NewContext,
+ (void * (*)(void *)) PK11_CloneContext,
+ (void (*)(void *, PRBool)) PK11_DestroyContext,
+ (void (*)(void *)) PK11_DigestBegin,
+ (void (*)(void *, const unsigned char *, unsigned int)) PK11_DigestOp,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int))
+ PK11_DigestFinal
+ },
+ { SHA384_LENGTH,
+ (void * (*)(void)) sha384_NewContext,
+ (void * (*)(void *)) PK11_CloneContext,
+ (void (*)(void *, PRBool)) PK11_DestroyContext,
+ (void (*)(void *)) PK11_DigestBegin,
+ (void (*)(void *, const unsigned char *, unsigned int)) PK11_DigestOp,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int))
+ PK11_DigestFinal
+ },
+ { SHA512_LENGTH,
+ (void * (*)(void)) sha512_NewContext,
+ (void * (*)(void *)) PK11_CloneContext,
+ (void (*)(void *, PRBool)) PK11_DestroyContext,
+ (void (*)(void *)) PK11_DigestBegin,
+ (void (*)(void *, const unsigned char *, unsigned int)) PK11_DigestOp,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int))
+ PK11_DigestFinal
+ },
};
const SECHashObject *
diff --git a/security/nss/lib/freebl/blapi.h b/security/nss/lib/freebl/blapi.h
index f14da297d..121eff791 100644
--- a/security/nss/lib/freebl/blapi.h
+++ b/security/nss/lib/freebl/blapi.h
@@ -707,6 +707,58 @@ extern SECStatus SHA1_Flatten(SHA1Context *cx,unsigned char *space);
*/
extern SHA1Context * SHA1_Resurrect(unsigned char *space, void *arg);
+/******************************************/
+
+extern SHA256Context *SHA256_NewContext(void);
+extern void SHA256_DestroyContext(SHA256Context *cx, PRBool freeit);
+extern void SHA256_Begin(SHA256Context *cx);
+extern void SHA256_Update(SHA256Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+extern void SHA256_End(SHA256Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+extern SECStatus SHA256_HashBuf(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+extern SECStatus SHA256_Hash(unsigned char *dest, const char *src);
+extern void SHA256_TraceState(SHA256Context *cx);
+extern unsigned int SHA256_FlattenSize(SHA256Context *cx);
+extern SECStatus SHA256_Flatten(SHA256Context *cx,unsigned char *space);
+extern SHA256Context * SHA256_Resurrect(unsigned char *space, void *arg);
+
+/******************************************/
+
+extern SHA512Context *SHA512_NewContext(void);
+extern void SHA512_DestroyContext(SHA512Context *cx, PRBool freeit);
+extern void SHA512_Begin(SHA512Context *cx);
+extern void SHA512_Update(SHA512Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+extern void SHA512_End(SHA512Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+extern SECStatus SHA512_HashBuf(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+extern SECStatus SHA512_Hash(unsigned char *dest, const char *src);
+extern void SHA512_TraceState(SHA512Context *cx);
+extern unsigned int SHA512_FlattenSize(SHA512Context *cx);
+extern SECStatus SHA512_Flatten(SHA512Context *cx,unsigned char *space);
+extern SHA512Context * SHA512_Resurrect(unsigned char *space, void *arg);
+
+/******************************************/
+
+extern SHA384Context *SHA384_NewContext(void);
+extern void SHA384_DestroyContext(SHA384Context *cx, PRBool freeit);
+extern void SHA384_Begin(SHA384Context *cx);
+extern void SHA384_Update(SHA384Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+extern void SHA384_End(SHA384Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+extern SECStatus SHA384_HashBuf(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+extern SECStatus SHA384_Hash(unsigned char *dest, const char *src);
+extern void SHA384_TraceState(SHA384Context *cx);
+extern unsigned int SHA384_FlattenSize(SHA384Context *cx);
+extern SECStatus SHA384_Flatten(SHA384Context *cx,unsigned char *space);
+extern SHA384Context * SHA384_Resurrect(unsigned char *space, void *arg);
+
+/******************************************/
/*
** Pseudo Random Number Generation. FIPS compliance desirable.
*/
diff --git a/security/nss/lib/freebl/ldvector.c b/security/nss/lib/freebl/ldvector.c
index ef97116e3..9327c2a10 100644
--- a/security/nss/lib/freebl/ldvector.c
+++ b/security/nss/lib/freebl/ldvector.c
@@ -113,9 +113,53 @@ static const struct FREEBLVectorStr vector = {
PQG_ParamGen,
PQG_ParamGenSeedLen,
PQG_VerifyParams,
+
+ /* End of Version 3.001. */
+
RSA_PrivateKeyOpDoubleChecked,
RSA_PrivateKeyCheck,
BL_Cleanup,
+
+ /* End of Version 3.002. */
+
+ SHA256_NewContext,
+ SHA256_DestroyContext,
+ SHA256_Begin,
+ SHA256_Update,
+ SHA256_End,
+ SHA256_HashBuf,
+ SHA256_Hash,
+ SHA256_TraceState,
+ SHA256_FlattenSize,
+ SHA256_Flatten,
+ SHA256_Resurrect,
+
+ SHA512_NewContext,
+ SHA512_DestroyContext,
+ SHA512_Begin,
+ SHA512_Update,
+ SHA512_End,
+ SHA512_HashBuf,
+ SHA512_Hash,
+ SHA512_TraceState,
+ SHA512_FlattenSize,
+ SHA512_Flatten,
+ SHA512_Resurrect,
+
+ SHA384_NewContext,
+ SHA384_DestroyContext,
+ SHA384_Begin,
+ SHA384_Update,
+ SHA384_End,
+ SHA384_HashBuf,
+ SHA384_Hash,
+ SHA384_TraceState,
+ SHA384_FlattenSize,
+ SHA384_Flatten,
+ SHA384_Resurrect,
+
+ /* End of Version 3.003. */
+
};
diff --git a/security/nss/lib/freebl/loader.c b/security/nss/lib/freebl/loader.c
index 2bab1fe42..489b66f1a 100644
--- a/security/nss/lib/freebl/loader.c
+++ b/security/nss/lib/freebl/loader.c
@@ -959,3 +959,278 @@ BL_Cleanup(void)
(vector->p_BL_Cleanup)();
}
+/* ============== New for 3.003 =============================== */
+
+SECStatus
+SHA256_Hash(unsigned char *dest, const char *src)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA256_Hash)(dest, src);
+}
+
+SECStatus
+SHA256_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA256_HashBuf)(dest, src, src_length);
+}
+
+SHA256Context *
+SHA256_NewContext(void)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA256_NewContext)();
+}
+
+void
+SHA256_DestroyContext(SHA256Context *cx, PRBool freeit)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA256_DestroyContext)(cx, freeit);
+}
+
+void
+SHA256_Begin(SHA256Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA256_Begin)(cx);
+}
+
+void
+SHA256_Update(SHA256Context *cx, const unsigned char *input,
+ unsigned int inputLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA256_Update)(cx, input, inputLen);
+}
+
+void
+SHA256_End(SHA256Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA256_End)(cx, digest, digestLen, maxDigestLen);
+}
+
+void
+SHA256_TraceState(SHA256Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA256_TraceState)(cx);
+}
+
+unsigned int
+SHA256_FlattenSize(SHA256Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return 0;
+ return (vector->p_SHA256_FlattenSize)(cx);
+}
+
+SECStatus
+SHA256_Flatten(SHA256Context *cx,unsigned char *space)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA256_Flatten)(cx, space);
+}
+
+SHA256Context *
+SHA256_Resurrect(unsigned char *space, void *arg)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA256_Resurrect)(space, arg);
+}
+
+SECStatus
+SHA512_Hash(unsigned char *dest, const char *src)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA512_Hash)(dest, src);
+}
+
+SECStatus
+SHA512_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA512_HashBuf)(dest, src, src_length);
+}
+
+SHA512Context *
+SHA512_NewContext(void)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA512_NewContext)();
+}
+
+void
+SHA512_DestroyContext(SHA512Context *cx, PRBool freeit)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA512_DestroyContext)(cx, freeit);
+}
+
+void
+SHA512_Begin(SHA512Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA512_Begin)(cx);
+}
+
+void
+SHA512_Update(SHA512Context *cx, const unsigned char *input,
+ unsigned int inputLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA512_Update)(cx, input, inputLen);
+}
+
+void
+SHA512_End(SHA512Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA512_End)(cx, digest, digestLen, maxDigestLen);
+}
+
+void
+SHA512_TraceState(SHA512Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA512_TraceState)(cx);
+}
+
+unsigned int
+SHA512_FlattenSize(SHA512Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return 0;
+ return (vector->p_SHA512_FlattenSize)(cx);
+}
+
+SECStatus
+SHA512_Flatten(SHA512Context *cx,unsigned char *space)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA512_Flatten)(cx, space);
+}
+
+SHA512Context *
+SHA512_Resurrect(unsigned char *space, void *arg)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA512_Resurrect)(space, arg);
+}
+
+
+SECStatus
+SHA384_Hash(unsigned char *dest, const char *src)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA384_Hash)(dest, src);
+}
+
+SECStatus
+SHA384_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA384_HashBuf)(dest, src, src_length);
+}
+
+SHA384Context *
+SHA384_NewContext(void)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA384_NewContext)();
+}
+
+void
+SHA384_DestroyContext(SHA384Context *cx, PRBool freeit)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA384_DestroyContext)(cx, freeit);
+}
+
+void
+SHA384_Begin(SHA384Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA384_Begin)(cx);
+}
+
+void
+SHA384_Update(SHA384Context *cx, const unsigned char *input,
+ unsigned int inputLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA384_Update)(cx, input, inputLen);
+}
+
+void
+SHA384_End(SHA384Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA384_End)(cx, digest, digestLen, maxDigestLen);
+}
+
+void
+SHA384_TraceState(SHA384Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return ;
+ (vector->p_SHA384_TraceState)(cx);
+}
+
+unsigned int
+SHA384_FlattenSize(SHA384Context *cx)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return 0;
+ return (vector->p_SHA384_FlattenSize)(cx);
+}
+
+SECStatus
+SHA384_Flatten(SHA384Context *cx,unsigned char *space)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return SECFailure;
+ return (vector->p_SHA384_Flatten)(cx, space);
+}
+
+SHA384Context *
+SHA384_Resurrect(unsigned char *space, void *arg)
+{
+ if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
+ return NULL;
+ return (vector->p_SHA384_Resurrect)(space, arg);
+}
+
+
+
diff --git a/security/nss/lib/freebl/loader.h b/security/nss/lib/freebl/loader.h
index be2cc0906..634fb7865 100644
--- a/security/nss/lib/freebl/loader.h
+++ b/security/nss/lib/freebl/loader.h
@@ -40,7 +40,7 @@
#include "blapi.h"
-#define FREEBL_VERSION 0x0302
+#define FREEBL_VERSION 0x0303
struct FREEBLVectorStr {
@@ -265,6 +265,53 @@ struct FREEBLVectorStr {
/* Version 3.002 came to here */
+ SHA256Context *(* p_SHA256_NewContext)(void);
+ void (* p_SHA256_DestroyContext)(SHA256Context *cx, PRBool freeit);
+ void (* p_SHA256_Begin)(SHA256Context *cx);
+ void (* p_SHA256_Update)(SHA256Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+ void (* p_SHA256_End)(SHA256Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+ SECStatus (* p_SHA256_HashBuf)(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+ SECStatus (* p_SHA256_Hash)(unsigned char *dest, const char *src);
+ void (* p_SHA256_TraceState)(SHA256Context *cx);
+ unsigned int (* p_SHA256_FlattenSize)(SHA256Context *cx);
+ SECStatus (* p_SHA256_Flatten)(SHA256Context *cx,unsigned char *space);
+ SHA256Context * (* p_SHA256_Resurrect)(unsigned char *space, void *arg);
+
+ SHA512Context *(* p_SHA512_NewContext)(void);
+ void (* p_SHA512_DestroyContext)(SHA512Context *cx, PRBool freeit);
+ void (* p_SHA512_Begin)(SHA512Context *cx);
+ void (* p_SHA512_Update)(SHA512Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+ void (* p_SHA512_End)(SHA512Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+ SECStatus (* p_SHA512_HashBuf)(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+ SECStatus (* p_SHA512_Hash)(unsigned char *dest, const char *src);
+ void (* p_SHA512_TraceState)(SHA512Context *cx);
+ unsigned int (* p_SHA512_FlattenSize)(SHA512Context *cx);
+ SECStatus (* p_SHA512_Flatten)(SHA512Context *cx,unsigned char *space);
+ SHA512Context * (* p_SHA512_Resurrect)(unsigned char *space, void *arg);
+
+ SHA384Context *(* p_SHA384_NewContext)(void);
+ void (* p_SHA384_DestroyContext)(SHA384Context *cx, PRBool freeit);
+ void (* p_SHA384_Begin)(SHA384Context *cx);
+ void (* p_SHA384_Update)(SHA384Context *cx, const unsigned char *input,
+ unsigned int inputLen);
+ void (* p_SHA384_End)(SHA384Context *cx, unsigned char *digest,
+ unsigned int *digestLen, unsigned int maxDigestLen);
+ SECStatus (* p_SHA384_HashBuf)(unsigned char *dest, const unsigned char *src,
+ uint32 src_length);
+ SECStatus (* p_SHA384_Hash)(unsigned char *dest, const char *src);
+ void (* p_SHA384_TraceState)(SHA384Context *cx);
+ unsigned int (* p_SHA384_FlattenSize)(SHA384Context *cx);
+ SECStatus (* p_SHA384_Flatten)(SHA384Context *cx,unsigned char *space);
+ SHA384Context * (* p_SHA384_Resurrect)(unsigned char *space, void *arg);
+
+ /* Version 3.003 came to here */
+
};
typedef struct FREEBLVectorStr FREEBLVector;
diff --git a/security/nss/lib/freebl/manifest.mn b/security/nss/lib/freebl/manifest.mn
index 50b48d289..d8c0d97fb 100644
--- a/security/nss/lib/freebl/manifest.mn
+++ b/security/nss/lib/freebl/manifest.mn
@@ -81,6 +81,7 @@ CSRCS = \
sha_fast.c \
md2.c \
md5.c \
+ sha512.c \
alg2268.c \
arcfour.c \
arcfive.c \
diff --git a/security/nss/lib/pk11wrap/debug_module.c b/security/nss/lib/pk11wrap/debug_module.c
index e2b204f65..34cd54384 100644
--- a/security/nss/lib/pk11wrap/debug_module.c
+++ b/security/nss/lib/pk11wrap/debug_module.c
@@ -270,97 +270,232 @@ static void print_mechanism(CK_MECHANISM_PTR m)
PR_LOG(modlog, 4, (" mechanism = 0x%p", m->mechanism));
}
-#define MAX_UINT32 0xffffffff
-
-static void nssdbg_finish_time(PRInt32 *counter, PRIntervalTime start)
+struct nssdbg_prof_str {
+ PRUint32 time;
+ PRUint32 calls;
+ char *function;
+};
+
+#define NSSDBG_DEFINE(func) { 0, 0, #func }
+
+struct nssdbg_prof_str nssdbg_prof_data[] = {
+#define FUNC_C_INITIALIZE 0
+ NSSDBG_DEFINE(C_Initialize),
+#define FUNC_C_FINALIZE 1
+ NSSDBG_DEFINE(C_Finalize),
+#define FUNC_C_GETINFO 2
+ NSSDBG_DEFINE(C_GetInfo),
+#define FUNC_C_GETFUNCITONLIST 3
+ NSSDBG_DEFINE(C_GetFunctionList),
+#define FUNC_C_GETSLOTLIST 4
+ NSSDBG_DEFINE(C_GetSlotList),
+#define FUNC_C_GETSLOTINFO 5
+ NSSDBG_DEFINE(C_GetSlotInfo),
+#define FUNC_C_GETTOKENINFO 6
+ NSSDBG_DEFINE(C_GetTokenInfo),
+#define FUNC_C_GETMECHANISMLIST 7
+ NSSDBG_DEFINE(C_GetMechanismList),
+#define FUNC_C_GETMECHANISMINFO 8
+ NSSDBG_DEFINE(C_GetMechanismInfo),
+#define FUNC_C_INITTOKEN 9
+ NSSDBG_DEFINE(C_InitToken),
+#define FUNC_C_INITPIN 10
+ NSSDBG_DEFINE(C_InitPIN),
+#define FUNC_C_SETPIN 11
+ NSSDBG_DEFINE(C_SetPIN),
+#define FUNC_C_OPENSESSION 12
+ NSSDBG_DEFINE(C_OpenSession),
+#define FUNC_C_CLOSESESSION 13
+ NSSDBG_DEFINE(C_CloseSession),
+#define FUNC_C_CLOSEALLSESSIONS 14
+ NSSDBG_DEFINE(C_CloseAllSessions),
+#define FUNC_C_GETSESSIONINFO 15
+ NSSDBG_DEFINE(C_GetSessionInfo),
+#define FUNC_C_GETOPERATIONSTATE 16
+ NSSDBG_DEFINE(C_GetOperationState),
+#define FUNC_C_SETOPERATIONSTATE 17
+ NSSDBG_DEFINE(C_SetOperationState),
+#define FUNC_C_LOGIN 18
+ NSSDBG_DEFINE(C_Login),
+#define FUNC_C_LOGOUT 19
+ NSSDBG_DEFINE(C_Logout),
+#define FUNC_C_CREATEOBJECT 20
+ NSSDBG_DEFINE(C_CreateObject),
+#define FUNC_C_COPYOBJECT 21
+ NSSDBG_DEFINE(C_CopyObject),
+#define FUNC_C_DESTROYOBJECT 22
+ NSSDBG_DEFINE(C_DestroyObject),
+#define FUNC_C_GETOBJECTSIZE 23
+ NSSDBG_DEFINE(C_GetObjectSize),
+#define FUNC_C_GETATTRIBUTEVALUE 24
+ NSSDBG_DEFINE(C_GetAttributeValue),
+#define FUNC_C_SETATTRIBUTEVALUE 25
+ NSSDBG_DEFINE(C_SetAttributeValue),
+#define FUNC_C_FINDOBJECTSINIT 26
+ NSSDBG_DEFINE(C_FindObjectsInit),
+#define FUNC_C_FINDOBJECTS 27
+ NSSDBG_DEFINE(C_FindObjects),
+#define FUNC_C_FINDOBJECTSFINAL 28
+ NSSDBG_DEFINE(C_FindObjectsFinal),
+#define FUNC_C_ENCRYPTINIT 29
+ NSSDBG_DEFINE(C_EncryptInit),
+#define FUNC_C_ENCRYPT 30
+ NSSDBG_DEFINE(C_Encrypt),
+#define FUNC_C_ENCRYPTUPDATE 31
+ NSSDBG_DEFINE(C_EncryptUpdate),
+#define FUNC_C_ENCRYPTFINAL 32
+ NSSDBG_DEFINE(C_EncryptFinal),
+#define FUNC_C_DECRYPTINIT 33
+ NSSDBG_DEFINE(C_DecryptInit),
+#define FUNC_C_DECRYPT 34
+ NSSDBG_DEFINE(C_Decrypt),
+#define FUNC_C_DECRYPTUPDATE 35
+ NSSDBG_DEFINE(C_DecryptUpdate),
+#define FUNC_C_DECRYPTFINAL 36
+ NSSDBG_DEFINE(C_DecryptFinal),
+#define FUNC_C_DIGESTINIT 37
+ NSSDBG_DEFINE(C_DigestInit),
+#define FUNC_C_DIGEST 38
+ NSSDBG_DEFINE(C_Digest),
+#define FUNC_C_DIGESTUPDATE 39
+ NSSDBG_DEFINE(C_DigestUpdate),
+#define FUNC_C_DIGESTKEY 40
+ NSSDBG_DEFINE(C_DigestKey),
+#define FUNC_C_DIGESTFINAL 41
+ NSSDBG_DEFINE(C_DigestFinal),
+#define FUNC_C_SIGNINIT 42
+ NSSDBG_DEFINE(C_SignInit),
+#define FUNC_C_SIGN 43
+ NSSDBG_DEFINE(C_Sign),
+#define FUNC_C_SIGNUPDATE 44
+ NSSDBG_DEFINE(C_SignUpdate),
+#define FUNC_C_SIGNFINAL 45
+ NSSDBG_DEFINE(C_SignFinal),
+#define FUNC_C_SIGNRECOVERINIT 46
+ NSSDBG_DEFINE(C_SignRecoverInit),
+#define FUNC_C_SIGNRECOVER 47
+ NSSDBG_DEFINE(C_SignRecover),
+#define FUNC_C_VERIFYINIT 48
+ NSSDBG_DEFINE(C_VerifyInit),
+#define FUNC_C_VERIFY 49
+ NSSDBG_DEFINE(C_Verify),
+#define FUNC_C_VERIFYUPDATE 50
+ NSSDBG_DEFINE(C_VerifyUpdate),
+#define FUNC_C_VERIFYFINAL 51
+ NSSDBG_DEFINE(C_VerifyFinal),
+#define FUNC_C_VERIFYRECOVERINIT 52
+ NSSDBG_DEFINE(C_VerifyRecoverInit),
+#define FUNC_C_VERIFYRECOVER 53
+ NSSDBG_DEFINE(C_VerifyRecover),
+#define FUNC_C_DIGESTENCRYPTUPDATE 54
+ NSSDBG_DEFINE(C_DigestEncryptUpdate),
+#define FUNC_C_DECRYPTDIGESTUPDATE 55
+ NSSDBG_DEFINE(C_DecryptDigestUpdate),
+#define FUNC_C_SIGNENCRYPTUPDATE 56
+ NSSDBG_DEFINE(C_SignEncryptUpdate),
+#define FUNC_C_DECRYPTVERIFYUPDATE 57
+ NSSDBG_DEFINE(C_DecryptVerifyUpdate),
+#define FUNC_C_GENERATEKEY 58
+ NSSDBG_DEFINE(C_GenerateKey),
+#define FUNC_C_GENERATEKEYPAIR 59
+ NSSDBG_DEFINE(C_GenerateKeyPair),
+#define FUNC_C_WRAPKEY 60
+ NSSDBG_DEFINE(C_WrapKey),
+#define FUNC_C_UNWRAPKEY 61
+ NSSDBG_DEFINE(C_UnWrapKey),
+#define FUNC_C_DERIVEKEY 62
+ NSSDBG_DEFINE(C_DeriveKey),
+#define FUNC_C_SEEDRANDOM 63
+ NSSDBG_DEFINE(C_SeedRandom),
+#define FUNC_C_GENERATERANDOM 64
+ NSSDBG_DEFINE(C_GenerateRandom),
+#define FUNC_C_GETFUNCTIONSTATUS 65
+ NSSDBG_DEFINE(C_GetFunctionStatus),
+#define FUNC_C_CANCELFUNCTION 66
+ NSSDBG_DEFINE(C_CancelFunction),
+#define FUNC_C_WAITFORSLOTEVENT 67
+ NSSDBG_DEFINE(C_WaitForSlotEvent)
+};
+
+int nssdbg_prof_size = sizeof(nssdbg_prof_data)/sizeof(nssdbg_prof_data[0]);
+
+
+static void nssdbg_finish_time(PRInt32 fun_number, PRIntervalTime start)
{
PRIntervalTime ival;
PRIntervalTime end = PR_IntervalNow();
- if (end >= start) {
- ival = PR_IntervalToMilliseconds(end-start);
- } else {
- /* the interval timer rolled over. presume it only tripped once */
- ival = PR_IntervalToMilliseconds(MAX_UINT32-start) +
- PR_IntervalToMilliseconds(end);
- }
- PR_AtomicAdd(counter, ival);
+ ival = end-start;
+ /* sigh, lie to PRAtomic add and say we are using signed values */
+ PR_AtomicAdd((PRInt32 *)&nssdbg_prof_data[fun_number].time, (PRInt32)ival);
+}
+
+static void nssdbg_start_time(PRInt32 fun_number, PRIntervalTime *start)
+{
+ PR_AtomicIncrement((PRInt32 *)&nssdbg_prof_data[fun_number].calls);
+ *start = PR_IntervalNow();
}
-static PRInt32 counter_C_Initialize = 0;
-static PRInt32 calls_C_Initialize = 0;
CK_RV NSSDBGC_Initialize(
CK_VOID_PTR pInitArgs
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Initialize);
PR_LOG(modlog, 1, ("C_Initialize"));
PR_LOG(modlog, 3, (" pInitArgs = 0x%p", pInitArgs));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_INITIALIZE,&start);
rv = module_functions->C_Initialize(pInitArgs);
- nssdbg_finish_time(&counter_C_Initialize,start);
+ nssdbg_finish_time(FUNC_C_INITIALIZE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Finalize = 0;
-static PRInt32 calls_C_Finalize = 0;
CK_RV NSSDBGC_Finalize(
CK_VOID_PTR pReserved
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Finalize);
PR_LOG(modlog, 1, ("C_Finalize"));
PR_LOG(modlog, 3, (" pReserved = 0x%p", pReserved));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_FINALIZE,&start);
rv = module_functions->C_Finalize(pReserved);
- nssdbg_finish_time(&counter_C_Finalize,start);
+ nssdbg_finish_time(FUNC_C_FINALIZE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetInfo = 0;
-static PRInt32 calls_C_GetInfo = 0;
CK_RV NSSDBGC_GetInfo(
CK_INFO_PTR pInfo
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetInfo);
PR_LOG(modlog, 1, ("C_GetInfo"));
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETINFO,&start);
rv = module_functions->C_GetInfo(pInfo);
- nssdbg_finish_time(&counter_C_GetInfo,start);
+ nssdbg_finish_time(FUNC_C_GETINFO,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetFunctionList = 0;
-static PRInt32 calls_C_GetFunctionList = 0;
CK_RV NSSDBGC_GetFunctionList(
CK_FUNCTION_LIST_PTR_PTR ppFunctionList
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetFunctionList);
PR_LOG(modlog, 1, ("C_GetFunctionList"));
PR_LOG(modlog, 3, (" ppFunctionList = 0x%p", ppFunctionList));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETFUNCITONLIST,&start);
rv = module_functions->C_GetFunctionList(ppFunctionList);
- nssdbg_finish_time(&counter_C_GetFunctionList,start);
+ nssdbg_finish_time(FUNC_C_GETFUNCITONLIST,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetSlotList = 0;
-static PRInt32 calls_C_GetSlotList = 0;
CK_RV NSSDBGC_GetSlotList(
CK_BBOOL tokenPresent,
CK_SLOT_ID_PTR pSlotList,
@@ -370,16 +505,15 @@ CK_RV NSSDBGC_GetSlotList(
CK_RV rv;
PRIntervalTime start;
CK_ULONG i;
- PR_AtomicIncrement(&calls_C_GetSlotList);
PR_LOG(modlog, 1, ("C_GetSlotList"));
PR_LOG(modlog, 3, (" tokenPresent = 0x%x", tokenPresent));
PR_LOG(modlog, 3, (" pSlotList = 0x%p", pSlotList));
PR_LOG(modlog, 3, (" pulCount = 0x%p", pulCount));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETSLOTLIST,&start);
rv = module_functions->C_GetSlotList(tokenPresent,
pSlotList,
pulCount);
- nssdbg_finish_time(&counter_C_GetSlotList,start);
+ nssdbg_finish_time(FUNC_C_GETSLOTLIST,start);
PR_LOG(modlog, 4, (" *pulCount = 0x%x", *pulCount));
if (pSlotList) {
for (i=0; i<*pulCount; i++) {
@@ -390,8 +524,6 @@ CK_RV NSSDBGC_GetSlotList(
return rv;
}
-static PRInt32 counter_C_GetSlotInfo = 0;
-static PRInt32 calls_C_GetSlotInfo = 0;
CK_RV NSSDBGC_GetSlotInfo(
CK_SLOT_ID slotID,
CK_SLOT_INFO_PTR pInfo
@@ -399,20 +531,17 @@ CK_RV NSSDBGC_GetSlotInfo(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetSlotInfo);
PR_LOG(modlog, 1, ("C_GetSlotInfo"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETSLOTINFO,&start);
rv = module_functions->C_GetSlotInfo(slotID,
pInfo);
- nssdbg_finish_time(&counter_C_GetSlotInfo,start);
+ nssdbg_finish_time(FUNC_C_GETSLOTINFO,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetTokenInfo = 0;
-static PRInt32 calls_C_GetTokenInfo = 0;
CK_RV NSSDBGC_GetTokenInfo(
CK_SLOT_ID slotID,
CK_TOKEN_INFO_PTR pInfo
@@ -420,20 +549,17 @@ CK_RV NSSDBGC_GetTokenInfo(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetTokenInfo);
PR_LOG(modlog, 1, ("C_GetTokenInfo"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETTOKENINFO,&start);
rv = module_functions->C_GetTokenInfo(slotID,
pInfo);
- nssdbg_finish_time(&counter_C_GetTokenInfo,start);
+ nssdbg_finish_time(FUNC_C_GETTOKENINFO,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetMechanismList = 0;
-static PRInt32 calls_C_GetMechanismList = 0;
CK_RV NSSDBGC_GetMechanismList(
CK_SLOT_ID slotID,
CK_MECHANISM_TYPE_PTR pMechanismList,
@@ -442,23 +568,20 @@ CK_RV NSSDBGC_GetMechanismList(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetMechanismList);
PR_LOG(modlog, 1, ("C_GetMechanismList"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
PR_LOG(modlog, 3, (" pMechanismList = 0x%p", pMechanismList));
PR_LOG(modlog, 3, (" pulCount = 0x%p", pulCount));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETMECHANISMLIST,&start);
rv = module_functions->C_GetMechanismList(slotID,
pMechanismList,
pulCount);
- nssdbg_finish_time(&counter_C_GetMechanismList,start);
+ nssdbg_finish_time(FUNC_C_GETMECHANISMLIST,start);
PR_LOG(modlog, 4, (" *pulCount = 0x%x", *pulCount));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetMechanismInfo = 0;
-static PRInt32 calls_C_GetMechanismInfo = 0;
CK_RV NSSDBGC_GetMechanismInfo(
CK_SLOT_ID slotID,
CK_MECHANISM_TYPE type,
@@ -467,22 +590,19 @@ CK_RV NSSDBGC_GetMechanismInfo(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetMechanismInfo);
PR_LOG(modlog, 1, ("C_GetMechanismInfo"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
PR_LOG(modlog, 3, (" type = 0x%x", type));
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETMECHANISMINFO,&start);
rv = module_functions->C_GetMechanismInfo(slotID,
type,
pInfo);
- nssdbg_finish_time(&counter_C_GetMechanismInfo,start);
+ nssdbg_finish_time(FUNC_C_GETMECHANISMINFO,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_InitToken = 0;
-static PRInt32 calls_C_InitToken = 0;
CK_RV NSSDBGC_InitToken(
CK_SLOT_ID slotID,
CK_CHAR_PTR pPin,
@@ -492,24 +612,21 @@ CK_RV NSSDBGC_InitToken(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_InitToken);
PR_LOG(modlog, 1, ("C_InitToken"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
PR_LOG(modlog, 3, (" pLabel = 0x%p", pLabel));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_INITTOKEN,&start);
rv = module_functions->C_InitToken(slotID,
pPin,
ulPinLen,
pLabel);
- nssdbg_finish_time(&counter_C_InitToken,start);
+ nssdbg_finish_time(FUNC_C_INITTOKEN,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_InitPIN = 0;
-static PRInt32 calls_C_InitPIN = 0;
CK_RV NSSDBGC_InitPIN(
CK_SESSION_HANDLE hSession,
CK_CHAR_PTR pPin,
@@ -518,22 +635,19 @@ CK_RV NSSDBGC_InitPIN(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_InitPIN);
PR_LOG(modlog, 1, ("C_InitPIN"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_INITPIN,&start);
rv = module_functions->C_InitPIN(hSession,
pPin,
ulPinLen);
- nssdbg_finish_time(&counter_C_InitPIN,start);
+ nssdbg_finish_time(FUNC_C_INITPIN,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SetPIN = 0;
-static PRInt32 calls_C_SetPIN = 0;
CK_RV NSSDBGC_SetPIN(
CK_SESSION_HANDLE hSession,
CK_CHAR_PTR pOldPin,
@@ -544,28 +658,25 @@ CK_RV NSSDBGC_SetPIN(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SetPIN);
PR_LOG(modlog, 1, ("C_SetPIN"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pOldPin = 0x%p", pOldPin));
PR_LOG(modlog, 3, (" ulOldLen = %d", ulOldLen));
PR_LOG(modlog, 3, (" pNewPin = 0x%p", pNewPin));
PR_LOG(modlog, 3, (" ulNewLen = %d", ulNewLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SETPIN,&start);
rv = module_functions->C_SetPIN(hSession,
pOldPin,
ulOldLen,
pNewPin,
ulNewLen);
- nssdbg_finish_time(&counter_C_SetPIN,start);
+ nssdbg_finish_time(FUNC_C_SETPIN,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_OpenSession = 0;
-static PRInt32 calls_C_OpenSession = 0;
-static PRInt32 numOpenSessions = 0;
-static PRInt32 maxOpenSessions = 0;
+static PRUint32 numOpenSessions = 0;
+static PRUint32 maxOpenSessions = 0;
CK_RV NSSDBGC_OpenSession(
CK_SLOT_ID slotID,
CK_FLAGS flags,
@@ -576,8 +687,7 @@ CK_RV NSSDBGC_OpenSession(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_OpenSession);
- PR_AtomicIncrement(&numOpenSessions);
+ PR_AtomicIncrement((PRInt32 *)&numOpenSessions);
maxOpenSessions = PR_MAX(numOpenSessions, maxOpenSessions);
PR_LOG(modlog, 1, ("C_OpenSession"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
@@ -585,57 +695,49 @@ CK_RV NSSDBGC_OpenSession(
PR_LOG(modlog, 3, (" pApplication = 0x%p", pApplication));
PR_LOG(modlog, 3, (" Notify = 0x%x", Notify));
PR_LOG(modlog, 3, (" phSession = 0x%p", phSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_OPENSESSION,&start);
rv = module_functions->C_OpenSession(slotID,
flags,
pApplication,
Notify,
phSession);
- nssdbg_finish_time(&counter_C_OpenSession,start);
+ nssdbg_finish_time(FUNC_C_OPENSESSION,start);
PR_LOG(modlog, 4, (" *phSession = 0x%x", *phSession));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_CloseSession = 0;
-static PRInt32 calls_C_CloseSession = 0;
CK_RV NSSDBGC_CloseSession(
CK_SESSION_HANDLE hSession
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_CloseSession);
- PR_AtomicDecrement(&numOpenSessions);
+ PR_AtomicDecrement((PRInt32 *)&numOpenSessions);
PR_LOG(modlog, 1, ("C_CloseSession"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_CLOSESESSION,&start);
rv = module_functions->C_CloseSession(hSession);
- nssdbg_finish_time(&counter_C_CloseSession,start);
+ nssdbg_finish_time(FUNC_C_CLOSESESSION,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_CloseAllSessions = 0;
-static PRInt32 calls_C_CloseAllSessions = 0;
CK_RV NSSDBGC_CloseAllSessions(
CK_SLOT_ID slotID
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_CloseAllSessions);
PR_LOG(modlog, 1, ("C_CloseAllSessions"));
PR_LOG(modlog, 3, (" slotID = 0x%x", slotID));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_CLOSEALLSESSIONS,&start);
rv = module_functions->C_CloseAllSessions(slotID);
- nssdbg_finish_time(&counter_C_CloseAllSessions,start);
+ nssdbg_finish_time(FUNC_C_CLOSEALLSESSIONS,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetSessionInfo = 0;
-static PRInt32 calls_C_GetSessionInfo = 0;
CK_RV NSSDBGC_GetSessionInfo(
CK_SESSION_HANDLE hSession,
CK_SESSION_INFO_PTR pInfo
@@ -643,20 +745,17 @@ CK_RV NSSDBGC_GetSessionInfo(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetSessionInfo);
PR_LOG(modlog, 1, ("C_GetSessionInfo"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pInfo = 0x%p", pInfo));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETSESSIONINFO,&start);
rv = module_functions->C_GetSessionInfo(hSession,
pInfo);
- nssdbg_finish_time(&counter_C_GetSessionInfo,start);
+ nssdbg_finish_time(FUNC_C_GETSESSIONINFO,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetOperationState = 0;
-static PRInt32 calls_C_GetOperationState = 0;
CK_RV NSSDBGC_GetOperationState(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pOperationState,
@@ -665,23 +764,20 @@ CK_RV NSSDBGC_GetOperationState(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetOperationState);
PR_LOG(modlog, 1, ("C_GetOperationState"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pOperationState = 0x%p", pOperationState));
PR_LOG(modlog, 3, (" pulOperationStateLen = 0x%p", pulOperationStateLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETOPERATIONSTATE,&start);
rv = module_functions->C_GetOperationState(hSession,
pOperationState,
pulOperationStateLen);
- nssdbg_finish_time(&counter_C_GetOperationState,start);
+ nssdbg_finish_time(FUNC_C_GETOPERATIONSTATE,start);
PR_LOG(modlog, 4, (" *pulOperationStateLen = 0x%x", *pulOperationStateLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SetOperationState = 0;
-static PRInt32 calls_C_SetOperationState = 0;
CK_RV NSSDBGC_SetOperationState(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pOperationState,
@@ -692,26 +788,23 @@ CK_RV NSSDBGC_SetOperationState(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SetOperationState);
PR_LOG(modlog, 1, ("C_SetOperationState"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pOperationState = 0x%p", pOperationState));
PR_LOG(modlog, 3, (" ulOperationStateLen = %d", ulOperationStateLen));
PR_LOG(modlog, 3, (" hEncryptionKey = 0x%x", hEncryptionKey));
PR_LOG(modlog, 3, (" hAuthenticationKey = 0x%x", hAuthenticationKey));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SETOPERATIONSTATE,&start);
rv = module_functions->C_SetOperationState(hSession,
pOperationState,
ulOperationStateLen,
hEncryptionKey,
hAuthenticationKey);
- nssdbg_finish_time(&counter_C_SetOperationState,start);
+ nssdbg_finish_time(FUNC_C_SETOPERATIONSTATE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Login = 0;
-static PRInt32 calls_C_Login = 0;
CK_RV NSSDBGC_Login(
CK_SESSION_HANDLE hSession,
CK_USER_TYPE userType,
@@ -721,42 +814,36 @@ CK_RV NSSDBGC_Login(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Login);
PR_LOG(modlog, 1, ("C_Login"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" userType = 0x%x", userType));
PR_LOG(modlog, 3, (" pPin = 0x%p", pPin));
PR_LOG(modlog, 3, (" ulPinLen = %d", ulPinLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_LOGIN,&start);
rv = module_functions->C_Login(hSession,
userType,
pPin,
ulPinLen);
- nssdbg_finish_time(&counter_C_Login,start);
+ nssdbg_finish_time(FUNC_C_LOGIN,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Logout = 0;
-static PRInt32 calls_C_Logout = 0;
CK_RV NSSDBGC_Logout(
CK_SESSION_HANDLE hSession
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Logout);
PR_LOG(modlog, 1, ("C_Logout"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_LOGOUT,&start);
rv = module_functions->C_Logout(hSession);
- nssdbg_finish_time(&counter_C_Logout,start);
+ nssdbg_finish_time(FUNC_C_LOGOUT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_CreateObject = 0;
-static PRInt32 calls_C_CreateObject = 0;
CK_RV NSSDBGC_CreateObject(
CK_SESSION_HANDLE hSession,
CK_ATTRIBUTE_PTR pTemplate,
@@ -766,26 +853,23 @@ CK_RV NSSDBGC_CreateObject(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_CreateObject);
PR_LOG(modlog, 1, ("C_CreateObject"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
PR_LOG(modlog, 3, (" phObject = 0x%p", phObject));
print_template(pTemplate, ulCount);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_CREATEOBJECT,&start);
rv = module_functions->C_CreateObject(hSession,
pTemplate,
ulCount,
phObject);
- nssdbg_finish_time(&counter_C_CreateObject,start);
+ nssdbg_finish_time(FUNC_C_CREATEOBJECT,start);
PR_LOG(modlog, 4, (" *phObject = 0x%x", *phObject));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_CopyObject = 0;
-static PRInt32 calls_C_CopyObject = 0;
CK_RV NSSDBGC_CopyObject(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject,
@@ -796,7 +880,6 @@ CK_RV NSSDBGC_CopyObject(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_CopyObject);
PR_LOG(modlog, 1, ("C_CopyObject"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
@@ -804,20 +887,18 @@ CK_RV NSSDBGC_CopyObject(
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
PR_LOG(modlog, 3, (" phNewObject = 0x%p", phNewObject));
print_template(pTemplate, ulCount);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_COPYOBJECT,&start);
rv = module_functions->C_CopyObject(hSession,
hObject,
pTemplate,
ulCount,
phNewObject);
- nssdbg_finish_time(&counter_C_CopyObject,start);
+ nssdbg_finish_time(FUNC_C_COPYOBJECT,start);
PR_LOG(modlog, 4, (" *phNewObject = 0x%x", *phNewObject));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DestroyObject = 0;
-static PRInt32 calls_C_DestroyObject = 0;
CK_RV NSSDBGC_DestroyObject(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject
@@ -825,20 +906,17 @@ CK_RV NSSDBGC_DestroyObject(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DestroyObject);
PR_LOG(modlog, 1, ("C_DestroyObject"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DESTROYOBJECT,&start);
rv = module_functions->C_DestroyObject(hSession,
hObject);
- nssdbg_finish_time(&counter_C_DestroyObject,start);
+ nssdbg_finish_time(FUNC_C_DESTROYOBJECT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetObjectSize = 0;
-static PRInt32 calls_C_GetObjectSize = 0;
CK_RV NSSDBGC_GetObjectSize(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject,
@@ -847,23 +925,20 @@ CK_RV NSSDBGC_GetObjectSize(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetObjectSize);
PR_LOG(modlog, 1, ("C_GetObjectSize"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
PR_LOG(modlog, 3, (" pulSize = 0x%p", pulSize));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETOBJECTSIZE,&start);
rv = module_functions->C_GetObjectSize(hSession,
hObject,
pulSize);
- nssdbg_finish_time(&counter_C_GetObjectSize,start);
+ nssdbg_finish_time(FUNC_C_GETOBJECTSIZE,start);
PR_LOG(modlog, 4, (" *pulSize = 0x%x", *pulSize));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetAttributeValue = 0;
-static PRInt32 calls_C_GetAttributeValue = 0;
CK_RV NSSDBGC_GetAttributeValue(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject,
@@ -873,25 +948,22 @@ CK_RV NSSDBGC_GetAttributeValue(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetAttributeValue);
PR_LOG(modlog, 1, ("C_GetAttributeValue"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETATTRIBUTEVALUE,&start);
rv = module_functions->C_GetAttributeValue(hSession,
hObject,
pTemplate,
ulCount);
- nssdbg_finish_time(&counter_C_GetAttributeValue,start);
+ nssdbg_finish_time(FUNC_C_GETATTRIBUTEVALUE,start);
print_template(pTemplate, ulCount);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SetAttributeValue = 0;
-static PRInt32 calls_C_SetAttributeValue = 0;
CK_RV NSSDBGC_SetAttributeValue(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hObject,
@@ -901,25 +973,22 @@ CK_RV NSSDBGC_SetAttributeValue(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SetAttributeValue);
PR_LOG(modlog, 1, ("C_SetAttributeValue"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" hObject = 0x%x", hObject));
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
print_template(pTemplate, ulCount);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SETATTRIBUTEVALUE,&start);
rv = module_functions->C_SetAttributeValue(hSession,
hObject,
pTemplate,
ulCount);
- nssdbg_finish_time(&counter_C_SetAttributeValue,start);
+ nssdbg_finish_time(FUNC_C_SETATTRIBUTEVALUE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_FindObjectsInit = 0;
-static PRInt32 calls_C_FindObjectsInit = 0;
CK_RV NSSDBGC_FindObjectsInit(
CK_SESSION_HANDLE hSession,
CK_ATTRIBUTE_PTR pTemplate,
@@ -928,23 +997,20 @@ CK_RV NSSDBGC_FindObjectsInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_FindObjectsInit);
PR_LOG(modlog, 1, ("C_FindObjectsInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pTemplate = 0x%p", pTemplate));
PR_LOG(modlog, 3, (" ulCount = %d", ulCount));
print_template(pTemplate, ulCount);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_FINDOBJECTSINIT,&start);
rv = module_functions->C_FindObjectsInit(hSession,
pTemplate,
ulCount);
- nssdbg_finish_time(&counter_C_FindObjectsInit,start);
+ nssdbg_finish_time(FUNC_C_FINDOBJECTSINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_FindObjects = 0;
-static PRInt32 calls_C_FindObjects = 0;
CK_RV NSSDBGC_FindObjects(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE_PTR phObject,
@@ -955,18 +1021,17 @@ CK_RV NSSDBGC_FindObjects(
CK_RV rv;
CK_ULONG i;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_FindObjects);
PR_LOG(modlog, 1, ("C_FindObjects"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" phObject = 0x%p", phObject));
PR_LOG(modlog, 3, (" ulMaxObjectCount = %d", ulMaxObjectCount));
PR_LOG(modlog, 3, (" pulObjectCount = 0x%p", pulObjectCount));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_FINDOBJECTS,&start);
rv = module_functions->C_FindObjects(hSession,
phObject,
ulMaxObjectCount,
pulObjectCount);
- nssdbg_finish_time(&counter_C_FindObjects,start);
+ nssdbg_finish_time(FUNC_C_FINDOBJECTS,start);
PR_LOG(modlog, 4, (" *pulObjectCount = 0x%x", *pulObjectCount));
for (i=0; i<*pulObjectCount; i++) {
PR_LOG(modlog, 4, (" phObject[%d] = 0x%x", i, phObject[i]));
@@ -975,26 +1040,21 @@ CK_RV NSSDBGC_FindObjects(
return rv;
}
-static PRInt32 counter_C_FindObjectsFinal = 0;
-static PRInt32 calls_C_FindObjectsFinal = 0;
CK_RV NSSDBGC_FindObjectsFinal(
CK_SESSION_HANDLE hSession
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_FindObjectsFinal);
PR_LOG(modlog, 1, ("C_FindObjectsFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_FINDOBJECTSFINAL,&start);
rv = module_functions->C_FindObjectsFinal(hSession);
- nssdbg_finish_time(&counter_C_FindObjectsFinal,start);
+ nssdbg_finish_time(FUNC_C_FINDOBJECTSFINAL,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_EncryptInit = 0;
-static PRInt32 calls_C_EncryptInit = 0;
CK_RV NSSDBGC_EncryptInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1003,23 +1063,20 @@ CK_RV NSSDBGC_EncryptInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_EncryptInit);
PR_LOG(modlog, 1, ("C_EncryptInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_ENCRYPTINIT,&start);
rv = module_functions->C_EncryptInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_EncryptInit,start);
+ nssdbg_finish_time(FUNC_C_ENCRYPTINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Encrypt = 0;
-static PRInt32 calls_C_Encrypt = 0;
CK_RV NSSDBGC_Encrypt(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
@@ -1030,27 +1087,24 @@ CK_RV NSSDBGC_Encrypt(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Encrypt);
PR_LOG(modlog, 1, ("C_Encrypt"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
PR_LOG(modlog, 3, (" pEncryptedData = 0x%p", pEncryptedData));
PR_LOG(modlog, 3, (" pulEncryptedDataLen = 0x%p", pulEncryptedDataLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_ENCRYPT,&start);
rv = module_functions->C_Encrypt(hSession,
pData,
ulDataLen,
pEncryptedData,
pulEncryptedDataLen);
- nssdbg_finish_time(&counter_C_Encrypt,start);
+ nssdbg_finish_time(FUNC_C_ENCRYPT,start);
PR_LOG(modlog, 4, (" *pulEncryptedDataLen = 0x%x", *pulEncryptedDataLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_EncryptUpdate = 0;
-static PRInt32 calls_C_EncryptUpdate = 0;
CK_RV NSSDBGC_EncryptUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1061,27 +1115,24 @@ CK_RV NSSDBGC_EncryptUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_EncryptUpdate);
PR_LOG(modlog, 1, ("C_EncryptUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_ENCRYPTUPDATE,&start);
rv = module_functions->C_EncryptUpdate(hSession,
pPart,
ulPartLen,
pEncryptedPart,
pulEncryptedPartLen);
- nssdbg_finish_time(&counter_C_EncryptUpdate,start);
+ nssdbg_finish_time(FUNC_C_ENCRYPTUPDATE,start);
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_EncryptFinal = 0;
-static PRInt32 calls_C_EncryptFinal = 0;
CK_RV NSSDBGC_EncryptFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pLastEncryptedPart,
@@ -1090,23 +1141,20 @@ CK_RV NSSDBGC_EncryptFinal(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_EncryptFinal);
PR_LOG(modlog, 1, ("C_EncryptFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pLastEncryptedPart = 0x%p", pLastEncryptedPart));
PR_LOG(modlog, 3, (" pulLastEncryptedPartLen = 0x%p", pulLastEncryptedPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_ENCRYPTFINAL,&start);
rv = module_functions->C_EncryptFinal(hSession,
pLastEncryptedPart,
pulLastEncryptedPartLen);
- nssdbg_finish_time(&counter_C_EncryptFinal,start);
+ nssdbg_finish_time(FUNC_C_ENCRYPTFINAL,start);
PR_LOG(modlog, 4, (" *pulLastEncryptedPartLen = 0x%x", *pulLastEncryptedPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DecryptInit = 0;
-static PRInt32 calls_C_DecryptInit = 0;
CK_RV NSSDBGC_DecryptInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1115,23 +1163,20 @@ CK_RV NSSDBGC_DecryptInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DecryptInit);
PR_LOG(modlog, 1, ("C_DecryptInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPTINIT,&start);
rv = module_functions->C_DecryptInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_DecryptInit,start);
+ nssdbg_finish_time(FUNC_C_DECRYPTINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Decrypt = 0;
-static PRInt32 calls_C_Decrypt = 0;
CK_RV NSSDBGC_Decrypt(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedData,
@@ -1142,27 +1187,24 @@ CK_RV NSSDBGC_Decrypt(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Decrypt);
PR_LOG(modlog, 1, ("C_Decrypt"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pEncryptedData = 0x%p", pEncryptedData));
PR_LOG(modlog, 3, (" ulEncryptedDataLen = %d", ulEncryptedDataLen));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" pulDataLen = 0x%p", pulDataLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPT,&start);
rv = module_functions->C_Decrypt(hSession,
pEncryptedData,
ulEncryptedDataLen,
pData,
pulDataLen);
- nssdbg_finish_time(&counter_C_Decrypt,start);
+ nssdbg_finish_time(FUNC_C_DECRYPT,start);
PR_LOG(modlog, 4, (" *pulDataLen = 0x%x", *pulDataLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DecryptUpdate = 0;
-static PRInt32 calls_C_DecryptUpdate = 0;
CK_RV NSSDBGC_DecryptUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedPart,
@@ -1173,27 +1215,24 @@ CK_RV NSSDBGC_DecryptUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DecryptUpdate);
PR_LOG(modlog, 1, ("C_DecryptUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPTUPDATE,&start);
rv = module_functions->C_DecryptUpdate(hSession,
pEncryptedPart,
ulEncryptedPartLen,
pPart,
pulPartLen);
- nssdbg_finish_time(&counter_C_DecryptUpdate,start);
+ nssdbg_finish_time(FUNC_C_DECRYPTUPDATE,start);
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DecryptFinal = 0;
-static PRInt32 calls_C_DecryptFinal = 0;
CK_RV NSSDBGC_DecryptFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pLastPart,
@@ -1202,23 +1241,20 @@ CK_RV NSSDBGC_DecryptFinal(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DecryptFinal);
PR_LOG(modlog, 1, ("C_DecryptFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pLastPart = 0x%p", pLastPart));
PR_LOG(modlog, 3, (" pulLastPartLen = 0x%p", pulLastPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPTFINAL,&start);
rv = module_functions->C_DecryptFinal(hSession,
pLastPart,
pulLastPartLen);
- nssdbg_finish_time(&counter_C_DecryptFinal,start);
+ nssdbg_finish_time(FUNC_C_DECRYPTFINAL,start);
PR_LOG(modlog, 4, (" *pulLastPartLen = 0x%x", *pulLastPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DigestInit = 0;
-static PRInt32 calls_C_DigestInit = 0;
CK_RV NSSDBGC_DigestInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism
@@ -1226,21 +1262,18 @@ CK_RV NSSDBGC_DigestInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DigestInit);
PR_LOG(modlog, 1, ("C_DigestInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGESTINIT,&start);
rv = module_functions->C_DigestInit(hSession,
pMechanism);
- nssdbg_finish_time(&counter_C_DigestInit,start);
+ nssdbg_finish_time(FUNC_C_DIGESTINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Digest = 0;
-static PRInt32 calls_C_Digest = 0;
CK_RV NSSDBGC_Digest(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
@@ -1251,27 +1284,24 @@ CK_RV NSSDBGC_Digest(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Digest);
PR_LOG(modlog, 1, ("C_Digest"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
PR_LOG(modlog, 3, (" pDigest = 0x%p", pDigest));
PR_LOG(modlog, 3, (" pulDigestLen = 0x%p", pulDigestLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGEST,&start);
rv = module_functions->C_Digest(hSession,
pData,
ulDataLen,
pDigest,
pulDigestLen);
- nssdbg_finish_time(&counter_C_Digest,start);
+ nssdbg_finish_time(FUNC_C_DIGEST,start);
PR_LOG(modlog, 4, (" *pulDigestLen = 0x%x", *pulDigestLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DigestUpdate = 0;
-static PRInt32 calls_C_DigestUpdate = 0;
CK_RV NSSDBGC_DigestUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1280,22 +1310,19 @@ CK_RV NSSDBGC_DigestUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DigestUpdate);
PR_LOG(modlog, 1, ("C_DigestUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGESTUPDATE,&start);
rv = module_functions->C_DigestUpdate(hSession,
pPart,
ulPartLen);
- nssdbg_finish_time(&counter_C_DigestUpdate,start);
+ nssdbg_finish_time(FUNC_C_DIGESTUPDATE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DigestKey = 0;
-static PRInt32 calls_C_DigestKey = 0;
CK_RV NSSDBGC_DigestKey(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hKey
@@ -1303,20 +1330,16 @@ CK_RV NSSDBGC_DigestKey(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DigestKey);
PR_LOG(modlog, 1, ("C_DigestKey"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGESTKEY,&start);
rv = module_functions->C_DigestKey(hSession,
hKey);
- nssdbg_finish_time(&counter_C_DigestKey,start);
+ nssdbg_finish_time(FUNC_C_DIGESTKEY,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DigestFinal = 0;
-static PRInt32 calls_C_DigestFinal = 0;
CK_RV NSSDBGC_DigestFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pDigest,
@@ -1325,23 +1348,20 @@ CK_RV NSSDBGC_DigestFinal(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DigestFinal);
PR_LOG(modlog, 1, ("C_DigestFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pDigest = 0x%p", pDigest));
PR_LOG(modlog, 3, (" pulDigestLen = 0x%p", pulDigestLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGESTFINAL,&start);
rv = module_functions->C_DigestFinal(hSession,
pDigest,
pulDigestLen);
- nssdbg_finish_time(&counter_C_DigestFinal,start);
+ nssdbg_finish_time(FUNC_C_DIGESTFINAL,start);
PR_LOG(modlog, 4, (" *pulDigestLen = 0x%x", *pulDigestLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignInit = 0;
-static PRInt32 calls_C_SignInit = 0;
CK_RV NSSDBGC_SignInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1350,23 +1370,20 @@ CK_RV NSSDBGC_SignInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignInit);
PR_LOG(modlog, 1, ("C_SignInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNINIT,&start);
rv = module_functions->C_SignInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_SignInit,start);
+ nssdbg_finish_time(FUNC_C_SIGNINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Sign = 0;
-static PRInt32 calls_C_Sign = 0;
CK_RV NSSDBGC_Sign(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
@@ -1377,27 +1394,24 @@ CK_RV NSSDBGC_Sign(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Sign);
PR_LOG(modlog, 1, ("C_Sign"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGN,&start);
rv = module_functions->C_Sign(hSession,
pData,
ulDataLen,
pSignature,
pulSignatureLen);
- nssdbg_finish_time(&counter_C_Sign,start);
+ nssdbg_finish_time(FUNC_C_SIGN,start);
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignUpdate = 0;
-static PRInt32 calls_C_SignUpdate = 0;
CK_RV NSSDBGC_SignUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1406,22 +1420,19 @@ CK_RV NSSDBGC_SignUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignUpdate);
PR_LOG(modlog, 1, ("C_SignUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNUPDATE,&start);
rv = module_functions->C_SignUpdate(hSession,
pPart,
ulPartLen);
- nssdbg_finish_time(&counter_C_SignUpdate,start);
+ nssdbg_finish_time(FUNC_C_SIGNUPDATE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignFinal = 0;
-static PRInt32 calls_C_SignFinal = 0;
CK_RV NSSDBGC_SignFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pSignature,
@@ -1430,23 +1441,20 @@ CK_RV NSSDBGC_SignFinal(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignFinal);
PR_LOG(modlog, 1, ("C_SignFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNFINAL,&start);
rv = module_functions->C_SignFinal(hSession,
pSignature,
pulSignatureLen);
- nssdbg_finish_time(&counter_C_SignFinal,start);
+ nssdbg_finish_time(FUNC_C_SIGNFINAL,start);
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignRecoverInit = 0;
-static PRInt32 calls_C_SignRecoverInit = 0;
CK_RV NSSDBGC_SignRecoverInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1455,23 +1463,20 @@ CK_RV NSSDBGC_SignRecoverInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignRecoverInit);
PR_LOG(modlog, 1, ("C_SignRecoverInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNRECOVERINIT,&start);
rv = module_functions->C_SignRecoverInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_SignRecoverInit,start);
+ nssdbg_finish_time(FUNC_C_SIGNRECOVERINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignRecover = 0;
-static PRInt32 calls_C_SignRecover = 0;
CK_RV NSSDBGC_SignRecover(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
@@ -1482,27 +1487,24 @@ CK_RV NSSDBGC_SignRecover(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignRecover);
PR_LOG(modlog, 1, ("C_SignRecover"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" pulSignatureLen = 0x%p", pulSignatureLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNRECOVER,&start);
rv = module_functions->C_SignRecover(hSession,
pData,
ulDataLen,
pSignature,
pulSignatureLen);
- nssdbg_finish_time(&counter_C_SignRecover,start);
+ nssdbg_finish_time(FUNC_C_SIGNRECOVER,start);
PR_LOG(modlog, 4, (" *pulSignatureLen = 0x%x", *pulSignatureLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_VerifyInit = 0;
-static PRInt32 calls_C_VerifyInit = 0;
CK_RV NSSDBGC_VerifyInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1511,23 +1513,20 @@ CK_RV NSSDBGC_VerifyInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_VerifyInit);
PR_LOG(modlog, 1, ("C_VerifyInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFYINIT,&start);
rv = module_functions->C_VerifyInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_VerifyInit,start);
+ nssdbg_finish_time(FUNC_C_VERIFYINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_Verify = 0;
-static PRInt32 calls_C_Verify = 0;
CK_RV NSSDBGC_Verify(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
@@ -1538,26 +1537,23 @@ CK_RV NSSDBGC_Verify(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_Verify);
PR_LOG(modlog, 1, ("C_Verify"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" ulDataLen = %d", ulDataLen));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFY,&start);
rv = module_functions->C_Verify(hSession,
pData,
ulDataLen,
pSignature,
ulSignatureLen);
- nssdbg_finish_time(&counter_C_Verify,start);
+ nssdbg_finish_time(FUNC_C_VERIFY,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_VerifyUpdate = 0;
-static PRInt32 calls_C_VerifyUpdate = 0;
CK_RV NSSDBGC_VerifyUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1566,22 +1562,19 @@ CK_RV NSSDBGC_VerifyUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_VerifyUpdate);
PR_LOG(modlog, 1, ("C_VerifyUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFYUPDATE,&start);
rv = module_functions->C_VerifyUpdate(hSession,
pPart,
ulPartLen);
- nssdbg_finish_time(&counter_C_VerifyUpdate,start);
+ nssdbg_finish_time(FUNC_C_VERIFYUPDATE,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_VerifyFinal = 0;
-static PRInt32 calls_C_VerifyFinal = 0;
CK_RV NSSDBGC_VerifyFinal(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pSignature,
@@ -1590,22 +1583,19 @@ CK_RV NSSDBGC_VerifyFinal(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_VerifyFinal);
PR_LOG(modlog, 1, ("C_VerifyFinal"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFYFINAL,&start);
rv = module_functions->C_VerifyFinal(hSession,
pSignature,
ulSignatureLen);
- nssdbg_finish_time(&counter_C_VerifyFinal,start);
+ nssdbg_finish_time(FUNC_C_VERIFYFINAL,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_VerifyRecoverInit = 0;
-static PRInt32 calls_C_VerifyRecoverInit = 0;
CK_RV NSSDBGC_VerifyRecoverInit(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1614,23 +1604,20 @@ CK_RV NSSDBGC_VerifyRecoverInit(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_VerifyRecoverInit);
PR_LOG(modlog, 1, ("C_VerifyRecoverInit"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
PR_LOG(modlog, 3, (" hKey = 0x%x", hKey));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFYRECOVERINIT,&start);
rv = module_functions->C_VerifyRecoverInit(hSession,
pMechanism,
hKey);
- nssdbg_finish_time(&counter_C_VerifyRecoverInit,start);
+ nssdbg_finish_time(FUNC_C_VERIFYRECOVERINIT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_VerifyRecover = 0;
-static PRInt32 calls_C_VerifyRecover = 0;
CK_RV NSSDBGC_VerifyRecover(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pSignature,
@@ -1641,27 +1628,24 @@ CK_RV NSSDBGC_VerifyRecover(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_VerifyRecover);
PR_LOG(modlog, 1, ("C_VerifyRecover"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pSignature = 0x%p", pSignature));
PR_LOG(modlog, 3, (" ulSignatureLen = %d", ulSignatureLen));
PR_LOG(modlog, 3, (" pData = 0x%p", pData));
PR_LOG(modlog, 3, (" pulDataLen = 0x%p", pulDataLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_VERIFYRECOVER,&start);
rv = module_functions->C_VerifyRecover(hSession,
pSignature,
ulSignatureLen,
pData,
pulDataLen);
- nssdbg_finish_time(&counter_C_VerifyRecover,start);
+ nssdbg_finish_time(FUNC_C_VERIFYRECOVER,start);
PR_LOG(modlog, 4, (" *pulDataLen = 0x%x", *pulDataLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DigestEncryptUpdate = 0;
-static PRInt32 calls_C_DigestEncryptUpdate = 0;
CK_RV NSSDBGC_DigestEncryptUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1672,27 +1656,24 @@ CK_RV NSSDBGC_DigestEncryptUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DigestEncryptUpdate);
PR_LOG(modlog, 1, ("C_DigestEncryptUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DIGESTENCRYPTUPDATE,&start);
rv = module_functions->C_DigestEncryptUpdate(hSession,
pPart,
ulPartLen,
pEncryptedPart,
pulEncryptedPartLen);
- nssdbg_finish_time(&counter_C_DigestEncryptUpdate,start);
+ nssdbg_finish_time(FUNC_C_DIGESTENCRYPTUPDATE,start);
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DecryptDigestUpdate = 0;
-static PRInt32 calls_C_DecryptDigestUpdate = 0;
CK_RV NSSDBGC_DecryptDigestUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedPart,
@@ -1703,27 +1684,24 @@ CK_RV NSSDBGC_DecryptDigestUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DecryptDigestUpdate);
PR_LOG(modlog, 1, ("C_DecryptDigestUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPTDIGESTUPDATE,&start);
rv = module_functions->C_DecryptDigestUpdate(hSession,
pEncryptedPart,
ulEncryptedPartLen,
pPart,
pulPartLen);
- nssdbg_finish_time(&counter_C_DecryptDigestUpdate,start);
+ nssdbg_finish_time(FUNC_C_DECRYPTDIGESTUPDATE,start);
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SignEncryptUpdate = 0;
-static PRInt32 calls_C_SignEncryptUpdate = 0;
CK_RV NSSDBGC_SignEncryptUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pPart,
@@ -1734,27 +1712,24 @@ CK_RV NSSDBGC_SignEncryptUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SignEncryptUpdate);
PR_LOG(modlog, 1, ("C_SignEncryptUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" ulPartLen = %d", ulPartLen));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" pulEncryptedPartLen = 0x%p", pulEncryptedPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SIGNENCRYPTUPDATE,&start);
rv = module_functions->C_SignEncryptUpdate(hSession,
pPart,
ulPartLen,
pEncryptedPart,
pulEncryptedPartLen);
- nssdbg_finish_time(&counter_C_SignEncryptUpdate,start);
+ nssdbg_finish_time(FUNC_C_SIGNENCRYPTUPDATE,start);
PR_LOG(modlog, 4, (" *pulEncryptedPartLen = 0x%x", *pulEncryptedPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DecryptVerifyUpdate = 0;
-static PRInt32 calls_C_DecryptVerifyUpdate = 0;
CK_RV NSSDBGC_DecryptVerifyUpdate(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedPart,
@@ -1765,27 +1740,24 @@ CK_RV NSSDBGC_DecryptVerifyUpdate(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DecryptVerifyUpdate);
PR_LOG(modlog, 1, ("C_DecryptVerifyUpdate"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pEncryptedPart = 0x%p", pEncryptedPart));
PR_LOG(modlog, 3, (" ulEncryptedPartLen = %d", ulEncryptedPartLen));
PR_LOG(modlog, 3, (" pPart = 0x%p", pPart));
PR_LOG(modlog, 3, (" pulPartLen = 0x%p", pulPartLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DECRYPTVERIFYUPDATE,&start);
rv = module_functions->C_DecryptVerifyUpdate(hSession,
pEncryptedPart,
ulEncryptedPartLen,
pPart,
pulPartLen);
- nssdbg_finish_time(&counter_C_DecryptVerifyUpdate,start);
+ nssdbg_finish_time(FUNC_C_DECRYPTVERIFYUPDATE,start);
PR_LOG(modlog, 4, (" *pulPartLen = 0x%x", *pulPartLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GenerateKey = 0;
-static PRInt32 calls_C_GenerateKey = 0;
CK_RV NSSDBGC_GenerateKey(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1796,7 +1768,6 @@ CK_RV NSSDBGC_GenerateKey(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GenerateKey);
PR_LOG(modlog, 1, ("C_GenerateKey"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
@@ -1805,20 +1776,18 @@ CK_RV NSSDBGC_GenerateKey(
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
print_template(pTemplate, ulCount);
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GENERATEKEY,&start);
rv = module_functions->C_GenerateKey(hSession,
pMechanism,
pTemplate,
ulCount,
phKey);
- nssdbg_finish_time(&counter_C_GenerateKey,start);
+ nssdbg_finish_time(FUNC_C_GENERATEKEY,start);
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GenerateKeyPair = 0;
-static PRInt32 calls_C_GenerateKeyPair = 0;
CK_RV NSSDBGC_GenerateKeyPair(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1832,7 +1801,6 @@ CK_RV NSSDBGC_GenerateKeyPair(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GenerateKeyPair);
PR_LOG(modlog, 1, ("C_GenerateKeyPair"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
@@ -1845,7 +1813,7 @@ CK_RV NSSDBGC_GenerateKeyPair(
print_template(pPublicKeyTemplate, ulPublicKeyAttributeCount);
print_template(pPrivateKeyTemplate, ulPrivateKeyAttributeCount);
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GENERATEKEYPAIR,&start);
rv = module_functions->C_GenerateKeyPair(hSession,
pMechanism,
pPublicKeyTemplate,
@@ -1854,15 +1822,13 @@ CK_RV NSSDBGC_GenerateKeyPair(
ulPrivateKeyAttributeCount,
phPublicKey,
phPrivateKey);
- nssdbg_finish_time(&counter_C_GenerateKeyPair,start);
+ nssdbg_finish_time(FUNC_C_GENERATEKEYPAIR,start);
PR_LOG(modlog, 4, (" *phPublicKey = 0x%x", *phPublicKey));
PR_LOG(modlog, 4, (" *phPrivateKey = 0x%x", *phPrivateKey));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_WrapKey = 0;
-static PRInt32 calls_C_WrapKey = 0;
CK_RV NSSDBGC_WrapKey(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1874,7 +1840,6 @@ CK_RV NSSDBGC_WrapKey(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_WrapKey);
PR_LOG(modlog, 1, ("C_WrapKey"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
@@ -1883,21 +1848,19 @@ CK_RV NSSDBGC_WrapKey(
PR_LOG(modlog, 3, (" pWrappedKey = 0x%p", pWrappedKey));
PR_LOG(modlog, 3, (" pulWrappedKeyLen = 0x%p", pulWrappedKeyLen));
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_WRAPKEY,&start);
rv = module_functions->C_WrapKey(hSession,
pMechanism,
hWrappingKey,
hKey,
pWrappedKey,
pulWrappedKeyLen);
- nssdbg_finish_time(&counter_C_WrapKey,start);
+ nssdbg_finish_time(FUNC_C_WRAPKEY,start);
PR_LOG(modlog, 4, (" *pulWrappedKeyLen = 0x%x", *pulWrappedKeyLen));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_UnwrapKey = 0;
-static PRInt32 calls_C_UnwrapKey = 0;
CK_RV NSSDBGC_UnwrapKey(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1911,7 +1874,6 @@ CK_RV NSSDBGC_UnwrapKey(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_UnwrapKey);
PR_LOG(modlog, 1, ("C_UnwrapKey"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
@@ -1923,7 +1885,7 @@ CK_RV NSSDBGC_UnwrapKey(
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
print_template(pTemplate, ulAttributeCount);
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_UNWRAPKEY,&start);
rv = module_functions->C_UnwrapKey(hSession,
pMechanism,
hUnwrappingKey,
@@ -1932,14 +1894,12 @@ CK_RV NSSDBGC_UnwrapKey(
pTemplate,
ulAttributeCount,
phKey);
- nssdbg_finish_time(&counter_C_UnwrapKey,start);
+ nssdbg_finish_time(FUNC_C_UNWRAPKEY,start);
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_DeriveKey = 0;
-static PRInt32 calls_C_DeriveKey = 0;
CK_RV NSSDBGC_DeriveKey(
CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
@@ -1951,7 +1911,6 @@ CK_RV NSSDBGC_DeriveKey(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_DeriveKey);
PR_LOG(modlog, 1, ("C_DeriveKey"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pMechanism = 0x%p", pMechanism));
@@ -1961,21 +1920,19 @@ CK_RV NSSDBGC_DeriveKey(
PR_LOG(modlog, 3, (" phKey = 0x%p", phKey));
print_template(pTemplate, ulAttributeCount);
print_mechanism(pMechanism);
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_DERIVEKEY,&start);
rv = module_functions->C_DeriveKey(hSession,
pMechanism,
hBaseKey,
pTemplate,
ulAttributeCount,
phKey);
- nssdbg_finish_time(&counter_C_DeriveKey,start);
+ nssdbg_finish_time(FUNC_C_DERIVEKEY,start);
PR_LOG(modlog, 4, (" *phKey = 0x%x", *phKey));
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_SeedRandom = 0;
-static PRInt32 calls_C_SeedRandom = 0;
CK_RV NSSDBGC_SeedRandom(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pSeed,
@@ -1984,22 +1941,19 @@ CK_RV NSSDBGC_SeedRandom(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_SeedRandom);
PR_LOG(modlog, 1, ("C_SeedRandom"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" pSeed = 0x%p", pSeed));
PR_LOG(modlog, 3, (" ulSeedLen = %d", ulSeedLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_SEEDRANDOM,&start);
rv = module_functions->C_SeedRandom(hSession,
pSeed,
ulSeedLen);
- nssdbg_finish_time(&counter_C_SeedRandom,start);
+ nssdbg_finish_time(FUNC_C_SEEDRANDOM,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GenerateRandom = 0;
-static PRInt32 calls_C_GenerateRandom = 0;
CK_RV NSSDBGC_GenerateRandom(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR RandomData,
@@ -2008,58 +1962,49 @@ CK_RV NSSDBGC_GenerateRandom(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GenerateRandom);
PR_LOG(modlog, 1, ("C_GenerateRandom"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
PR_LOG(modlog, 3, (" RandomData = 0x%p", RandomData));
PR_LOG(modlog, 3, (" ulRandomLen = %d", ulRandomLen));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GENERATERANDOM,&start);
rv = module_functions->C_GenerateRandom(hSession,
RandomData,
ulRandomLen);
- nssdbg_finish_time(&counter_C_GenerateRandom,start);
+ nssdbg_finish_time(FUNC_C_GENERATERANDOM,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_GetFunctionStatus = 0;
-static PRInt32 calls_C_GetFunctionStatus = 0;
CK_RV NSSDBGC_GetFunctionStatus(
CK_SESSION_HANDLE hSession
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_GetFunctionStatus);
PR_LOG(modlog, 1, ("C_GetFunctionStatus"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_GETFUNCTIONSTATUS,&start);
rv = module_functions->C_GetFunctionStatus(hSession);
- nssdbg_finish_time(&counter_C_GetFunctionStatus,start);
+ nssdbg_finish_time(FUNC_C_GETFUNCTIONSTATUS,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_CancelFunction = 0;
-static PRInt32 calls_C_CancelFunction = 0;
CK_RV NSSDBGC_CancelFunction(
CK_SESSION_HANDLE hSession
)
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_CancelFunction);
PR_LOG(modlog, 1, ("C_CancelFunction"));
PR_LOG(modlog, 3, (" hSession = 0x%x", hSession));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_CANCELFUNCTION,&start);
rv = module_functions->C_CancelFunction(hSession);
- nssdbg_finish_time(&counter_C_CancelFunction,start);
+ nssdbg_finish_time(FUNC_C_CANCELFUNCTION,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
-static PRInt32 counter_C_WaitForSlotEvent = 0;
-static PRInt32 calls_C_WaitForSlotEvent = 0;
CK_RV NSSDBGC_WaitForSlotEvent(
CK_FLAGS flags,
CK_SLOT_ID_PTR pSlot,
@@ -2068,16 +2013,15 @@ CK_RV NSSDBGC_WaitForSlotEvent(
{
CK_RV rv;
PRIntervalTime start;
- PR_AtomicIncrement(&calls_C_WaitForSlotEvent);
PR_LOG(modlog, 1, ("C_WaitForSlotEvent"));
PR_LOG(modlog, 3, (" flags = 0x%x", flags));
PR_LOG(modlog, 3, (" pSlot = 0x%p", pSlot));
PR_LOG(modlog, 3, (" pRserved = 0x%p", pRserved));
- start = PR_IntervalNow();
+ nssdbg_start_time(FUNC_C_WAITFORSLOTEVENT,&start);
rv = module_functions->C_WaitForSlotEvent(flags,
pSlot,
pRserved);
- nssdbg_finish_time(&counter_C_WaitForSlotEvent,start);
+ nssdbg_finish_time(FUNC_C_WAITFORSLOTEVENT,start);
PR_LOG(modlog, 1, (" rv = 0x%x\n", rv));
return rv;
}
@@ -2159,15 +2103,63 @@ CK_FUNCTION_LIST_PTR nss_InsertDeviceLog(
return &debug_functions;
}
+/*
+ * scale the time factor up accordingly.
+ * This routine tries to keep at least 2 significant figures on output.
+ * If the time is 0, then indicate that with a 'z' for units.
+ * If the time is greater than 10 minutes, output the time in minutes.
+ * If the time is less than 10 minutes but greater than 10 seconds output
+ * the time in second.
+ * If the time is less than 10 seconds but greater than 10 milliseconds
+ * output * the time in millisecond.
+ * If the time is less than 10 milliseconds but greater than 0 ticks output
+ * the time in microsecond.
+ *
+ */
+static PRUint32 getPrintTime(PRIntervalTime time ,char **type)
+{
+ PRUint32 prTime;
+
+ /* detect a programming error by outputting 'bu' to the output stream
+ * rather than crashing */
+ *type = "bug";
+ if (time == 0) {
+ *type = "z";
+ return 0;
+ }
+
+ prTime = PR_IntervalToSeconds(time);
+
+ if (prTime >= 600) {
+ *type="m";
+ return prTime/60;
+ }
+ if (prTime >= 10) {
+ *type="s";
+ return prTime;
+ }
+ prTime = PR_IntervalToMilliseconds(time);
+ if (prTime >= 10) {
+ *type="ms";
+ return prTime;
+ }
+ *type = "us";
+ return PR_IntervalToMicroseconds(time);
+}
+
static void print_final_statistics(void)
{
int total_calls = 0;
- PRInt32 total_time = 0;
+ PRIntervalTime total_time = 0;
+ PRUint32 pr_total_time;
+ char *type;
char *fname;
FILE *outfile = NULL;
+ int i;
fname = PR_GetEnv("NSS_OUTPUT_FILE");
if (fname) {
+ /* need to add an optional process id to the filename */
outfile = fopen(fname,"w+");
}
if (!outfile) {
@@ -2175,692 +2167,40 @@ static void print_final_statistics(void)
}
- fprintf(outfile,"%-25s %10s %11s %10s %10s\n", "Function", "# Calls", "Time (ms)", "Avg. (ms)", "% Time");
- fprintf(outfile,"\n");
- total_calls += calls_C_CancelFunction;
- total_time += counter_C_CancelFunction;
- total_calls += calls_C_CloseAllSessions;
- total_time += counter_C_CloseAllSessions;
- total_calls += calls_C_CloseSession;
- total_time += counter_C_CloseSession;
- total_calls += calls_C_CopyObject;
- total_time += counter_C_CopyObject;
- total_calls += calls_C_CreateObject;
- total_time += counter_C_CreateObject;
- total_calls += calls_C_Decrypt;
- total_time += counter_C_Decrypt;
- total_calls += calls_C_DecryptDigestUpdate;
- total_time += counter_C_DecryptDigestUpdate;
- total_calls += calls_C_DecryptFinal;
- total_time += counter_C_DecryptFinal;
- total_calls += calls_C_DecryptInit;
- total_time += counter_C_DecryptInit;
- total_calls += calls_C_DecryptUpdate;
- total_time += counter_C_DecryptUpdate;
- total_calls += calls_C_DecryptVerifyUpdate;
- total_time += counter_C_DecryptVerifyUpdate;
- total_calls += calls_C_DeriveKey;
- total_time += counter_C_DeriveKey;
- total_calls += calls_C_DestroyObject;
- total_time += counter_C_DestroyObject;
- total_calls += calls_C_Digest;
- total_time += counter_C_Digest;
- total_calls += calls_C_DigestEncryptUpdate;
- total_time += counter_C_DigestEncryptUpdate;
- total_calls += calls_C_DigestFinal;
- total_time += counter_C_DigestFinal;
- total_calls += calls_C_DigestInit;
- total_time += counter_C_DigestInit;
- total_calls += calls_C_DigestKey;
- total_time += counter_C_DigestKey;
- total_calls += calls_C_DigestUpdate;
- total_time += counter_C_DigestUpdate;
- total_calls += calls_C_Encrypt;
- total_time += counter_C_Encrypt;
- total_calls += calls_C_EncryptFinal;
- total_time += counter_C_EncryptFinal;
- total_calls += calls_C_EncryptInit;
- total_time += counter_C_EncryptInit;
- total_calls += calls_C_EncryptUpdate;
- total_time += counter_C_EncryptUpdate;
- total_calls += calls_C_Finalize;
- total_time += counter_C_Finalize;
- total_calls += calls_C_FindObjects;
- total_time += counter_C_FindObjects;
- total_calls += calls_C_FindObjectsFinal;
- total_time += counter_C_FindObjectsFinal;
- total_calls += calls_C_FindObjectsInit;
- total_time += counter_C_FindObjectsInit;
- total_calls += calls_C_GenerateKey;
- total_time += counter_C_GenerateKey;
- total_calls += calls_C_GenerateKeyPair;
- total_time += counter_C_GenerateKeyPair;
- total_calls += calls_C_GenerateRandom;
- total_time += counter_C_GenerateRandom;
- total_calls += calls_C_GetAttributeValue;
- total_time += counter_C_GetAttributeValue;
- total_calls += calls_C_GetFunctionList;
- total_time += counter_C_GetFunctionList;
- total_calls += calls_C_GetFunctionStatus;
- total_time += counter_C_GetFunctionStatus;
- total_calls += calls_C_GetInfo;
- total_time += counter_C_GetInfo;
- total_calls += calls_C_GetMechanismInfo;
- total_time += counter_C_GetMechanismInfo;
- total_calls += calls_C_GetMechanismList;
- total_time += counter_C_GetMechanismList;
- total_calls += calls_C_GetObjectSize;
- total_time += counter_C_GetObjectSize;
- total_calls += calls_C_GetOperationState;
- total_time += counter_C_GetOperationState;
- total_calls += calls_C_GetSessionInfo;
- total_time += counter_C_GetSessionInfo;
- total_calls += calls_C_GetSlotInfo;
- total_time += counter_C_GetSlotInfo;
- total_calls += calls_C_GetSlotList;
- total_time += counter_C_GetSlotList;
- total_calls += calls_C_GetTokenInfo;
- total_time += counter_C_GetTokenInfo;
- total_calls += calls_C_InitPIN;
- total_time += counter_C_InitPIN;
- total_calls += calls_C_InitToken;
- total_time += counter_C_InitToken;
- total_calls += calls_C_Initialize;
- total_time += counter_C_Initialize;
- total_calls += calls_C_Login;
- total_time += counter_C_Login;
- total_calls += calls_C_Logout;
- total_time += counter_C_Logout;
- total_calls += calls_C_OpenSession;
- total_time += counter_C_OpenSession;
- total_calls += calls_C_SeedRandom;
- total_time += counter_C_SeedRandom;
- total_calls += calls_C_SetAttributeValue;
- total_time += counter_C_SetAttributeValue;
- total_calls += calls_C_SetOperationState;
- total_time += counter_C_SetOperationState;
- total_calls += calls_C_SetPIN;
- total_time += counter_C_SetPIN;
- total_calls += calls_C_Sign;
- total_time += counter_C_Sign;
- total_calls += calls_C_SignEncryptUpdate;
- total_time += counter_C_SignEncryptUpdate;
- total_calls += calls_C_SignFinal;
- total_time += counter_C_SignFinal;
- total_calls += calls_C_SignInit;
- total_time += counter_C_SignInit;
- total_calls += calls_C_SignRecover;
- total_time += counter_C_SignRecover;
- total_calls += calls_C_SignRecoverInit;
- total_time += counter_C_SignRecoverInit;
- total_calls += calls_C_SignUpdate;
- total_time += counter_C_SignUpdate;
- total_calls += calls_C_UnwrapKey;
- total_time += counter_C_UnwrapKey;
- total_calls += calls_C_Verify;
- total_time += counter_C_Verify;
- total_calls += calls_C_VerifyFinal;
- total_time += counter_C_VerifyFinal;
- total_calls += calls_C_VerifyInit;
- total_time += counter_C_VerifyInit;
- total_calls += calls_C_VerifyRecover;
- total_time += counter_C_VerifyRecover;
- total_calls += calls_C_VerifyRecoverInit;
- total_time += counter_C_VerifyRecoverInit;
- total_calls += calls_C_VerifyUpdate;
- total_time += counter_C_VerifyUpdate;
- total_calls += calls_C_WaitForSlotEvent;
- total_time += counter_C_WaitForSlotEvent;
- total_calls += calls_C_WrapKey;
- total_time += counter_C_WrapKey;
- fprintf(outfile,"%-25s %10d %10d ", "C_CancelFunction", calls_C_CancelFunction, counter_C_CancelFunction);
- if (calls_C_CancelFunction > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_CancelFunction / (float)calls_C_CancelFunction);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_CancelFunction / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_CloseAllSessions", calls_C_CloseAllSessions, counter_C_CloseAllSessions);
- if (calls_C_CloseAllSessions > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_CloseAllSessions / (float)calls_C_CloseAllSessions);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_CloseAllSessions / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_CloseSession", calls_C_CloseSession, counter_C_CloseSession);
- if (calls_C_CloseSession > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_CloseSession / (float)calls_C_CloseSession);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_CloseSession / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_CopyObject", calls_C_CopyObject, counter_C_CopyObject);
- if (calls_C_CopyObject > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_CopyObject / (float)calls_C_CopyObject);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_CopyObject / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_CreateObject", calls_C_CreateObject, counter_C_CreateObject);
- if (calls_C_CreateObject > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_CreateObject / (float)calls_C_CreateObject);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_CreateObject / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Decrypt", calls_C_Decrypt, counter_C_Decrypt);
- if (calls_C_Decrypt > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Decrypt / (float)calls_C_Decrypt);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Decrypt / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DecryptDigestUpdate", calls_C_DecryptDigestUpdate, counter_C_DecryptDigestUpdate);
- if (calls_C_DecryptDigestUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptDigestUpdate / (float)calls_C_DecryptDigestUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptDigestUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DecryptFinal", calls_C_DecryptFinal, counter_C_DecryptFinal);
- if (calls_C_DecryptFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptFinal / (float)calls_C_DecryptFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DecryptInit", calls_C_DecryptInit, counter_C_DecryptInit);
- if (calls_C_DecryptInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptInit / (float)calls_C_DecryptInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DecryptUpdate", calls_C_DecryptUpdate, counter_C_DecryptUpdate);
- if (calls_C_DecryptUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptUpdate / (float)calls_C_DecryptUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DecryptVerifyUpdate", calls_C_DecryptVerifyUpdate, counter_C_DecryptVerifyUpdate);
- if (calls_C_DecryptVerifyUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptVerifyUpdate / (float)calls_C_DecryptVerifyUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DecryptVerifyUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DeriveKey", calls_C_DeriveKey, counter_C_DeriveKey);
- if (calls_C_DeriveKey > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DeriveKey / (float)calls_C_DeriveKey);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DeriveKey / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DestroyObject", calls_C_DestroyObject, counter_C_DestroyObject);
- if (calls_C_DestroyObject > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DestroyObject / (float)calls_C_DestroyObject);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DestroyObject / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Digest", calls_C_Digest, counter_C_Digest);
- if (calls_C_Digest > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Digest / (float)calls_C_Digest);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Digest / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DigestEncryptUpdate", calls_C_DigestEncryptUpdate, counter_C_DigestEncryptUpdate);
- if (calls_C_DigestEncryptUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DigestEncryptUpdate / (float)calls_C_DigestEncryptUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DigestEncryptUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DigestFinal", calls_C_DigestFinal, counter_C_DigestFinal);
- if (calls_C_DigestFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DigestFinal / (float)calls_C_DigestFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DigestFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DigestInit", calls_C_DigestInit, counter_C_DigestInit);
- if (calls_C_DigestInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DigestInit / (float)calls_C_DigestInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DigestInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DigestKey", calls_C_DigestKey, counter_C_DigestKey);
- if (calls_C_DigestKey > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DigestKey / (float)calls_C_DigestKey);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DigestKey / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_DigestUpdate", calls_C_DigestUpdate, counter_C_DigestUpdate);
- if (calls_C_DigestUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_DigestUpdate / (float)calls_C_DigestUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_DigestUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Encrypt", calls_C_Encrypt, counter_C_Encrypt);
- if (calls_C_Encrypt > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Encrypt / (float)calls_C_Encrypt);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Encrypt / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_EncryptFinal", calls_C_EncryptFinal, counter_C_EncryptFinal);
- if (calls_C_EncryptFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptFinal / (float)calls_C_EncryptFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_EncryptInit", calls_C_EncryptInit, counter_C_EncryptInit);
- if (calls_C_EncryptInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptInit / (float)calls_C_EncryptInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_EncryptUpdate", calls_C_EncryptUpdate, counter_C_EncryptUpdate);
- if (calls_C_EncryptUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptUpdate / (float)calls_C_EncryptUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_EncryptUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Finalize", calls_C_Finalize, counter_C_Finalize);
- if (calls_C_Finalize > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Finalize / (float)calls_C_Finalize);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Finalize / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_FindObjects", calls_C_FindObjects, counter_C_FindObjects);
- if (calls_C_FindObjects > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjects / (float)calls_C_FindObjects);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjects / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_FindObjectsFinal", calls_C_FindObjectsFinal, counter_C_FindObjectsFinal);
- if (calls_C_FindObjectsFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjectsFinal / (float)calls_C_FindObjectsFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjectsFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_FindObjectsInit", calls_C_FindObjectsInit, counter_C_FindObjectsInit);
- if (calls_C_FindObjectsInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjectsInit / (float)calls_C_FindObjectsInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_FindObjectsInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GenerateKey", calls_C_GenerateKey, counter_C_GenerateKey);
- if (calls_C_GenerateKey > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateKey / (float)calls_C_GenerateKey);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateKey / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GenerateKeyPair", calls_C_GenerateKeyPair, counter_C_GenerateKeyPair);
- if (calls_C_GenerateKeyPair > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateKeyPair / (float)calls_C_GenerateKeyPair);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateKeyPair / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GenerateRandom", calls_C_GenerateRandom, counter_C_GenerateRandom);
- if (calls_C_GenerateRandom > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateRandom / (float)calls_C_GenerateRandom);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GenerateRandom / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetAttributeValue", calls_C_GetAttributeValue, counter_C_GetAttributeValue);
- if (calls_C_GetAttributeValue > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetAttributeValue / (float)calls_C_GetAttributeValue);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetAttributeValue / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetFunctionList", calls_C_GetFunctionList, counter_C_GetFunctionList);
- if (calls_C_GetFunctionList > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetFunctionList / (float)calls_C_GetFunctionList);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetFunctionList / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetFunctionStatus", calls_C_GetFunctionStatus, counter_C_GetFunctionStatus);
- if (calls_C_GetFunctionStatus > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetFunctionStatus / (float)calls_C_GetFunctionStatus);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetFunctionStatus / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetInfo", calls_C_GetInfo, counter_C_GetInfo);
- if (calls_C_GetInfo > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetInfo / (float)calls_C_GetInfo);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetInfo / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetMechanismInfo", calls_C_GetMechanismInfo, counter_C_GetMechanismInfo);
- if (calls_C_GetMechanismInfo > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetMechanismInfo / (float)calls_C_GetMechanismInfo);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetMechanismInfo / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetMechanismList", calls_C_GetMechanismList, counter_C_GetMechanismList);
- if (calls_C_GetMechanismList > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetMechanismList / (float)calls_C_GetMechanismList);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetMechanismList / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetObjectSize", calls_C_GetObjectSize, counter_C_GetObjectSize);
- if (calls_C_GetObjectSize > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetObjectSize / (float)calls_C_GetObjectSize);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetObjectSize / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetOperationState", calls_C_GetOperationState, counter_C_GetOperationState);
- if (calls_C_GetOperationState > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetOperationState / (float)calls_C_GetOperationState);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetOperationState / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetSessionInfo", calls_C_GetSessionInfo, counter_C_GetSessionInfo);
- if (calls_C_GetSessionInfo > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetSessionInfo / (float)calls_C_GetSessionInfo);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetSessionInfo / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetSlotInfo", calls_C_GetSlotInfo, counter_C_GetSlotInfo);
- if (calls_C_GetSlotInfo > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetSlotInfo / (float)calls_C_GetSlotInfo);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetSlotInfo / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetSlotList", calls_C_GetSlotList, counter_C_GetSlotList);
- if (calls_C_GetSlotList > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetSlotList / (float)calls_C_GetSlotList);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetSlotList / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_GetTokenInfo", calls_C_GetTokenInfo, counter_C_GetTokenInfo);
- if (calls_C_GetTokenInfo > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_GetTokenInfo / (float)calls_C_GetTokenInfo);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_GetTokenInfo / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_InitPIN", calls_C_InitPIN, counter_C_InitPIN);
- if (calls_C_InitPIN > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_InitPIN / (float)calls_C_InitPIN);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_InitPIN / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_InitToken", calls_C_InitToken, counter_C_InitToken);
- if (calls_C_InitToken > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_InitToken / (float)calls_C_InitToken);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_InitToken / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Initialize", calls_C_Initialize, counter_C_Initialize);
- if (calls_C_Initialize > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Initialize / (float)calls_C_Initialize);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Initialize / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Login", calls_C_Login, counter_C_Login);
- if (calls_C_Login > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Login / (float)calls_C_Login);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Login / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Logout", calls_C_Logout, counter_C_Logout);
- if (calls_C_Logout > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Logout / (float)calls_C_Logout);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Logout / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_OpenSession", calls_C_OpenSession, counter_C_OpenSession);
- if (calls_C_OpenSession > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_OpenSession / (float)calls_C_OpenSession);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_OpenSession / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SeedRandom", calls_C_SeedRandom, counter_C_SeedRandom);
- if (calls_C_SeedRandom > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SeedRandom / (float)calls_C_SeedRandom);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SeedRandom / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SetAttributeValue", calls_C_SetAttributeValue, counter_C_SetAttributeValue);
- if (calls_C_SetAttributeValue > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SetAttributeValue / (float)calls_C_SetAttributeValue);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SetAttributeValue / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SetOperationState", calls_C_SetOperationState, counter_C_SetOperationState);
- if (calls_C_SetOperationState > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SetOperationState / (float)calls_C_SetOperationState);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SetOperationState / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SetPIN", calls_C_SetPIN, counter_C_SetPIN);
- if (calls_C_SetPIN > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SetPIN / (float)calls_C_SetPIN);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SetPIN / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Sign", calls_C_Sign, counter_C_Sign);
- if (calls_C_Sign > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Sign / (float)calls_C_Sign);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Sign / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignEncryptUpdate", calls_C_SignEncryptUpdate, counter_C_SignEncryptUpdate);
- if (calls_C_SignEncryptUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignEncryptUpdate / (float)calls_C_SignEncryptUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignEncryptUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignFinal", calls_C_SignFinal, counter_C_SignFinal);
- if (calls_C_SignFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignFinal / (float)calls_C_SignFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignInit", calls_C_SignInit, counter_C_SignInit);
- if (calls_C_SignInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignInit / (float)calls_C_SignInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignRecover", calls_C_SignRecover, counter_C_SignRecover);
- if (calls_C_SignRecover > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignRecover / (float)calls_C_SignRecover);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignRecover / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignRecoverInit", calls_C_SignRecoverInit, counter_C_SignRecoverInit);
- if (calls_C_SignRecoverInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignRecoverInit / (float)calls_C_SignRecoverInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignRecoverInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_SignUpdate", calls_C_SignUpdate, counter_C_SignUpdate);
- if (calls_C_SignUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_SignUpdate / (float)calls_C_SignUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_SignUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_UnwrapKey", calls_C_UnwrapKey, counter_C_UnwrapKey);
- if (calls_C_UnwrapKey > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_UnwrapKey / (float)calls_C_UnwrapKey);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_UnwrapKey / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_Verify", calls_C_Verify, counter_C_Verify);
- if (calls_C_Verify > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_Verify / (float)calls_C_Verify);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_Verify / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_VerifyFinal", calls_C_VerifyFinal, counter_C_VerifyFinal);
- if (calls_C_VerifyFinal > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyFinal / (float)calls_C_VerifyFinal);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyFinal / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_VerifyInit", calls_C_VerifyInit, counter_C_VerifyInit);
- if (calls_C_VerifyInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyInit / (float)calls_C_VerifyInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_VerifyRecover", calls_C_VerifyRecover, counter_C_VerifyRecover);
- if (calls_C_VerifyRecover > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyRecover / (float)calls_C_VerifyRecover);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyRecover / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_VerifyRecoverInit", calls_C_VerifyRecoverInit, counter_C_VerifyRecoverInit);
- if (calls_C_VerifyRecoverInit > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyRecoverInit / (float)calls_C_VerifyRecoverInit);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyRecoverInit / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_VerifyUpdate", calls_C_VerifyUpdate, counter_C_VerifyUpdate);
- if (calls_C_VerifyUpdate > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyUpdate / (float)calls_C_VerifyUpdate);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_VerifyUpdate / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_WaitForSlotEvent", calls_C_WaitForSlotEvent, counter_C_WaitForSlotEvent);
- if (calls_C_WaitForSlotEvent > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_WaitForSlotEvent / (float)calls_C_WaitForSlotEvent);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
- }
- fprintf(outfile,"%10.2f", (float)counter_C_WaitForSlotEvent / (float)total_time * 100);
- fprintf(outfile,"\n");
- fprintf(outfile,"%-25s %10d %10d ", "C_WrapKey", calls_C_WrapKey, counter_C_WrapKey);
- if (calls_C_WrapKey > 0) {
- fprintf(outfile,"%10.2f", (float)counter_C_WrapKey / (float)calls_C_WrapKey);
- } else {
- fprintf(outfile,"%10.2f", 0.0);
+ fprintf(outfile,"%-25s %10s %12s %12s %10s\n", "Function", "# Calls",
+ "Time", "Avg.", "% Time");
+ fprintf(outfile,"\n");
+ for (i=0; i < nssdbg_prof_size; i++) {
+ total_calls += nssdbg_prof_data[i].calls;
+ total_time += nssdbg_prof_data[i].time;
+ }
+ for (i=0; i < nssdbg_prof_size; i++) {
+ PRIntervalTime time = nssdbg_prof_data[i].time;
+ PRUint32 usTime = PR_IntervalToMicroseconds(time);
+ PRUint32 prTime = 0;
+ PRUint32 calls = nssdbg_prof_data[i].calls;
+ /* don't print out functions that weren't even called */
+ if (calls == 0) {
+ continue;
+ }
+
+ prTime = getPrintTime(time,&type);
+
+ fprintf(outfile,"%-25s %10d %10d%2s ", nssdbg_prof_data[i].function,
+ calls, prTime, type);
+ /* for now always output the average in microseconds */
+ fprintf(outfile,"%10.2f%2s", (float)usTime / (float)calls, "us" );
+ fprintf(outfile,"%10.2f%%", ((float)time / (float)total_time) * 100);
+ fprintf(outfile,"\n");
}
- fprintf(outfile,"%10.2f", (float)counter_C_WrapKey / (float)total_time * 100);
- fprintf(outfile,"\n");
fprintf(outfile,"\n");
- fprintf(outfile,"%25s %10d %10d\n", "Totals", total_calls, total_time);
- fprintf(outfile,"\n\nMaximum number of concurrent open sessions: %d\n\n", maxOpenSessions);
+ pr_total_time = getPrintTime(total_time,&type);
+
+ fprintf(outfile,"%25s %10d %10d%2s\n", "Totals", total_calls,
+ pr_total_time, type);
+ fprintf(outfile,"\n\nMaximum number of concurrent open sessions: %d\n\n",
+ maxOpenSessions);
fflush (outfile);
if (outfile != stdout) {
fclose(outfile);
diff --git a/security/nss/lib/softoken/alghmac.c b/security/nss/lib/softoken/alghmac.c
index a975f3f5a..fb22fbd9c 100644
--- a/security/nss/lib/softoken/alghmac.c
+++ b/security/nss/lib/softoken/alghmac.c
@@ -62,7 +62,7 @@ HMAC_Create(const SECHashObject *hash_obj, const unsigned char *secret,
{
HMACContext *cx;
unsigned int i;
- unsigned char hashed_secret[SHA1_LENGTH];
+ unsigned char hashed_secret[HASH_LENGTH_MAX];
/* required by FIPS 198 Section 3 */
if (isFIPS && secret_len < hash_obj->length/2) {
diff --git a/security/nss/lib/softoken/dbmshim.c b/security/nss/lib/softoken/dbmshim.c
index 9cc33a575..935780dbf 100644
--- a/security/nss/lib/softoken/dbmshim.c
+++ b/security/nss/lib/softoken/dbmshim.c
@@ -53,16 +53,31 @@
#include "pkcs11i.h"
+/*
+ * Blob block:
+ * Byte 0 CERTDB Version -+ -+
+ * Byte 1 certDBEntryTypeBlob | BLOB_HEAD_LEN |
+ * Byte 2 flags (always '0'); | |
+ * Byte 3 reserved (always '0'); -+ |
+ * Byte 4 LSB length | <--BLOB_LENGTH_START | BLOB_BUF_LEN
+ * Byte 5 . | |
+ * Byte 6 . | BLOB_LENGTH_LEN |
+ * Byte 7 MSB length | |
+ * Byte 8 blob_filename -+ -+ <-- BLOB_NAME_START |
+ * Byte 9 . | BLOB_NAME_LEN |
+ * . . | |
+ * Byte 37 . -+ -+
+ */
#define DBS_BLOCK_SIZE (16*1024) /* 16 k */
#define DBS_MAX_ENTRY_SIZE (DBS_BLOCK_SIZE - (2048)) /* 14 k */
#define DBS_CACHE_SIZE DBS_BLOCK_SIZE*8
#define ROUNDDIV(x,y) (x+(y-1))/y
#define BLOB_HEAD_LEN 4
-#define BLOB_NAMELENGTH_START BLOB_HEAD_LEN
-#define BLOB_NAMELENGTH_LEN 4
-#define BLOB_NAME_START BLOB_NAMELENGTH_START+BLOB_NAMELENGTH_LEN
-#define BLOB_NAME_LEN 1+ROUNDDIV(SHA1_LENGTH*4,3)+2
-#define BLOB_BUF_LEN BLOB_HEAD_LEN+BLOB_NAMELENGTH_LEN+BLOB_NAME_LEN
+#define BLOB_LENGTH_START BLOB_HEAD_LEN
+#define BLOB_LENGTH_LEN 4
+#define BLOB_NAME_START BLOB_LENGTH_START+BLOB_LENGTH_LEN
+#define BLOB_NAME_LEN 1+ROUNDDIV(SHA1_LENGTH,3)*4+1
+#define BLOB_BUF_LEN BLOB_HEAD_LEN+BLOB_LENGTH_LEN+BLOB_NAME_LEN
/* a Shim data structure. This data structure has a db built into it. */
typedef struct DBSStr DBS;
@@ -113,10 +128,10 @@ dbs_getBlobSize(DBT *blobData)
{
unsigned char *addr = (unsigned char *)blobData->data;
- return (PRUint32)(addr[BLOB_NAMELENGTH_START+3] << 24) |
- (addr[BLOB_NAMELENGTH_START+2] << 16) |
- (addr[BLOB_NAMELENGTH_START+1] << 8) |
- addr[BLOB_NAMELENGTH_START];
+ return (PRUint32)(addr[BLOB_LENGTH_START+3] << 24) |
+ (addr[BLOB_LENGTH_START+2] << 16) |
+ (addr[BLOB_LENGTH_START+1] << 8) |
+ addr[BLOB_LENGTH_START];
}
@@ -151,16 +166,16 @@ dbs_mkBlob(DBS *dbsp,const DBT *key, const DBT *data, DBT *blobData)
b[1] = (char) certDBEntryTypeBlob; /* type */
b[2] = 0; /* flags */
b[3] = 0; /* reserved */
- b[BLOB_NAMELENGTH_START] = length & 0xff;
- b[BLOB_NAMELENGTH_START+1] = (length >> 8) & 0xff;
- b[BLOB_NAMELENGTH_START+2] = (length >> 16) & 0xff;
- b[BLOB_NAMELENGTH_START+3] = (length >> 24) & 0xff;
+ b[BLOB_LENGTH_START] = length & 0xff;
+ b[BLOB_LENGTH_START+1] = (length >> 8) & 0xff;
+ b[BLOB_LENGTH_START+2] = (length >> 16) & 0xff;
+ b[BLOB_LENGTH_START+3] = (length >> 24) & 0xff;
sha1Item.data = sha1_data;
sha1Item.len = SHA1_LENGTH;
SHA1_HashBuf(sha1_data,key->data,key->size);
b[BLOB_NAME_START]='b'; /* Make sure we start with a alpha */
- PORT_Memset(&b[BLOB_NAME_START+1],0, BLOB_NAME_LEN-1);
NSSBase64_EncodeItem(NULL,&b[BLOB_NAME_START+1],BLOB_NAME_LEN-1,&sha1Item);
+ b[BLOB_BUF_LEN-1] = 0;
dbs_replaceSlash(&b[BLOB_NAME_START+1],BLOB_NAME_LEN-1);
blobData->data = b;
blobData->size = BLOB_BUF_LEN;
diff --git a/security/nss/lib/softoken/pkcs11i.h b/security/nss/lib/softoken/pkcs11i.h
index ef783b918..ae92816b3 100644
--- a/security/nss/lib/softoken/pkcs11i.h
+++ b/security/nss/lib/softoken/pkcs11i.h
@@ -297,8 +297,8 @@ typedef enum {
#define PK11_MAX_BLOCK_SIZE 16
-/* currently SHA1 is the biggest hash length */
-#define PK11_MAX_MAC_LENGTH 20
+/* currently SHA512 is the biggest hash length */
+#define PK11_MAX_MAC_LENGTH 64
#define PK11_INVALID_MAC_SIZE 0xffffffff
struct PK11SessionContextStr {
diff --git a/security/nss/lib/softoken/pkcs11n.h b/security/nss/lib/softoken/pkcs11n.h
index c2b57acab..5c6624bb5 100644
--- a/security/nss/lib/softoken/pkcs11n.h
+++ b/security/nss/lib/softoken/pkcs11n.h
@@ -165,6 +165,16 @@ static const char CKT_CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$ $Name$";
#define CKM_TLS_PRF_GENERAL 0x80000373L
+/* These new SHAxxx mechanisms will be defined as vendor-defined until
+** they are given standard mechanism numbers.
+*/
+#define CKM_SHA256 0x80000401L
+#define CKM_SHA384 0x80000402L
+#define CKM_SHA512 0x80000403L
+
+#define CKM_SHA256_RSA_PKCS 0x80000411L
+#define CKM_SHA384_RSA_PKCS 0x80000412L
+#define CKM_SHA512_RSA_PKCS 0x80000413L
/*
* Netscape-defined return values
diff --git a/security/nss/lib/softoken/rawhash.c b/security/nss/lib/softoken/rawhash.c
index 9250bf62b..b32d3f31a 100644
--- a/security/nss/lib/softoken/rawhash.c
+++ b/security/nss/lib/softoken/rawhash.c
@@ -107,5 +107,29 @@ const SECHashObject SECRawHashObjects[] = {
(void (*)(void *, const unsigned char *, unsigned int)) SHA1_Update,
(void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA1_End
},
+ { SHA256_LENGTH,
+ (void * (*)(void)) SHA256_NewContext,
+ (void * (*)(void *)) null_hash_clone_context,
+ (void (*)(void *, PRBool)) SHA256_DestroyContext,
+ (void (*)(void *)) SHA256_Begin,
+ (void (*)(void *, const unsigned char *, unsigned int)) SHA256_Update,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA256_End
+ },
+ { SHA384_LENGTH,
+ (void * (*)(void)) SHA384_NewContext,
+ (void * (*)(void *)) null_hash_clone_context,
+ (void (*)(void *, PRBool)) SHA384_DestroyContext,
+ (void (*)(void *)) SHA384_Begin,
+ (void (*)(void *, const unsigned char *, unsigned int)) SHA384_Update,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA384_End
+ },
+ { SHA512_LENGTH,
+ (void * (*)(void)) SHA512_NewContext,
+ (void * (*)(void *)) null_hash_clone_context,
+ (void (*)(void *, PRBool)) SHA512_DestroyContext,
+ (void (*)(void *)) SHA512_Begin,
+ (void (*)(void *, const unsigned char *, unsigned int)) SHA512_Update,
+ (void (*)(void *, unsigned char *, unsigned int *, unsigned int)) SHA512_End
+ },
};
diff --git a/security/nss/lib/util/secoid.c b/security/nss/lib/util/secoid.c
index 179105488..2ee8b08e6 100644
--- a/security/nss/lib/util/secoid.c
+++ b/security/nss/lib/util/secoid.c
@@ -50,6 +50,7 @@
#define NISTALGS USGOV, 3, 4
#define AES NISTALGS, 1
+#define SHAXXX NISTALGS, 2
/**
** The Netscape OID space is allocated by Terry Hayes. If you need
@@ -179,6 +180,9 @@ CONST_OID pkcs1MD2WithRSAEncryption[] = { PKCS1, 0x02 };
CONST_OID pkcs1MD4WithRSAEncryption[] = { PKCS1, 0x03 };
CONST_OID pkcs1MD5WithRSAEncryption[] = { PKCS1, 0x04 };
CONST_OID pkcs1SHA1WithRSAEncryption[] = { PKCS1, 0x05 };
+CONST_OID pkcs1SHA256WithRSAEncryption[] = { PKCS1, 11 };
+CONST_OID pkcs1SHA384WithRSAEncryption[] = { PKCS1, 12 };
+CONST_OID pkcs1SHA512WithRSAEncryption[] = { PKCS1, 13 };
CONST_OID pkcs5PbeWithMD2AndDEScbc[] = { PKCS5, 0x01 };
CONST_OID pkcs5PbeWithMD5AndDEScbc[] = { PKCS5, 0x03 };
@@ -414,6 +418,10 @@ CONST_OID aes256_OFB[] = { AES, 43 };
CONST_OID aes256_CFB[] = { AES, 44 };
#endif
+CONST_OID sha256[] = { SHAXXX, 1 };
+CONST_OID sha384[] = { SHAXXX, 2 };
+CONST_OID sha512[] = { SHAXXX, 3 };
+
#define OI(x) { siDEROID, (unsigned char *)x, sizeof x }
#ifndef SECOID_NO_STRINGS
#define OD(oid,tag,desc,mech,ext) { OI(oid), tag, desc, mech, ext }
@@ -1009,9 +1017,25 @@ const static SECOidData oids[] = {
OD( sdn702DSASignature, SEC_OID_SDN702_DSA_SIGNATURE,
"SDN.702 DSA Signature", CKM_DSA_SHA1, INVALID_CERT_EXTENSION ),
- OD( ms_smimeEncryptionKeyPreference, SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE,
+ OD( ms_smimeEncryptionKeyPreference,
+ SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE,
"Microsoft S/MIME Encryption Key Preference",
CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ),
+
+ OD( sha256, SEC_OID_SHA256, "SHA-256", CKM_SHA256, INVALID_CERT_EXTENSION),
+ OD( sha384, SEC_OID_SHA384, "SHA-384", CKM_SHA384, INVALID_CERT_EXTENSION),
+ OD( sha512, SEC_OID_SHA512, "SHA-512", CKM_SHA512, INVALID_CERT_EXTENSION),
+
+ OD( pkcs1SHA256WithRSAEncryption, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION,
+ "PKCS #1 SHA-256 With RSA Encryption", CKM_SHA256_RSA_PKCS,
+ INVALID_CERT_EXTENSION ),
+ OD( pkcs1SHA384WithRSAEncryption, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION,
+ "PKCS #1 SHA-384 With RSA Encryption", CKM_SHA384_RSA_PKCS,
+ INVALID_CERT_EXTENSION ),
+ OD( pkcs1SHA512WithRSAEncryption, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION,
+ "PKCS #1 SHA-512 With RSA Encryption", CKM_SHA512_RSA_PKCS,
+ INVALID_CERT_EXTENSION ),
+
};
/*
diff --git a/security/nss/lib/util/secoidt.h b/security/nss/lib/util/secoidt.h
index 5c89cf7a9..113959342 100644
--- a/security/nss/lib/util/secoidt.h
+++ b/security/nss/lib/util/secoidt.h
@@ -296,6 +296,14 @@ typedef enum {
SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE = 190,
+ SEC_OID_SHA256 = 191,
+ SEC_OID_SHA384 = 192,
+ SEC_OID_SHA512 = 193,
+
+ SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION = 194,
+ SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION = 195,
+ SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION = 196,
+
SEC_OID_TOTAL
} SECOidTag;
diff --git a/security/nss/pkg/solaris/Makefile b/security/nss/pkg/solaris/Makefile
new file mode 100644
index 000000000..2d2ff6ff4
--- /dev/null
+++ b/security/nss/pkg/solaris/Makefile
@@ -0,0 +1,56 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+
+CORE_DEPTH = ../../..
+
+%: %.ksh
+ $(RM) $@
+ cp $< $@
+ chmod +x $@
+
+
+ifeq ($(USE_64), 1)
+DIRS = \
+ SUNWtlsx
+else
+DIRS = \
+ SUNWtls
+endif
+
+PROTO = \
+ $(ROOT) \
+ $(ROOT)/usr \
+ $(ROOT)/usr/lib \
+ $(ROOT)/usr/lib/mps
+
+ifdef USE_64
+PROTO += $(ROOT)/usr/lib/mps/sparcv9
+endif
+
+include Makefile.com
+
+awk_pkginfo: bld_awk_pkginfo
+ ./bld_awk_pkginfo -m $(MACH) -p "$(PRODUCT_VERSION)" -o $@ -v $(PRODUCT_VERSION)
+
+all:: awk_pkginfo $(PROTO)
+publish: awk_pkginfo $(PROTO)
+ +$(LOOP_OVER_DIRS)
+
+clean clobber::
+ $(RM) awk_pkginfo bld_awk_pkginfo
+ $(RM) -r $(ROOT)
+
+$(ROOT) $(ROOT)/%:
+ mkdir -p $@
+
+ifdef USE_64
+$(ROOT)/usr/lib/mps/sparcv9: $(ROOT)/usr/lib
+ $(LN) -sf ../../../../$(DIST)/lib $@
+else
+$(ROOT)/usr/lib/mps: $(ROOT)/usr/lib
+ $(LN) -sf ../../../$(DIST)/lib $@
+endif
diff --git a/security/nss/pkg/solaris/Makefile.com b/security/nss/pkg/solaris/Makefile.com
new file mode 100644
index 000000000..dfeb79911
--- /dev/null
+++ b/security/nss/pkg/solaris/Makefile.com
@@ -0,0 +1,33 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+
+MACH = $(shell mach)
+
+PUBLISH_ROOT = $(DIST)
+ifeq ($(CORE_DEPTH),../../..)
+ROOT = ROOT
+else
+ROOT = $(subst ../../../,,$(CORE_DEPTH))/ROOT
+endif
+
+PKGARCHIVE = $(PUBLISH_ROOT)/pkgarchive
+DATAFILES = copyright
+FILES = $(DATAFILES) pkginfo
+
+PACKAGE = $(shell basename `pwd`)
+
+PRODUCT_VERSION = 3.3.2
+PRODUCT_NAME = NSS_3_3_2_RTM
+
+LN = /usr/bin/ln
+
+CLOBBERFILES = $(FILES)
+
+include $(CORE_DEPTH)/coreconf/config.mk
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+# vim: ft=make
diff --git a/security/nss/pkg/solaris/Makefile.targ b/security/nss/pkg/solaris/Makefile.targ
new file mode 100644
index 000000000..279a7bca6
--- /dev/null
+++ b/security/nss/pkg/solaris/Makefile.targ
@@ -0,0 +1,26 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+
+pkginfo: pkginfo.tmpl ../awk_pkginfo
+ $(RM) $@; nawk -f ../awk_pkginfo $@.tmpl > $@
+
+pkg: $(PKGARCHIVE)
+ pkgmk -f prototype_$(MACH) -d $(PKGARCHIVE) -r $(ROOT) -o $(PACKAGE)
+
+$(PKGARCHIVE):
+ [ -d $(PKGARCHIVE) ] || mkdir -p $(PKGARCHIVE)
+
+$(DATAFILES):: %: ../common_files/%
+ $(RM) $@; cp ../common_files/$@ $@
+
+$(MACHDATAFILES): %: ../common_files/%_$(MACH)
+ $(RM) $@; cp ../common_files/$@_$(MACH) $@
+
+clobber clean::
+ -$(RM) $(CLOBBERFILES) $(CLEANFILES)
+
+.PHONY: pkg
diff --git a/security/nss/pkg/solaris/SUNWtls/Makefile b/security/nss/pkg/solaris/SUNWtls/Makefile
new file mode 100644
index 000000000..5058a1f68
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/Makefile
@@ -0,0 +1,16 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+
+CORE_DEPTH = ../../../..
+include ../Makefile.com
+
+DATAFILES +=
+
+all:: $(FILES)
+publish:: all pkg
+
+include ../Makefile.targ
diff --git a/security/nss/pkg/solaris/SUNWtls/pkgdepend b/security/nss/pkg/solaris/SUNWtls/pkgdepend
new file mode 100644
index 000000000..966ba0556
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/pkgdepend
@@ -0,0 +1,28 @@
+# Copyright 2002 Microsystems, Inc. All Rights Reserved.
+# Use is subject to license terms.
+#
+# $Id$
+#
+# This package information file defines software dependencies associated
+# with the pkg. You can define three types of pkg dependencies with this file:
+# P indicates a prerequisite for installation
+# I indicates an incompatible package
+# R indicates a reverse dependency
+# <pkg.abbr> see pkginfo(4), PKG parameter
+# <name> see pkginfo(4), NAME parameter
+# <version> see pkginfo(4), VERSION parameter
+# <arch> see pkginfo(4), ARCH parameter
+# <type> <pkg.abbr> <name>
+# (<arch>)<version>
+# (<arch>)<version>
+# ...
+# <type> <pkg.abbr> <name>
+# ...
+
+P SUNWcar Core Architecture, (Root)
+P SUNWkvm Core Architecture, (Kvm)
+P SUNWcsr Core Solaris, (Root)
+P SUNWcsu Core Solaris, (Usr)
+P SUNWcsd Core Solaris Devices
+P SUNWcsl Core Solaris Libraries
+P SUNWpr Netscape Portable Runtime
diff --git a/security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl b/security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl
new file mode 100644
index 000000000..e0a697529
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/pkginfo.tmpl
@@ -0,0 +1,34 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+#
+# This required package information file describes characteristics of the
+# package, such as package abbreviation, full package name, package version,
+# and package architecture.
+#
+PKG="SUNWtls"
+NAME="Network Security Services"
+ARCH="ISA"
+VERSION="NSSVERS,REV=0.0.0"
+SUNW_PRODNAME="Network Security Services"
+SUNW_PRODVERS="RELEASE/VERSION"
+SUNW_PKGTYPE="usr"
+MAXINST="1000"
+CATEGORY="system"
+DESC="Network Security Services"
+VENDOR="Sun Microsystems, Inc."
+HOTLINE="Please contact your local service provider"
+EMAIL=""
+CLASSES="none"
+BASEDIR=/
+SUNW_PKGVERS="1.0"
+#VSTOCK="<reserved by Release Engineering for package part #>"
+#ISTATES="<developer defined>"
+#RSTATES='<developer defined>'
+#ULIMIT="<developer defined>"
+#ORDER="<developer defined>"
+#PSTAMP="<developer defined>"
+#INTONLY="<developer defined>"
diff --git a/security/nss/pkg/solaris/SUNWtls/prototype_com b/security/nss/pkg/solaris/SUNWtls/prototype_com
new file mode 100644
index 000000000..c5a9d9b39
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/prototype_com
@@ -0,0 +1,32 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+# This required package information file contains a list of package contents.
+# The 'pkgmk' command uses this file to identify the contents of a package
+# and their location on the development machine when building the package.
+# Can be created via a text editor or through use of the 'pkgproto' command.
+
+#!search <pathname pathname ...> # where to find pkg objects
+#!include <filename> # include another 'prototype' file
+#!default <mode> <owner> <group> # default used if not specified on entry
+#!<param>=<value> # puts parameter in pkg environment
+
+# packaging files
+i copyright
+i pkginfo
+i depend=pkgdepend
+#
+# source locations relative to the prototype file
+#
+# SUNWtls
+#
+d none usr 755 root sys
+d none usr/lib 755 root bin
+d none usr/lib/mps 755 root bin
+f none usr/lib/mps/libnss3.so 755 root bin
+f none usr/lib/mps/libsmime3.so 755 root bin
+f none usr/lib/mps/libssl3.so 755 root bin
+f none usr/lib/mps/libnssckbi.so 755 root bin
diff --git a/security/nss/pkg/solaris/SUNWtls/prototype_i386 b/security/nss/pkg/solaris/SUNWtls/prototype_i386
new file mode 100644
index 000000000..d2718ee05
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/prototype_i386
@@ -0,0 +1,30 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+# This required package information file contains a list of package contents.
+# The 'pkgmk' command uses this file to identify the contents of a package
+# and their location on the development machine when building the package.
+# Can be created via a text editor or through use of the 'pkgproto' command.
+
+#!search <pathname pathname ...> # where to find pkg objects
+#!include <filename> # include another 'prototype' file
+#!default <mode> <owner> <group> # default used if not specified on entry
+#!<param>=<value> # puts parameter in pkg environment
+
+#
+# Include ISA independent files (prototype_com)
+#
+!include prototype_com
+#
+#
+#
+# List files which are i386 specific here
+#
+# source locations relative to the prototype file
+#
+#
+# SUNWtls
+#
diff --git a/security/nss/pkg/solaris/SUNWtls/prototype_sparc b/security/nss/pkg/solaris/SUNWtls/prototype_sparc
new file mode 100644
index 000000000..1845a0137
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtls/prototype_sparc
@@ -0,0 +1,33 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+# This required package information file contains a list of package contents.
+# The 'pkgmk' command uses this file to identify the contents of a package
+# and their location on the development machine when building the package.
+# Can be created via a text editor or through use of the 'pkgproto' command.
+
+#!search <pathname pathname ...> # where to find pkg objects
+#!include <filename> # include another 'prototype' file
+#!default <mode> <owner> <group> # default used if not specified on entry
+#!<param>=<value> # puts parameter in pkg environment
+
+#
+# Include ISA independent files (prototype_com)
+#
+!include prototype_com
+#
+#
+#
+# List files which are SPARC specific here
+#
+# source locations relative to the prototype file
+#
+#
+# SUNWtls
+#
+f none usr/lib/mps/libfreebl_hybrid_3.so 755 root bin
+f none usr/lib/mps/libfreebl_pure32_3.so 755 root bin
+
diff --git a/security/nss/pkg/solaris/SUNWtlsx/Makefile b/security/nss/pkg/solaris/SUNWtlsx/Makefile
new file mode 100644
index 000000000..5058a1f68
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtlsx/Makefile
@@ -0,0 +1,16 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+
+CORE_DEPTH = ../../../..
+include ../Makefile.com
+
+DATAFILES +=
+
+all:: $(FILES)
+publish:: all pkg
+
+include ../Makefile.targ
diff --git a/security/nss/pkg/solaris/SUNWtlsx/pkgdepend b/security/nss/pkg/solaris/SUNWtlsx/pkgdepend
new file mode 100644
index 000000000..b5c7d7fa8
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtlsx/pkgdepend
@@ -0,0 +1,31 @@
+# Copyright 2002 Microsystems, Inc. All Rights Reserved.
+# Use is subject to license terms.
+#
+# $Id$
+#
+# This package information file defines software dependencies associated
+# with the pkg. You can define three types of pkg dependencies with this file:
+# P indicates a prerequisite for installation
+# I indicates an incompatible package
+# R indicates a reverse dependency
+# <pkg.abbr> see pkginfo(4), PKG parameter
+# <name> see pkginfo(4), NAME parameter
+# <version> see pkginfo(4), VERSION parameter
+# <arch> see pkginfo(4), ARCH parameter
+# <type> <pkg.abbr> <name>
+# (<arch>)<version>
+# (<arch>)<version>
+# ...
+# <type> <pkg.abbr> <name>
+# ...
+
+P SUNWcar Core Architecture, (Root)
+P SUNWkvm Core Architecture, (Kvm)
+P SUNWcsr Core Solaris, (Root)
+P SUNWcsu Core Solaris, (Usr)
+P SUNWcsd Core Solaris Devices
+P SUNWcsl Core Solaris Libraries
+P SUNWcarx Core Architecture, (Root) (64-bit)
+P SUNWcsxu Core Solaris (Usr) (64-bit)
+P SUNWcslx Core Solaris Libraries (64-bit)
+P SUNWprx Netscape Portable Runtime
diff --git a/security/nss/pkg/solaris/SUNWtlsx/pkginfo.tmpl b/security/nss/pkg/solaris/SUNWtlsx/pkginfo.tmpl
new file mode 100644
index 000000000..6129c2452
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtlsx/pkginfo.tmpl
@@ -0,0 +1,35 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+#
+# This required package information file describes characteristics of the
+# package, such as package abbreviation, full package name, package version,
+# and package architecture.
+#
+PKG="SUNWtlsx"
+NAME="Network Security Services (64-bit)"
+ARCH="ISA"
+SUNW_ISA="sparcv9"
+VERSION="NSSVERS,REV=0.0.0"
+SUNW_PRODNAME="Network Security Services"
+SUNW_PRODVERS="RELEASE/VERSION"
+SUNW_PKGTYPE="usr"
+MAXINST="1000"
+CATEGORY="system"
+DESC="Network Security Services (64-bit)"
+VENDOR="Sun Microsystems, Inc."
+HOTLINE="Please contact your local service provider"
+EMAIL=""
+CLASSES="none"
+BASEDIR=/
+SUNW_PKGVERS="1.0"
+#VSTOCK="<reserved by Release Engineering for package part #>"
+#ISTATES="<developer defined>"
+#RSTATES='<developer defined>'
+#ULIMIT="<developer defined>"
+#ORDER="<developer defined>"
+#PSTAMP="<developer defined>"
+#INTONLY="<developer defined>"
diff --git a/security/nss/pkg/solaris/SUNWtlsx/prototype_com b/security/nss/pkg/solaris/SUNWtlsx/prototype_com
new file mode 100644
index 000000000..0dffc99e1
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtlsx/prototype_com
@@ -0,0 +1,28 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+# This required package information file contains a list of package contents.
+# The 'pkgmk' command uses this file to identify the contents of a package
+# and their location on the development machine when building the package.
+# Can be created via a text editor or through use of the 'pkgproto' command.
+
+#!search <pathname pathname ...> # where to find pkg objects
+#!include <filename> # include another 'prototype' file
+#!default <mode> <owner> <group> # default used if not specified on entry
+#!<param>=<value> # puts parameter in pkg environment
+
+# packaging files
+i copyright
+i pkginfo
+i depend=pkgdepend
+#
+# source locations relative to the prototype file
+#
+# SUNWtlsx
+#
+d none usr 755 root sys
+d none usr/lib 755 root bin
+d none usr/lib/mps 755 root bin
diff --git a/security/nss/pkg/solaris/SUNWtlsx/prototype_sparc b/security/nss/pkg/solaris/SUNWtlsx/prototype_sparc
new file mode 100644
index 000000000..ba9bf925c
--- /dev/null
+++ b/security/nss/pkg/solaris/SUNWtlsx/prototype_sparc
@@ -0,0 +1,37 @@
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "$Id$"
+#
+# This required package information file contains a list of package contents.
+# The 'pkgmk' command uses this file to identify the contents of a package
+# and their location on the development machine when building the package.
+# Can be created via a text editor or through use of the 'pkgproto' command.
+
+#!search <pathname pathname ...> # where to find pkg objects
+#!include <filename> # include another 'prototype' file
+#!default <mode> <owner> <group> # default used if not specified on entry
+#!<param>=<value> # puts parameter in pkg environment
+
+#
+# Include ISA independent files (prototype_com)
+#
+!include prototype_com
+#
+#
+#
+# List files which are SPARC specific here
+#
+# source locations relative to the prototype file
+#
+#
+# SUNWtlsx
+#
+s none usr/lib/mps/64=sparcv9
+d none usr/lib/mps/sparcv9 755 root bin
+f none usr/lib/mps/sparcv9/libnss3.so 755 root bin
+f none usr/lib/mps/sparcv9/libsmime3.so 755 root bin
+f none usr/lib/mps/sparcv9/libssl3.so 755 root bin
+f none usr/lib/mps/sparcv9/libnssckbi.so 755 root bin
+
diff --git a/security/nss/pkg/solaris/bld_awk_pkginfo.ksh b/security/nss/pkg/solaris/bld_awk_pkginfo.ksh
new file mode 100644
index 000000000..6f2723b4c
--- /dev/null
+++ b/security/nss/pkg/solaris/bld_awk_pkginfo.ksh
@@ -0,0 +1,105 @@
+#!/usr/bin/ksh -p
+#
+#ident "$Id$"
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Simple script which builds the awk_pkginfo awk script. This awk script
+# is used to convert the pkginfo.tmpl files into pkginfo files
+# for the build.
+#
+
+usage()
+{
+ cat <<-EOF
+usage: bld_awk_pkginfo -p <prodver> -m <mach> -o <awk_script> [-v <version>]
+EOF
+}
+
+#
+# Awk strings
+#
+# two VERSION patterns: one for Dewey decimal, one for Dewey plus ,REV=n
+# the first has one '=' the second has two or more '='
+#
+VERSION1="VERSION=[^=]*$"
+VERSION2="VERSION=[^=]*=.*$"
+PRODVERS="^SUNW_PRODVERS="
+ARCH='ARCH=\"ISA\"'
+
+#
+# parse command line
+#
+mach=""
+prodver=""
+awk_script=""
+version="NSSVERS"
+
+while getopts o:p:m:v: c
+do
+ case $c in
+ o)
+ awk_script=$OPTARG
+ ;;
+ m)
+ mach=$OPTARG
+ ;;
+ p)
+ prodver=$OPTARG
+ ;;
+ v)
+ version=$OPTARG
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [[ ( -z $prodver ) || ( -z $mach ) || ( -z $awk_script ) ]]
+then
+ usage
+ exit 1
+fi
+
+if [[ -f $awk_script ]]
+then
+ rm -f $awk_script
+fi
+
+#
+# Build REV= field based on date
+#
+rev=$(date "+%Y.%m.%d.%H.%M")
+
+#
+# Build awk script which will process all the
+# pkginfo.tmpl files.
+#
+# the first VERSION pattern is replaced with a leading quotation mark
+#
+rm -f $awk_script
+cat << EOF > $awk_script
+/$VERSION1/ {
+ sub(/\=[^=]*$/,"=\"$rev\"")
+ print
+ next
+ }
+/$VERSION2/ {
+ sub(/\=[^=]*$/,"=$rev\"")
+ sub(/NSSVERS/,"$version")
+ print
+ next
+ }
+/$PRODVERS/ {
+ printf "SUNW_PRODVERS=\"%s\"\n", "$prodver"
+ next
+ }
+/$ARCH/ {
+ printf "ARCH=\"%s\"\n", "$mach"
+ next
+ }
+{ print }
+EOF
diff --git a/security/nss/pkg/solaris/common_files/copyright b/security/nss/pkg/solaris/common_files/copyright
new file mode 100644
index 000000000..4ef1ca7c2
--- /dev/null
+++ b/security/nss/pkg/solaris/common_files/copyright
@@ -0,0 +1,28 @@
+The contents of this package are subject to the Mozilla Public License
+Version 1.1 (the "License"); you may not use this package except in
+compliance with the License. You may obtain a copy of the License at
+http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+License for the specific language governing rights and limitations
+under the License.
+
+The Original Code is the Netscape security libraries.
+
+The Initial Developer of the Original Code is Netscape Communications
+Corporation. Portions created by Netscape are Copyright (C) 1994-2000
+Netscape Communications Corporation. All Rights Reserved.
+
+Contributor(s):
+
+Alternatively, the contents of this package may be used under the terms
+of the GNU General Public License Version 2 or later (the "GPL"), in
+which case the provisions of the GPL are applicable instead of those
+above. If you wish to allow use of your version of this package only
+under the terms of the GPL and not to allow others to use your version
+of this package under the MPL, indicate your decision by deleting the
+provisions above and replace them with the notice and other provisions
+required by the GPL. If you do not delete the provisions above, a
+recipient may use your version of this package under either the MPL or
+the GPL.
diff --git a/security/nss/tests/cipher/cipher.txt b/security/nss/tests/cipher/cipher.txt
index 17707c7b9..29915cfc9 100644
--- a/security/nss/tests/cipher/cipher.txt
+++ b/security/nss/tests/cipher/cipher.txt
@@ -30,3 +30,6 @@
0 md2_-H MD2_Hash
0 md5_-H MD5_Hash
0 sha1_-H SHA1_Hash
+ 0 sha256_-H SHA256_Hash
+ 0 sha384_-H SHA384_Hash
+ 0 sha512_-H SHA512_Hash
diff --git a/security/nss/tests/cmdtests/cmdtests.sh b/security/nss/tests/cmdtests/cmdtests.sh
new file mode 100644
index 000000000..7342e2a1c
--- /dev/null
+++ b/security/nss/tests/cmdtests/cmdtests.sh
@@ -0,0 +1,132 @@
+#! /bin/sh
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Netscape security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1994-2000 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the
+# terms of the GNU General Public License Version 2 or later (the
+# "GPL"), in which case the provisions of the GPL are applicable
+# instead of those above. If you wish to allow use of your
+# version of this file only under the terms of the GPL and not to
+# allow others to use your version of this file under the MPL,
+# indicate your decision by deleting the provisions above and
+# replace them with the notice and other provisions required by
+# the GPL. If you do not delete the provisions above, a recipient
+# may use your version of this file under either the MPL or the
+# GPL.
+#
+#
+########################################################################
+#
+# mozilla/security/nss/cmd/tests/cmdtests.sh
+#
+# Script to run small tests to test specific crashes of NSS
+#
+# needs to work on all Unix and Windows platforms
+#
+# included from
+# --------------
+# all.sh
+#
+# tests implemented:
+# vercrt (verify encryption cert - bugzilla bug 119059)
+# vercrtfps (verify encryption cert in fips mode - bugzilla bug 119214)
+# test3 (CERT_FindUserCertByUsage called 2nd time - bug 118864)
+#
+# special strings
+# ---------------
+#
+########################################################################
+
+############################## cmdtests_init ###########################
+# local shell function to initialize this script
+########################################################################
+cmdtests_init()
+{
+ SCRIPTNAME=cmdtests.sh # sourced - $0 would point to all.sh
+
+ if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for
+ CLEANUP="${SCRIPTNAME}" # cleaning this script will do it
+ fi
+
+ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
+ cd ../common
+ . ./init.sh
+ fi
+ if [ ! -r $CERT_LOG_FILE ]; then # we need certificates here
+ cd ../cert
+ . ./cert.sh
+ fi
+ SCRIPTNAME=cmdtests.sh
+ html_head "Tests in cmd/tests"
+
+# grep "SUCCESS: cmd/tests passed" $CERT_LOG_FILE >/dev/null || {
+# Exit 15 "Fatal - cert.sh needs to pass first"
+# }
+
+ CMDTESTSDIR=${HOSTDIR}/cmd/tests
+ COPYDIR=${CMDTESTSDIR}/copydir
+
+ R_CMDTESTSDIR=../cmd/tests
+ R_COPYDIR=../cmd/tests/copydir
+ P_R_COPYDIR=${R_COPYDIR}
+
+ if [ -n "${MULTIACCESS_DBM}" ]; then
+ P_R_COPYDIR="multiaccess:Cmdtests.$version"
+ fi
+
+ mkdir -p ${CMDTESTSDIR}
+ mkdir -p ${COPYDIR}
+ mkdir -p ${CMDTESTSDIR}/html
+
+ cd ${CMDTESTSDIR}
+}
+
+############################## ct_vercrt ##################################
+# CERT_VerifyCert should not fail when verifying encryption cert
+# Bugzilla Bug 119059
+########################################################################
+#ct_vercrt()
+#{
+ # echo "$SCRIPTNAME: Verify encryption certificate ----------------------"
+ # echo "vercrt"
+ # vercrt
+ # ret=$?
+ # html_msg $ret 0 "Verify encryption certificate (vercrt)"
+#
+#}
+
+
+############################## cmdtests_cleanup ########################
+# local shell function to finish this script (no exit since it might be
+# sourced)
+########################################################################
+cmdtests_cleanup()
+{
+ html "</TABLE><BR>"
+ cd ${QADIR}
+ . common/cleanup.sh
+}
+
+################## main #################################################
+
+cmdtests_init
+
+#ct_vercrt
+cmdtests_cleanup