diff options
author | cvs2hg <devnull@localhost> | 2001-04-12 20:23:45 +0000 |
---|---|---|
committer | cvs2hg <devnull@localhost> | 2001-04-12 20:23:45 +0000 |
commit | f6ad8dde556ab949cda65d2c14fb492db6ef84e0 (patch) | |
tree | 38d4240ab129d80c3a492c238ded6047dc014246 | |
parent | 50fbf2ed9c277623fc1014197175409bfbf9933a (diff) | |
download | nss-hg-MOZILLA_0_9_RELEASE.tar.gz |
fixup commit for branch 'Accessible_042401_Branch2'XPCDOM_20010420_BASEXPCDOM_20010329_BASEStyle_20010509_BaseMOZILLA_0_9_RELEASEMOZILLA_0_9_2001042510_BASEAccessible_042501_Base3Accessible_042401_Base2
42 files changed, 5410 insertions, 922 deletions
diff --git a/security/dbm/manifest.mn b/security/coreconf/SunOS5.9.mk index 4cfffae43..63a1a003b 100644..100755 --- a/security/dbm/manifest.mn +++ b/security/coreconf/SunOS5.9.mk @@ -1,4 +1,3 @@ -#! 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,16 +30,15 @@ # may use your version of this file under either the MPL or the # GPL. # +# Config stuff for SunOS5.9 +# -CORE_DEPTH = .. - -MODULE = dbm +SOL_CFLAGS += -D_SVID_GETTOD -#IMPORTS = nspr20/v3.5 -IMPORTS = nspr20/v4.0 +include $(CORE_DEPTH)/coreconf/SunOS5.mk -RELEASE = dbm +ifeq ($(OS_RELEASE),5.9) + OS_DEFINES += -DSOLARIS2_9 +endif -DIRS = include \ - src \ - $(NULL) +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/security/dbm/src/manifest.mn b/security/coreconf/SunOS5.9_i86pc.mk index 1c2bef2d3..115a2bc32 100644..100755 --- a/security/dbm/src/manifest.mn +++ b/security/coreconf/SunOS5.9_i86pc.mk @@ -1,4 +1,3 @@ -#! gmake # # The contents of this file are subject to the Mozilla Public # License Version 1.1 (the "License"); you may not use this file @@ -14,7 +13,7 @@ # # The Initial Developer of the Original Code is Netscape # Communications Corporation. Portions created by Netscape are -# Copyright (C) 1994-2000 Netscape Communications Corporation. All +# Copyright (C) 2000 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): @@ -31,25 +30,18 @@ # may use your version of this file under either the MPL or the # GPL. # +# Config stuff for Solaris 9 on x86 +# + +SOL_CFLAGS = -D_SVID_GETTOD -CORE_DEPTH = ../.. +include $(CORE_DEPTH)/coreconf/SunOS5.mk -MODULE = dbm +CPU_ARCH = x86 +OS_DEFINES += -Di386 -CSRCS = db.c \ - h_bigkey.c \ - h_func.c \ - h_log2.c \ - h_page.c \ - hash.c \ - hash_buf.c \ - hsearch.c \ - memmove.c \ - mktemp.c \ - ndbm.c \ -# snprintf.c \ - strerror.c \ - nsres.c \ - $(NULL) +ifeq ($(OS_RELEASE),5.9_i86pc) + OS_DEFINES += -DSOLARIS2_9 +endif -LIBRARY_NAME = dbm +OS_LIBS += -lthread -lnsl -lsocket -lposix4 -ldl -lc diff --git a/security/coreconf/WIN32.mk b/security/coreconf/WIN32.mk index 7bc23a334..61563e49a 100644 --- a/security/coreconf/WIN32.mk +++ b/security/coreconf/WIN32.mk @@ -93,9 +93,6 @@ DEFINES += -DWIN32 # DEFINES += -D_WINDOWS -ifdef MOZILLA_CLIENT -INCLUDES += -I$(SOURCE_XP_DIR)/include -endif # override default, which is ASFLAGS = CFLAGS AS = ml.exe diff --git a/security/coreconf/headers.mk b/security/coreconf/headers.mk index f09d5f6ee..76f2d1483 100644 --- a/security/coreconf/headers.mk +++ b/security/coreconf/headers.mk @@ -52,3 +52,7 @@ endif # INCLUDES += -I$(SOURCE_XPPRIVATE_DIR) + +ifdef MOZILLA_CLIENT +INCLUDES += -I$(SOURCE_XP_DIR)/include +endif diff --git a/security/coreconf/source.mk b/security/coreconf/source.mk index 825ebc5ec..edc78530e 100644 --- a/security/coreconf/source.mk +++ b/security/coreconf/source.mk @@ -39,13 +39,17 @@ # <user_source_tree> master import/export directory prefix # +ifndef SOURCE_PREFIX SOURCE_PREFIX = $(CORE_DEPTH)/../dist +endif # # <user_source_tree> cross-platform (xp) master import/export directory # +ifndef SOURCE_XP_DIR SOURCE_XP_DIR = $(SOURCE_PREFIX) +endif # # <user_source_tree> cross-platform (xp) import/export directories @@ -66,15 +70,28 @@ endif # <user_source_tree> machine-dependent (md) master import/export directory # +ifndef SOURCE_MD_DIR SOURCE_MD_DIR = $(SOURCE_PREFIX)/$(PLATFORM) +endif # # <user_source_tree> machine-dependent (md) import/export directories # +#This is where we install built executables and (for Windows only) DLLs. +ifndef SOURCE_BIN_DIR SOURCE_BIN_DIR = $(SOURCE_MD_DIR)/bin +endif + +#This is where we install build libraries (.a, .so, .lib). +ifndef SOURCE_LIB_DIR SOURCE_LIB_DIR = $(SOURCE_MD_DIR)/lib +endif + +# This is where NSPR header files are found. +ifndef SOURCE_MDHEADERS_DIR SOURCE_MDHEADERS_DIR = $(SOURCE_MD_DIR)/include +endif ####################################################################### # Master <component>-specific source release directories and files # diff --git a/security/dbm/Makefile b/security/dbm/Makefile deleted file mode 100644 index 34cd6d899..000000000 --- a/security/dbm/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -#! 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/include/Makefile b/security/dbm/include/Makefile deleted file mode 100644 index 51b7b62d7..000000000 --- a/security/dbm/include/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -#! 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). # -####################################################################### - -CPORLN = ln -s -ifeq ($(OS_ARCH),WINNT) -CPORLN = cp -endif - -DBM_SRCS = $(EXPORTS) $(PRIVATE_EXPORTS) watcomfx.h - -ALL_TRASH += $(DBM_SRCS) - -$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/include/% - -$(CPORLN) $< . - -export:: $(DBM_SRCS) - -libs:: $(DBM_SRCS) - -program:: $(DBM_SRCS) - -private_export:: $(DBM_SRCS) - -echo:: - echo "$(DBM_SRCS)" diff --git a/security/dbm/include/manifest.mn b/security/dbm/include/manifest.mn deleted file mode 100644 index e0f50f6f1..000000000 --- a/security/dbm/include/manifest.mn +++ /dev/null @@ -1,55 +0,0 @@ -#! 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 = ../.. - -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/dbm/src/Makefile b/security/dbm/src/Makefile deleted file mode 100644 index 997edacc9..000000000 --- a/security/dbm/src/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -#! 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 config.mk - -####################################################################### -# (5) Execute "global" rules. (OPTIONAL) # -####################################################################### - -include $(CORE_DEPTH)/coreconf/rules.mk - -####################################################################### -# (6) Execute "component" rules. (OPTIONAL) # -####################################################################### - -ifeq ($(OS_CONFIG),OSF1V4.0D) -INCLUDES += -I/usr/sys/include/arch/alpha -endif - -####################################################################### -# (7) Execute "local" rules. (OPTIONAL). # -####################################################################### - - -CPORLN = ln -s -ifeq ($(OS_ARCH),WINNT) -CPORLN = cp -endif - -DBM_SRCS = $(CSRCS) - -ALL_TRASH += $(DBM_SRCS) - -$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/src/% - -$(CPORLN) $< . - -export:: $(DBM_SRCS) - -libs:: $(DBM_SRCS) - -program:: $(DBM_SRCS) - -private_export:: $(DBM_SRCS) - -echo:: - echo "$(DBM_SRCS)" diff --git a/security/dbm/src/config.mk b/security/dbm/src/config.mk deleted file mode 100644 index 40d862aab..000000000 --- a/security/dbm/src/config.mk +++ /dev/null @@ -1,65 +0,0 @@ -#! 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) -DNSPR20=1 - -INCLUDES += -I../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 ($(OS_ARCH),WINNT) - ifneq ($(OS_TARGET),WIN16) - DLLBASE=/BASE:0x30000000 - RES=$(OBJDIR)/dbm.res - RESNAME=../include/dbm.rc - endif - endif - ifeq ($(DLL_SUFFIX),dll) - DEFINES += -D_DLL - endif -endif - -ifeq ($(OS_ARCH),AIX) - OS_LIBS += -lc_r -endif diff --git a/security/dbm/tests/Makefile b/security/dbm/tests/Makefile deleted file mode 100644 index 3bdb3134b..000000000 --- a/security/dbm/tests/Makefile +++ /dev/null @@ -1,131 +0,0 @@ -#! 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 = ../.. - -MODULE = dbm - -CSRCS = lots.c - -PROGRAM = lots - -include $(DEPTH)/coreconf/config.mk - -ifeq ($(OS_ARCH),WINNT) -DEFINES += -DSTDARG -LIBDBM = ../src/$(PLATFORM)/dbm$(STATIC_LIB_SUFFIX) -else -LIBDBM = ../src/$(PLATFORM)/libdbm$(STATIC_LIB_SUFFIX) -endif - -ifeq ($(OS_ARCH),AIX) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),BSD_386) -CFLAGS += -g -I../../../include -DXP_UNIX -g -DBSDI -DHAVE_STRERROR -D__386BSD__ -DDEBUG -DMEMMOVE -D__DBINTERFACE_PRIVATE -endif - -ifeq ($(OS_ARCH),FreeBSD) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),HP-UX) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),IRIX) -CFLAGS += -g -I../../../include -DDEBUG -DSTDARG -endif - -ifeq ($(OS_ARCH),OSF1) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),Linux) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),NCR) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),SCO_SV) -CFLAGS += -DSTDARG -endif - -ifeq ($(OS_ARCH),SunOS) -CFLAGS += -g -I../../../include -D_sun_ -endif - -ifeq ($(OS_ARCH),UNIXWARE) -CFLAGS += -DSTDARG -endif - -INCLUDES += -I../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.o $(MYLIBS) - -crash.pure: crash.o $(MYLIBS) - purify $(CC) -o crash.pure $(CFLAGS) crash.o $(MYLIBS) - - -CPORLN = ln -s -ifeq ($(OS_ARCH),WINNT) -CPORLN = cp -endif - -DBM_SRCS = $(CSRCS) - -ALL_TRASH += $(DBM_SRCS) - -$(DBM_SRCS) : % : $(CORE_DEPTH)/../dbm/tests/% - -$(CPORLN) $< . - -export:: $(DBM_SRCS) - -libs:: $(DBM_SRCS) - -program:: $(DBM_SRCS) - -private_export:: $(DBM_SRCS) - diff --git a/security/nss/cmd/pk12util/pk12util.c b/security/nss/cmd/pk12util/pk12util.c index 71f345c22..4d9ca833c 100644 --- a/security/nss/cmd/pk12util/pk12util.c +++ b/security/nss/cmd/pk12util/pk12util.c @@ -42,6 +42,7 @@ #define PKCS12_IN_BUFFER_SIZE 200 static char *progName; +PRBool pk12_debugging = PR_FALSE; PRIntn pk12uErrno = 0; @@ -187,12 +188,6 @@ p12u_CreateTemporaryDigestFile(void) return NULL; } - p12cxt->file = PR_Open(p12cxt->filename, PR_RDONLY, 0400); - if (!p12cxt->filename) { - p12u_DestroyExportFileInfo(&p12cxt, PR_FALSE); - return NULL; - } - return p12cxt; } @@ -347,8 +342,7 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode, /* If converting Unicode to ASCII, swap bytes before conversion * as neccessary. */ -#ifdef DEBUG - { + if (pk12_debugging) { int i; printf("Converted from:\n"); for (i=0; i<inBufLen; i++) { @@ -357,7 +351,6 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode, } printf("\n"); } -#endif it.data = inBuf; it.len = inBufLen; dup = SECITEM_DupItem(&it); @@ -388,8 +381,7 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode, SECITEM_ZfreeItem(dup, PR_TRUE); } #endif -#ifdef DEBUG - { + if (pk12_debugging) { int i; printf("Converted to:\n"); for (i=0; i<*outBufLen; i++) { @@ -398,7 +390,6 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode, } printf("\n"); } -#endif return ret; } @@ -476,15 +467,15 @@ P12U_InitSlot(PK11SlotInfo *slot, secuPWData *slotPw) (slotPw->source == PW_PLAINTEXT) ? slotPw->data : 0, (slotPw->source == PW_FROMFILE) ? slotPw->data : 0); if (rv != SECSuccess) { - PR_fprintf(PR_STDERR, "%s: Failed to initialize slot \"%s\".\n", - progName, PK11_GetSlotName(slot)); + SECU_PrintError(progName, "Failed to initialize slot \"%s\"", + PK11_GetSlotName(slot)); return SECFailure; } } if (PK11_Authenticate(slot, PR_TRUE, slotPw) != SECSuccess) { - PR_fprintf(PR_STDERR, "%s: Failed to authenticate to PKCS11 slot.\n", - progName); + SECU_PrintError(progName, + "Failed to authenticate to PKCS11 slot"); PORT_SetError(SEC_ERROR_USER_CANCELLED); pk12uErrno = PK12UERR_USER_CANCELLED; return SECFailure; @@ -520,15 +511,15 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, rv = P12U_InitSlot(slot, slotPw); if (rv != SECSuccess) { - PR_fprintf(PR_STDERR, "%s: Failed to authenticate to \"%s\".\n", - progName, PK11_GetSlotName(slot)); + SECU_PrintError(progName, "Failed to authenticate to \"%s\"", + PK11_GetSlotName(slot)); pk12uErrno = PK12UERR_PK11GETSLOT; goto loser; } p12cxt = p12u_InitFile(PR_TRUE, in_file); if(!p12cxt) { - printf("%s: Initialization failed: %s\n", progName, in_file); + SECU_PrintError(progName,"Initialization failed: %s", in_file); pk12uErrno = PK12UERR_INIT_FILE; goto loser; } @@ -542,14 +533,14 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, if(P12U_UnicodeConversion(NULL, &uniPwitem, pwitem, PR_TRUE, swapUnicode) != SECSuccess) { - printf("%s: Unicode conversion failed \n", progName); + SECU_PrintError(progName,"Unicode conversion failed"); pk12uErrno = PK12UERR_UNICODECONV; goto loser; } tmpcxt = p12u_CreateTemporaryDigestFile(); if(!tmpcxt) { - printf("%s: Create Temporary digest file failed.\n", progName); + SECU_PrintError(progName,"Create Temporary digest file failed"); pk12uErrno = PK12UERR_TMPDIGCREATE; goto loser; } @@ -560,7 +551,7 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, p12u_DigestRead, p12u_DigestWrite, tmpcxt); if(!p12dcx) { - printf("%s: PKCS12 decoder start failed.\n", progName); + SECU_PrintError(progName,"PKCS12 decoder start failed"); pk12uErrno = PK12UERR_PK12DECODESTART; goto loser; } @@ -568,7 +559,7 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, /* decode the item */ rv = SECU_FileToItem(&p12file, p12cxt->file); if (rv != SECSuccess) { - fprintf(stderr, "%s: Failed to read from import file.\n", progName); + SECU_PrintError(progName,"Failed to read from import file"); goto loser; } rv = SEC_PKCS12DecoderUpdate(p12dcx, p12file.data, p12file.len); @@ -587,7 +578,7 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, } goto tried_pdu_import; #endif /* EXTRA */ - printf("%s: PKCS12 decoding failed.\n", progName); + SECU_PrintError(progName,"PKCS12 decoding failed"); pk12uErrno = PK12UERR_DECODE; } @@ -595,7 +586,7 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, /* does the blob authenticate properly? */ if(SEC_PKCS12DecoderVerify(p12dcx) != SECSuccess) { - printf("%s: PKCS12 decode not verified\n", progName); + SECU_PrintError(progName,"PKCS12 decode not verified"); pk12uErrno = PK12UERR_DECODEVERIFY; goto loser; } @@ -605,15 +596,16 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, != SECSuccess) { if (PORT_GetError() == SEC_ERROR_PKCS12_DUPLICATE_DATA) { pk12uErrno = PK12UERR_CERTALREADYEXISTS; + } else { + pk12uErrno = PK12UERR_DECODEVALIBAGS; } - printf("%s: PKCS12 decode validate bags failed.\n", progName); - pk12uErrno = PK12UERR_DECODEVALIBAGS; + SECU_PrintError(progName,"PKCS12 decode validate bags failed"); goto loser; } /* stuff 'em in */ if(SEC_PKCS12DecoderImportBags(p12dcx) != SECSuccess) { - printf("%s: PKCS12 decode import bags failed.\n", progName); + SECU_PrintError(progName,"PKCS12 decode import bags failed"); pk12uErrno = PK12UERR_DECODEIMPTBAGS; goto loser; } @@ -622,7 +614,7 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot, /* important - to add the password hash into the key database */ rv = PK11_CheckUserPassword(slot, pw_string); if( rv != SECSuccess ) { - printf("Failed to CheckUserPassword\n"); + SECU_PrintError(progName,"Failed to CheckUserPassword"); exit(-1); } #endif @@ -715,19 +707,19 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, cert = PK11_FindCertFromNickname(nn, NULL); if(!cert) { - printf("%s: find cert by nickname failed.\n", progName); + SECU_PrintError(progName,"find cert by nickname failed"); pk12uErrno = PK12UERR_FINDCERTBYNN; return; } if (!cert->slot) { - fprintf(stderr, "%s: cert does not have a slot.\n", progName); + SECU_PrintError(progName,"cert does not have a slot"); pk12uErrno = PK12UERR_FINDCERTBYNN; goto loser; } if (P12U_InitSlot(cert->slot, slotPw) != SECSuccess) { - fprintf(stderr, "%s: Failed to authenticate to \"%s\".\n", - progName, PK11_GetSlotName(cert->slot)); + SECU_PrintError(progName,"Failed to authenticate to \"%s\"", + PK11_GetSlotName(cert->slot)); pk12uErrno = PK12UERR_PK11GETSLOT; goto loser; } @@ -740,14 +732,14 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, p12ecx = SEC_PKCS12CreateExportContext(NULL, NULL, cert->slot, NULL); if(!p12ecx) { - printf("%s: export context creation failed.\n", progName); + SECU_PrintError(progName,"export context creation failed"); pk12uErrno = PK12UERR_EXPORTCXCREATE; goto loser; } if(SEC_PKCS12AddPasswordIntegrity(p12ecx, pwitem, SEC_OID_SHA1) != SECSuccess) { - printf("%s: PKCS12 add password integrity failed.\n", progName); + SECU_PrintError(progName,"PKCS12 add password integrity failed"); pk12uErrno = PK12UERR_PK12ADDPWDINTEG; goto loser; } @@ -761,7 +753,7 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, } if(!certSafe || !keySafe) { - printf("%s: key or cert safe creation failed.\n", progName); + SECU_PrintError(progName,"key or cert safe creation failed"); pk12uErrno = PK12UERR_CERTKEYSAFE; goto loser; } @@ -770,21 +762,21 @@ P12U_ExportPKCS12Object(char *nn, char *outfile, CERT_GetDefaultCertDB(), keySafe, NULL, PR_TRUE, pwitem, SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC) != SECSuccess) { - printf("%s: add cert and key failed.\n", progName); + SECU_PrintError(progName,"add cert and key failed"); pk12uErrno = PK12UERR_ADDCERTKEY; goto loser; } - p12cxt = p12u_InitFile(PR_FALSE, outfile); + p12cxt = p12u_InitFile(PR_FALSE, outfile); if(!p12cxt) { - printf("%s: Initialization failed: %s\n", progName, outfile); + SECU_PrintError(progName,"Initialization failed: %s", outfile); pk12uErrno = PK12UERR_INIT_FILE; goto loser; } if(SEC_PKCS12Encode(p12ecx, p12u_WriteToExportFile, p12cxt) != SECSuccess) { - printf("%s: PKCS12 encode failed.\n", progName); + SECU_PrintError(progName,"PKCS12 encode failed"); pk12uErrno = PK12UERR_ENCODE; goto loser; } @@ -869,7 +861,8 @@ enum { opt_Export, opt_P12FilePWFile, opt_P12FilePW, - opt_DBPrefix + opt_DBPrefix, + opt_Debug }; static secuCommandFlag pk12util_options[] = @@ -884,7 +877,8 @@ static secuCommandFlag pk12util_options[] = { /* opt_Export */ 'o', PR_TRUE, 0, PR_FALSE }, { /* opt_P12FilePWFile */ 'w', PR_TRUE, 0, PR_FALSE }, { /* opt_P12FilePW */ 'W', PR_TRUE, 0, PR_FALSE }, - { /* opt_DBPrefix */ 'P', PR_TRUE, 0, PR_FALSE } + { /* opt_DBPrefix */ 'P', PR_TRUE, 0, PR_FALSE }, + { /* opt_Debug */ 'v', PR_FALSE, 0, PR_FALSE } }; int @@ -914,6 +908,8 @@ main(int argc, char **argv) if (rv != SECSuccess) Usage(progName); + pk12_debugging = pk12util.options[opt_Debug].activated; + if (pk12util.options[opt_Import].activated && pk12util.options[opt_Export].activated) { Usage(progName); @@ -964,8 +960,7 @@ main(int argc, char **argv) slot = PK11_FindSlotByName(slotname); if (!slot) { - PR_fprintf(PR_STDERR, "%s: Invalid slot \"%s\".\n", - progName, slotname); + SECU_PrintError(progName,"Invalid slot \"%s\"", slotname); goto done; } diff --git a/security/nss/lib/certdb/cert.h b/security/nss/lib/certdb/cert.h index da12103f9..59b4031be 100644 --- a/security/nss/lib/certdb/cert.h +++ b/security/nss/lib/certdb/cert.h @@ -1076,6 +1076,14 @@ CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert); SECStatus CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert); +SECStatus +CERT_AddCertToListTailWithData(CERTCertList *certs, CERTCertificate *cert, + void *appData); + +SECStatus +CERT_AddCertToListHeadWithData(CERTCertList *certs, CERTCertificate *cert, + void *appData); + typedef PRBool (* CERTSortCallback)(CERTCertificate *certa, CERTCertificate *certb, void *arg); diff --git a/security/nss/lib/certdb/certdb.c b/security/nss/lib/certdb/certdb.c index e626581ac..3d35b9673 100644 --- a/security/nss/lib/certdb/certdb.c +++ b/security/nss/lib/certdb/certdb.c @@ -2019,8 +2019,10 @@ CERT_RemoveCertListNode(CERTCertListNode *node) return; } + SECStatus -CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert) +CERT_AddCertToListTailWithData(CERTCertList *certs, + CERTCertificate *cert, void *appData) { CERTCertListNode *node; @@ -2033,6 +2035,7 @@ CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert) PR_INSERT_BEFORE(&node->links, &certs->list); /* certs->count++; */ node->cert = cert; + node->appData = appData; return(SECSuccess); loser: @@ -2040,7 +2043,14 @@ loser: } SECStatus -CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert) +CERT_AddCertToListTail(CERTCertList *certs, CERTCertificate *cert) +{ + CERT_AddCertToListTailWithData(certs, cert, NULL); +} + +SECStatus +CERT_AddCertToListHeadWithData(CERTCertList *certs, + CERTCertificate *cert, void *appData) { CERTCertListNode *node; CERTCertListNode *head; @@ -2058,12 +2068,19 @@ CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert) PR_INSERT_BEFORE(&node->links, &head->links); /* certs->count++; */ node->cert = cert; + node->appData = appData; return(SECSuccess); loser: return(SECFailure); } +SECStatus +CERT_AddCertToListHead(CERTCertList *certs, CERTCertificate *cert) +{ + return CERT_AddCertToListHeadWithData(certs, cert, NULL); +} + /* * Sort callback function to determine if cert a is newer than cert b. * Not valid certs are considered older than valid certs. diff --git a/security/nss/lib/certdb/pcertdb.c b/security/nss/lib/certdb/pcertdb.c index 611a9b5c6..f4f6d3483 100644 --- a/security/nss/lib/certdb/pcertdb.c +++ b/security/nss/lib/certdb/pcertdb.c @@ -3988,8 +3988,6 @@ UpdateV5DB(CERTCertDBHandle *handle, DB *updatedb) (* updatedb->close)(updatedb); return(SECSuccess); - - return(rv); } static PRBool @@ -4720,7 +4718,7 @@ cert_parseNickname(char *nickname) for (cp=nickname; *cp && *cp != ':'; cp++); - if (*cp == ':') return cp++; + if (*cp == ':') return cp+1; return nickname; } diff --git a/security/nss/lib/certhigh/certread.c b/security/nss/lib/certhigh/certread.c new file mode 100644 index 000000000..5c5ddab78 --- /dev/null +++ b/security/nss/lib/certhigh/certread.c @@ -0,0 +1,535 @@ +/* + * 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. + */ + +#include "cert.h" +#include "secpkcs7.h" +#include "base64.h" +#include "secitem.h" +#include "secder.h" +#include "secasn1.h" +#include "secoid.h" + +SECStatus +SEC_ReadPKCS7Certs(SECItem *pkcs7Item, CERTImportCertificateFunc f, void *arg) +{ + SEC_PKCS7ContentInfo *contentInfo = NULL; + SECStatus rv; + SECItem **certs; + int count; + + contentInfo = SEC_PKCS7DecodeItem(pkcs7Item, NULL, NULL, NULL, NULL, NULL, + NULL, NULL); + if ( contentInfo == NULL ) { + goto loser; + } + + if ( SEC_PKCS7ContentType (contentInfo) != SEC_OID_PKCS7_SIGNED_DATA ) { + goto loser; + } + + certs = contentInfo->content.signedData->rawCerts; + if ( certs ) { + count = 0; + + while ( *certs ) { + count++; + certs++; + } + rv = (* f)(arg, contentInfo->content.signedData->rawCerts, count); + } + + rv = SECSuccess; + + goto done; +loser: + rv = SECFailure; + +done: + if ( contentInfo ) { + SEC_PKCS7DestroyContentInfo(contentInfo); + } + + return(rv); +} + +const SEC_ASN1Template SEC_CertSequenceTemplate[] = { + { SEC_ASN1_SEQUENCE_OF, + 0, SECAnyTemplate } +}; + +SECStatus +SEC_ReadCertSequence(SECItem *certsItem, CERTImportCertificateFunc f, void *arg) +{ + SECStatus rv; + SECItem **certs; + int count; + SECItem **rawCerts = NULL; + PRArenaPool *arena; + SEC_PKCS7ContentInfo *contentInfo = NULL; + + arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + if (arena == NULL) { + return SECFailure; + } + + contentInfo = SEC_PKCS7DecodeItem(certsItem, NULL, NULL, NULL, NULL, NULL, + NULL, NULL); + if ( contentInfo == NULL ) { + goto loser; + } + + if ( SEC_PKCS7ContentType (contentInfo) != SEC_OID_NS_TYPE_CERT_SEQUENCE ) { + goto loser; + } + + + rv = SEC_ASN1DecodeItem(arena, &rawCerts, SEC_CertSequenceTemplate, + contentInfo->content.data); + + if (rv != SECSuccess) { + goto loser; + } + + certs = rawCerts; + if ( certs ) { + count = 0; + + while ( *certs ) { + count++; + certs++; + } + rv = (* f)(arg, rawCerts, count); + } + + rv = SECSuccess; + + goto done; +loser: + rv = SECFailure; + +done: + if ( contentInfo ) { + SEC_PKCS7DestroyContentInfo(contentInfo); + } + + if ( arena ) { + PORT_FreeArena(arena, PR_FALSE); + } + + return(rv); +} + +CERTCertificate * +CERT_ConvertAndDecodeCertificate(char *certstr) +{ + CERTCertificate *cert; + SECStatus rv; + SECItem der; + + rv = ATOB_ConvertAsciiToItem(&der, certstr); + if (rv != SECSuccess) + return NULL; + + cert = CERT_DecodeDERCertificate(&der, PR_TRUE, NULL); + + PORT_Free(der.data); + return cert; +} + +#define NS_CERT_HEADER "-----BEGIN CERTIFICATE-----" +#define NS_CERT_TRAILER "-----END CERTIFICATE-----" + +#define CERTIFICATE_TYPE_STRING "certificate" +#define CERTIFICATE_TYPE_LEN (sizeof(CERTIFICATE_TYPE_STRING)-1) + +CERTPackageType +CERT_CertPackageType(SECItem *package, SECItem *certitem) +{ + unsigned char *cp; + int seqLen, seqLenLen; + SECItem oiditem; + SECOidData *oiddata; + CERTPackageType type = certPackageNone; + + cp = package->data; + + /* is a DER encoded certificate of some type? */ + if ( ( *cp & 0x1f ) == SEC_ASN1_SEQUENCE ) { + cp++; + + if ( *cp & 0x80) { + /* Multibyte length */ + seqLenLen = cp[0] & 0x7f; + + switch (seqLenLen) { + case 4: + seqLen = ((unsigned long)cp[1]<<24) | + ((unsigned long)cp[2]<<16) | (cp[3]<<8) | cp[4]; + break; + case 3: + seqLen = ((unsigned long)cp[1]<<16) | (cp[2]<<8) | cp[3]; + break; + case 2: + seqLen = (cp[1]<<8) | cp[2]; + break; + case 1: + seqLen = cp[1]; + break; + default: + /* indefinite length */ + seqLen = 0; + } + cp += ( seqLenLen + 1 ); + + } else { + seqLenLen = 0; + seqLen = *cp; + cp++; + } + + /* check entire length if definite length */ + if ( seqLen || seqLenLen ) { + if ( package->len != ( seqLen + seqLenLen + 2 ) ) { + /* not a DER package */ + return(type); + } + } + + /* check the type string */ + /* netscape wrapped DER cert */ + if ( ( cp[0] == SEC_ASN1_OCTET_STRING ) && + ( cp[1] == CERTIFICATE_TYPE_LEN ) && + ( PORT_Strcmp((char *)&cp[2], CERTIFICATE_TYPE_STRING) ) ) { + + cp += ( CERTIFICATE_TYPE_LEN + 2 ); + + /* it had better be a certificate by now!! */ + if ( certitem ) { + certitem->data = cp; + certitem->len = package->len - + ( cp - (unsigned char *)package->data ); + } + type = certPackageNSCertWrap; + + } else if ( cp[0] == SEC_ASN1_OBJECT_ID ) { + /* XXX - assume DER encoding of OID len!! */ + oiditem.len = cp[1]; + oiditem.data = (unsigned char *)&cp[2]; + oiddata = SECOID_FindOID(&oiditem); + if ( oiddata == NULL ) { + /* failure */ + return(type); + } + + if ( certitem ) { + certitem->data = package->data; + certitem->len = package->len; + } + + switch ( oiddata->offset ) { + case SEC_OID_PKCS7_SIGNED_DATA: + type = certPackagePKCS7; + break; + case SEC_OID_NS_TYPE_CERT_SEQUENCE: + type = certPackageNSCertSeq; + break; + default: + break; + } + + } else { + /* it had better be a certificate by now!! */ + if ( certitem ) { + certitem->data = package->data; + certitem->len = package->len; + } + + type = certPackageCert; + } + } + + return(type); +} + +/* + * read an old style ascii or binary certificate chain + */ +SECStatus +CERT_DecodeCertPackage(char *certbuf, + int certlen, + CERTImportCertificateFunc f, + void *arg) +{ + unsigned char *cp; + int seqLen, seqLenLen; + int cl; + unsigned char *bincert = NULL, *certbegin = NULL, *certend = NULL; + unsigned int binLen; + char *ascCert = NULL; + int asciilen; + CERTCertificate *cert; + SECItem certitem, oiditem; + SECStatus rv; + SECOidData *oiddata; + SECItem *pcertitem = &certitem; + + if ( certbuf == NULL ) { + return(SECFailure); + } + + cert = 0; + cp = (unsigned char *)certbuf; + + /* is a DER encoded certificate of some type? */ + if ( ( *cp & 0x1f ) == SEC_ASN1_SEQUENCE ) { + cp++; + + if ( *cp & 0x80) { + /* Multibyte length */ + seqLenLen = cp[0] & 0x7f; + + switch (seqLenLen) { + case 4: + seqLen = ((unsigned long)cp[1]<<24) | + ((unsigned long)cp[2]<<16) | (cp[3]<<8) | cp[4]; + break; + case 3: + seqLen = ((unsigned long)cp[1]<<16) | (cp[2]<<8) | cp[3]; + break; + case 2: + seqLen = (cp[1]<<8) | cp[2]; + break; + case 1: + seqLen = cp[1]; + break; + default: + /* indefinite length */ + seqLen = 0; + } + cp += ( seqLenLen + 1 ); + + } else { + seqLenLen = 0; + seqLen = *cp; + cp++; + } + + /* check entire length if definite length */ + if ( seqLen || seqLenLen ) { + if ( certlen != ( seqLen + seqLenLen + 2 ) ) { + goto notder; + } + } + + /* check the type string */ + /* netscape wrapped DER cert */ + if ( ( cp[0] == SEC_ASN1_OCTET_STRING ) && + ( cp[1] == CERTIFICATE_TYPE_LEN ) && + ( PORT_Strcmp((char *)&cp[2], CERTIFICATE_TYPE_STRING) ) ) { + + cp += ( CERTIFICATE_TYPE_LEN + 2 ); + + /* it had better be a certificate by now!! */ + certitem.data = cp; + certitem.len = certlen - ( cp - (unsigned char *)certbuf ); + + rv = (* f)(arg, &pcertitem, 1); + + return(rv); + } else if ( cp[0] == SEC_ASN1_OBJECT_ID ) { + /* XXX - assume DER encoding of OID len!! */ + oiditem.len = cp[1]; + oiditem.data = (unsigned char *)&cp[2]; + oiddata = SECOID_FindOID(&oiditem); + if ( oiddata == NULL ) { + return(SECFailure); + } + + certitem.data = (unsigned char*)certbuf; + certitem.len = certlen; + + switch ( oiddata->offset ) { + case SEC_OID_PKCS7_SIGNED_DATA: + return(SEC_ReadPKCS7Certs(&certitem, f, arg)); + break; + case SEC_OID_NS_TYPE_CERT_SEQUENCE: + return(SEC_ReadCertSequence(&certitem, f, arg)); + break; + default: + break; + } + + } else { + /* it had better be a certificate by now!! */ + certitem.data = (unsigned char*)certbuf; + certitem.len = certlen; + + rv = (* f)(arg, &pcertitem, 1); + return(rv); + } + } + + /* now look for a netscape base64 ascii encoded cert */ +notder: + cp = (unsigned char *)certbuf; + cl = certlen; + certbegin = 0; + certend = 0; + + /* find the beginning marker */ + while ( cl > sizeof(NS_CERT_HEADER) ) { + if ( !PORT_Strncasecmp((char *)cp, NS_CERT_HEADER, + sizeof(NS_CERT_HEADER)-1) ) { + cp = cp + sizeof(NS_CERT_HEADER); + certbegin = cp; + break; + } + + /* skip to next eol */ + do { + cp++; + cl--; + } while ( ( *cp != '\n') && cl ); + + /* skip all blank lines */ + while ( ( *cp == '\n') && cl ) { + cp++; + cl--; + } + } + + if ( certbegin ) { + + /* find the ending marker */ + while ( cl > sizeof(NS_CERT_TRAILER) ) { + if ( !PORT_Strncasecmp((char *)cp, NS_CERT_TRAILER, + sizeof(NS_CERT_TRAILER)-1) ) { + certend = (unsigned char *)cp; + break; + } + + /* skip to next eol */ + do { + cp++; + cl--; + } while ( ( *cp != '\n') && cl ); + + /* skip all blank lines */ + while ( ( *cp == '\n') && cl ) { + cp++; + cl--; + } + } + } + + if ( certbegin && certend ) { + + /* Convert the ASCII data into a nul-terminated string */ + asciilen = certend - certbegin; + ascCert = (char *)PORT_Alloc(asciilen+1); + if (!ascCert) { + rv = SECFailure; + goto loser; + } + + PORT_Memcpy(ascCert, certbegin, asciilen); + ascCert[asciilen] = '\0'; + + /* convert to binary */ + bincert = ATOB_AsciiToData(ascCert, &binLen); + if (!bincert) { + rv = SECFailure; + goto loser; + } + + /* now recurse to decode the binary */ + rv = CERT_DecodeCertPackage((char *)bincert, binLen, f, arg); + + } else { + rv = SECFailure; + } + +loser: + + if ( bincert ) { + PORT_Free(bincert); + } + + if ( ascCert ) { + PORT_Free(ascCert); + } + + return(rv); +} + +typedef struct { + PRArenaPool *arena; + SECItem cert; +} collect_args; + +static SECStatus +collect_certs(void *arg, SECItem **certs, int numcerts) +{ + SECStatus rv; + collect_args *collectArgs; + + collectArgs = (collect_args *)arg; + + rv = SECITEM_CopyItem(collectArgs->arena, &collectArgs->cert, *certs); + + return(rv); +} + + +/* + * read an old style ascii or binary certificate + */ +CERTCertificate * +CERT_DecodeCertFromPackage(char *certbuf, int certlen) +{ + collect_args collectArgs; + SECStatus rv; + CERTCertificate *cert = NULL; + + collectArgs.arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + + rv = CERT_DecodeCertPackage(certbuf, certlen, collect_certs, + (void *)&collectArgs); + if ( rv == SECSuccess ) { + cert = CERT_DecodeDERCertificate(&collectArgs.cert, PR_TRUE, NULL); + } + + PORT_FreeArena(collectArgs.arena, PR_FALSE); + + return(cert); +} diff --git a/security/nss/lib/freebl/mpi/mpv_sparc32.S b/security/nss/lib/freebl/mpi/mpv_sparc32.S new file mode 100644 index 000000000..0fe9bbe47 --- /dev/null +++ b/security/nss/lib/freebl/mpi/mpv_sparc32.S @@ -0,0 +1,2690 @@ +/* + * 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 an asm version of SPARC/VIS multiply and add function + * + * The Initial Developer of the Original Code is Sun Microsystems Inc. + * Portions created by Sun Microsystems Inc. are + * Copyright (C) 1999-2000 Sun Microsystems Inc. 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. + * $Id$ + */ + + .section ".text",#alloc,#execinstr + .file "mul_add.c" + + .section ".data",#alloc,#write + .align 8 +mask_cnst: + .word -2147483648 + .word -2147483648 + .type mask_cnst,#object + .size mask_cnst,8 + + .section ".text",#alloc,#execinstr +/* 000000 0 */ .align 8 +! +! CONSTANT POOL +! + .L_const_seg_900000106: +/* 000000 0 */ .word 1127219200,0 +/* 0x0008 */ .word 1105199103,-4194304 +/* 0x0010 */ .word -1008730112,0 +/* 0x0018 0 */ .align 4 +! +! SUBROUTINE mul_add +! +! OFFSET SOURCE LINE LABEL INSTRUCTION + + .global mul_add + mul_add: +/* 000000 */ sethi %hi(0x2c00),%g1 +/* 0x0004 */ sethi %hi(mask_cnst),%g2 +/* 0x0008 */ xor %g1,-584,%g1 +/* 0x000c */ add %g2,%lo(mask_cnst),%g2 +/* 0x0010 */ save %sp,%g1,%sp + .L900000190: +/* 0x0014 */ call .+8 +/* 0x0018 */ sethi /*X*/%hi(_GLOBAL_OFFSET_TABLE_-(.L900000190-.)),%g5 +! FILE mul_add.c + +! 1 !/* Copyright (C) 1999, Sun Microsystems, Inc. */ +! 3 !#include "vis_proto.h" +! 5 !/***************************************************************/ +! 7 !typedef int t_s32; +! 8 !typedef unsigned int t_u32; +! 9 !#if defined(__sparcv9) +! 10 !typedef long t_s64; +! 11 !typedef unsigned long t_u64; +! 12 !#else +! 13 !typedef long long t_s64; +! 14 !typedef unsigned long long t_u64; +! 15 !#endif +! 16 !typedef double t_d64; +! 18 !/***************************************************************/ +! 20 !typedef union { +! 21 ! t_d64 d64; +! 22 ! struct { +! 23 ! t_s32 i0; +! 24 ! t_s32 i1; +! 25 ! } i32s; +! 26 !} d64_2_i32; +! 28 !/***************************************************************/ +! 30 !#define BUFF_SIZE 256 +! 32 !#define A_BITS 21 +! 33 !#define A_MASK ((1 << A_BITS) - 1) +! 35 !/***************************************************************/ +! 37 !static t_u64 mask_cnst[] = { +! 38 ! 0x8000000080000000ull +! 39 !}; +! 41 !/***************************************************************/ +! 43 !#define DEF_VARS(N) \ +! 44 ! t_d64 *py = (t_d64*)y; \ +! 45 ! t_d64 mask = *((t_d64*)mask_cnst); \ +! 46 ! t_d64 ca = (1u << 31) - 1; \ +! 47 ! t_d64 da = (t_d64)a; \ +! 48 ! t_s64 buff[N], s; \ +! 49 ! d64_2_i32 dy +! 51 !/***************************************************************/ +! 53 !#define MUL_U32_S64_1(i) \ +! 54 ! dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]); \ +! 55 ! buff[0] = (ca - (t_d64)dy.i32s.i0) * da +! 57 !#define MUL_U32_S64_1_D() \ +! 58 ! dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]); \ +! 59 ! d0 = ca - (t_d64)dy.i32s.i0; \ +! 60 ! buff[0] = (t_s64)(d0 * da); \ +! 61 ! buff[1] = (t_s64)(d0 * db); \ +! 63 !#define MUL_U32_S64_1_E(i) \ +! 64 ! dy.f32s.i0 = vis_fxnors(vis_read_hi(mask), ((t_f32*)y)[0]); \ +! 65 ! d0 = ca - (t_d64)dy.i32s.i0; \ +! 66 ! buff[0] = (t_s64)(d0 * da); \ +! 67 ! buff[1] = (t_s64)(d0 * db - (1ULL << 63)) +! 69 !/************ ***************************************************/ +! 71 !#define MUL_U32_S64_2(i) \ +! 72 ! dy.d64 = vis_fxnor(mask, py[i]); \ +! 73 ! buff[2*(i) ] = (ca - (t_d64)dy.i32s.i0) * da; \ +! 74 ! buff[2*(i)+1] = (ca - (t_d64)dy.i32s.i1) * da +! 76 !#define MUL_U32_S64_2_D(i) \ +! 77 ! dy.d64 = vis_fxnor(mask, py[i]); \ +! 78 ! d0 = ca - (t_d64)dy.i32s.i0; \ +! 79 ! d1 = ca - (t_d64)dy.i32s.i1; \ +! 80 ! buff[4*(i) ] = (t_s64)(d0 * da); \ +! 81 ! buff[4*(i)+1] = (t_s64)(d0 * db); \ +! 82 ! buff[4*(i)+2] = (t_s64)(d1 * da); \ +! 83 ! buff[4*(i)+3] = (t_s64)(d1 * db) +! 85 !#define MUL_U32_S64_2_E(i) \ +! 86 ! dy.d64 = vis_fxnor(mask, py[i]); \ +! 87 ! d0 = ca - (t_d64)dy.i32s.i0; \ +! 88 ! d1 = ca - (t_d64)dy.i32s.i1; \ +! 89 ! buff[4*(i) ] = (t_s64)(d0 * da); \ +! 90 ! buff[4*(i)+1] = (t_s64)(d0 * db - (1ULL << 63)); \ +! 91 ! buff[4*(i)+2] = (t_s64)(d1 * da); \ +! 92 ! buff[4*(i)+3] = (t_s64)(d1 * db - (1ULL << 63)) +! 94 !/***************************************************************/ +! 96 !#define ADD_S64_U32(i) \ +! 97 ! s = buff[i] + x[i] + c; \ +! 98 ! z[i] = s; \ +! 99 ! c = (s >> 32) +! 101 !#define ADD_S64_U32_D(i) \ +! 102 ! s = buff[2*(i)] + buff[2*(i)+1] + x[i] + c; \ +! 103 ! z[i] = s; \ +! 104 ! c = (s >> 32) +! 106 !#define ADD_S64_U32_E(i) \ +! 107 ! s = buff[2*(i)] + buff[2*(i)+1] + x[i] + uc + (1ULL << 63); \ +! 108 ! z[i] = s; \ +! 109 ! uc = ((t_u64)s >> 32) +! 111 !/***************************************************************/ +! 113 !#define MUL_U32_S64_8(i) \ +! 114 ! MUL_U32_S64_2(i); \ +! 115 ! MUL_U32_S64_2(i+1); \ +! 116 ! MUL_U32_S64_2(i+2); \ +! 117 ! MUL_U32_S64_2(i+3) +! 119 !#define MUL_U32_S64_D_8(i) \ +! 120 ! MUL_U32_S64_2_D(i); \ +! 121 ! MUL_U32_S64_2_D(i+1); \ +! 122 ! MUL_U32_S64_2_D(i+2); \ +! 123 ! MUL_U32_S64_2_D(i+3) +! 125 !#define MUL_U32_S64_E_8(i) \ +! 126 ! MUL_U32_S64_2_E(i); \ +! 127 ! MUL_U32_S64_2_E(i+1); \ +! 128 ! MUL_U32_S64_2_E(i+2); \ +! 129 ! MUL_U32_S64_2_E(i+3) +! 131 !/***************************************************************/ +! 133 !#define ADD_S64_U32_8(i) \ +! 134 ! ADD_S64_U32(i); \ +! 135 ! ADD_S64_U32(i+1); \ +! 136 ! ADD_S64_U32(i+2); \ +! 137 ! ADD_S64_U32(i+3); \ +! 138 ! ADD_S64_U32(i+4); \ +! 139 ! ADD_S64_U32(i+5); \ +! 140 ! ADD_S64_U32(i+6); \ +! 141 ! ADD_S64_U32(i+7) +! 143 !#define ADD_S64_U32_D_8(i) \ +! 144 ! ADD_S64_U32_D(i); \ +! 145 ! ADD_S64_U32_D(i+1); \ +! 146 ! ADD_S64_U32_D(i+2); \ +! 147 ! ADD_S64_U32_D(i+3); \ +! 148 ! ADD_S64_U32_D(i+4); \ +! 149 ! ADD_S64_U32_D(i+5); \ +! 150 ! ADD_S64_U32_D(i+6); \ +! 151 ! ADD_S64_U32_D(i+7) +! 153 !#define ADD_S64_U32_E_8(i) \ +! 154 ! ADD_S64_U32_E(i); \ +! 155 ! ADD_S64_U32_E(i+1); \ +! 156 ! ADD_S64_U32_E(i+2); \ +! 157 ! ADD_S64_U32_E(i+3); \ +! 158 ! ADD_S64_U32_E(i+4); \ +! 159 ! ADD_S64_U32_E(i+5); \ +! 160 ! ADD_S64_U32_E(i+6); \ +! 161 ! ADD_S64_U32_E(i+7) +! 163 !/***************************************************************/ +! 165 !t_u32 mul_add(t_u32 *z, t_u32 *x, t_u32 *y, int n, t_u32 a) +! 166 !{ +! 167 ! if (a < (1 << A_BITS)) { +! 169 ! if (n == 8) { +! 170 ! DEF_VARS(8); +! 171 ! t_s32 c = 0; +! 173 ! MUL_U32_S64_8(0); + +/* 0x001c 173 */ sethi %hi(.L_const_seg_900000106),%g3 +/* 0x0020 166 */ add %g5,/*X*/%lo(_GLOBAL_OFFSET_TABLE_-(.L900000190-.)),%g5 +/* 0x0024 */ or %g0,%i4,%o0 +/* 0x0028 */ st %o0,[%fp+84] +/* 0x002c */ add %g5,%o7,%o1 +/* 0x0030 */ or %g0,%i3,%o2 +/* 0x0034 */ ld [%o1+%g2],%g2 +/* 0x0038 173 */ add %g3,%lo(.L_const_seg_900000106),%g3 +/* 0x003c 167 */ sethi %hi(0x200000),%g4 +/* 0x0040 173 */ ld [%o1+%g3],%o1 +/* 0x0044 166 */ or %g0,%i0,%i4 +/* 0x0048 */ or %g0,%i2,%o7 +/* 0x004c */ ldd [%g2],%f30 +/* 0x0050 */ or %g0,%i1,%o4 +/* 0x0054 167 */ cmp %o0,%g4 +/* 0x0058 166 */ or %g0,%o2,%o3 +/* 0x005c 167 */ bcc,pn %icc,.L77000062 +/* 0x0060 */ or %g0,%i4,%o5 +/* 0x0064 169 */ cmp %o2,8 +/* 0x0068 */ bne,pn %icc,.L77000051 +/* 0x006c */ ld [%fp+84],%f7 +/* 0x0070 */ ldd [%o7],%f4 +/* 0x0074 170 */ ldd [%o1],%f8 +/* 0x0078 */ fxnor %f30,%f4,%f4 +/* 0x007c 173 */ ldd [%o1+8],%f14 +/* 0x0080 */ ldd [%o7+8],%f10 +/* 0x0084 */ fitod %f4,%f12 +/* 0x0088 */ ldd [%o7+16],%f16 +/* 0x008c */ fitod %f5,%f4 +/* 0x0090 */ ldd [%o7+24],%f18 +/* 0x0094 */ fxnor %f30,%f10,%f10 + +! 174 ! ADD_S64_U32_8(0); + +/* 0x0098 174 */ ld [%i1],%g2 +/* 0x009c */ ld [%i1+4],%g3 +/* 0x00a0 */ fxnor %f30,%f16,%f16 +/* 0x00a4 173 */ fsubd %f14,%f4,%f4 +/* 0x00a8 174 */ ld [%i1+8],%g4 +/* 0x00ac */ ld [%i1+16],%o0 +/* 0x00b0 173 */ fitod %f16,%f20 +/* 0x00b4 174 */ ld [%i1+12],%g5 +/* 0x00b8 */ ld [%i1+20],%o1 +/* 0x00bc */ ld [%i1+24],%o2 +/* 0x00c0 170 */ fmovs %f8,%f6 +/* 0x00c4 174 */ ld [%i1+28],%o3 +/* 0x00c8 170 */ fsubd %f6,%f8,%f6 +/* 0x00cc 173 */ fsubd %f14,%f12,%f8 +/* 0x00d0 */ fitod %f10,%f12 +/* 0x00d4 */ fmuld %f4,%f6,%f4 +/* 0x00d8 */ fitod %f11,%f10 +/* 0x00dc */ fmuld %f8,%f6,%f8 +/* 0x00e0 */ fsubd %f14,%f12,%f12 +/* 0x00e4 */ fdtox %f4,%f4 +/* 0x00e8 */ std %f4,[%sp+360] +/* 0x00ec */ fdtox %f8,%f8 +/* 0x00f0 */ std %f8,[%sp+368] +/* 0x00f4 */ fmuld %f12,%f6,%f12 +/* 0x00f8 */ fsubd %f14,%f10,%f10 +/* 0x00fc */ fsubd %f14,%f20,%f4 +/* 0x0100 */ fitod %f17,%f8 +/* 0x0104 174 */ ldx [%sp+368],%o4 +/* 0x0108 */ fxnor %f30,%f18,%f16 +/* 0x010c 173 */ fmuld %f10,%f6,%f10 +/* 0x0110 */ fdtox %f12,%f12 +/* 0x0114 */ std %f12,[%sp+352] +/* 0x0118 */ fmuld %f4,%f6,%f4 +/* 0x011c */ fitod %f16,%f18 +/* 0x0120 174 */ add %o4,%g2,%g2 +/* 0x0124 */ st %g2,[%i4] +/* 0x0128 */ ldx [%sp+360],%o4 +/* 0x012c 173 */ fsubd %f14,%f8,%f8 +/* 0x0130 174 */ srax %g2,32,%o5 +/* 0x0134 173 */ fdtox %f10,%f10 +/* 0x0138 */ std %f10,[%sp+344] +/* 0x013c */ fdtox %f4,%f4 +/* 0x0140 */ std %f4,[%sp+336] +/* 0x0144 174 */ add %o4,%g3,%o4 +/* 0x0148 173 */ fitod %f17,%f12 +/* 0x014c 174 */ ldx [%sp+352],%g2 +/* 0x0150 */ add %o4,%o5,%g3 +/* 0x0154 173 */ fmuld %f8,%f6,%f8 +/* 0x0158 */ fsubd %f14,%f18,%f10 +/* 0x015c 174 */ st %g3,[%i4+4] +/* 0x0160 */ srax %g3,32,%g3 +/* 0x0164 */ add %g2,%g4,%g4 +/* 0x0168 */ ldx [%sp+344],%g2 +/* 0x016c 173 */ fsubd %f14,%f12,%f4 +/* 0x0170 174 */ add %g4,%g3,%g3 +/* 0x0174 */ ldx [%sp+336],%g4 +/* 0x0178 173 */ fmuld %f10,%f6,%f10 +/* 0x017c */ fdtox %f8,%f8 +/* 0x0180 */ std %f8,[%sp+328] +/* 0x0184 174 */ add %g4,%o0,%g4 +/* 0x0188 */ add %g2,%g5,%g2 +/* 0x018c */ st %g3,[%i4+8] +/* 0x0190 173 */ fmuld %f4,%f6,%f4 +/* 0x0194 174 */ srax %g3,32,%o0 +/* 0x0198 */ ldx [%sp+328],%g5 +/* 0x019c 173 */ fdtox %f10,%f6 +/* 0x01a0 */ std %f6,[%sp+320] +/* 0x01a4 174 */ add %g2,%o0,%g2 +/* 0x01a8 */ srax %g2,32,%g3 +/* 0x01ac */ st %g2,[%i4+12] +/* 0x01b0 */ add %g5,%o1,%o1 +/* 0x01b4 173 */ fdtox %f4,%f4 +/* 0x01b8 */ std %f4,[%sp+312] +/* 0x01bc 174 */ add %g4,%g3,%g3 +/* 0x01c0 */ srax %g3,32,%g4 +/* 0x01c4 */ st %g3,[%i4+16] +/* 0x01c8 */ ldx [%sp+320],%o0 +/* 0x01cc */ add %o1,%g4,%g4 +/* 0x01d0 */ ldx [%sp+312],%g5 +/* 0x01d4 */ srax %g4,32,%g2 +/* 0x01d8 */ add %o0,%o2,%o2 +/* 0x01dc */ st %g4,[%i4+20] +/* 0x01e0 */ add %o2,%g2,%g2 +/* 0x01e4 */ add %g5,%o3,%g5 +/* 0x01e8 */ st %g2,[%i4+24] +/* 0x01ec */ srax %g2,32,%g3 +/* 0x01f0 */ add %g5,%g3,%g2 +/* 0x01f4 */ st %g2,[%i4+28] + +! 176 ! return c; + +/* 0x01f8 176 */ srax %g2,32,%i0 +/* 0x01fc */ ret ! Result = %i0 +/* 0x0200 */ restore %g0,%g0,%g0 + .L77000051: + +! 178 ! } else if (n == 16) { + +/* 0x0204 178 */ cmp %o2,16 +/* 0x0208 */ bne,pn %icc,.L77000112 +/* 0x020c */ ld [%fp+84],%f7 +/* 0x0210 */ ldd [%o7],%f4 + +! 179 ! DEF_VARS(16); + +/* 0x0214 179 */ ldd [%o1],%f8 + +! 180 ! t_s32 c = 0; +! 182 ! MUL_U32_S64_8(0); + +/* 0x0218 182 */ ldd [%o1+8],%f14 +/* 0x021c */ fxnor %f30,%f4,%f4 +/* 0x0220 */ ldd [%o7+8],%f10 +/* 0x0224 */ ldd [%o7+16],%f16 +/* 0x0228 */ fitod %f4,%f12 +/* 0x022c */ ldd [%o7+24],%f18 +/* 0x0230 */ fitod %f5,%f4 +/* 0x0234 */ ldd [%o7+32],%f20 +/* 0x0238 */ fxnor %f30,%f10,%f10 +/* 0x023c */ ldd [%o7+40],%f22 +/* 0x0240 */ fxnor %f30,%f16,%f16 +/* 0x0244 */ ldd [%o7+48],%f0 +/* 0x0248 */ fitod %f10,%f24 +/* 0x024c */ ldd [%o7+56],%f26 +/* 0x0250 */ fsubd %f14,%f4,%f4 + +! 183 ! MUL_U32_S64_8(4); +! 184 ! ADD_S64_U32_8(0); +! 185 ! ADD_S64_U32_8(8); + +/* 0x0254 185 */ ld [%i1+36],%o5 +/* 0x0258 182 */ fitod %f11,%f10 +/* 0x025c 184 */ ld [%i1],%g2 +/* 0x0260 182 */ fsubd %f14,%f24,%f24 +/* 0x0264 185 */ stx %o5,[%sp+312] +/* 0x0268 182 */ fitod %f16,%f28 +/* 0x026c 184 */ ld [%i1+4],%g3 +/* 0x0270 182 */ fsubd %f14,%f10,%f10 +/* 0x0274 185 */ ld [%i1+40],%o5 +/* 0x0278 */ fxnor %f30,%f20,%f20 +/* 0x027c 184 */ ld [%i1+8],%g4 +/* 0x0280 */ stx %o5,[%sp+320] +/* 0x0284 */ ld [%i1+12],%g5 +/* 0x0288 */ ld [%i1+16],%o0 +/* 0x028c 179 */ fmovs %f8,%f6 +/* 0x0290 184 */ ld [%i1+20],%o1 +/* 0x0294 185 */ ld [%i1+32],%o4 +/* 0x0298 179 */ fsubd %f6,%f8,%f6 +/* 0x029c 184 */ ld [%i1+24],%o2 +/* 0x02a0 182 */ fsubd %f14,%f12,%f8 +/* 0x02a4 185 */ stx %o4,[%sp+328] +/* 0x02a8 */ fxnor %f30,%f0,%f12 +/* 0x02ac 184 */ ld [%i1+28],%o3 +/* 0x02b0 182 */ fmuld %f4,%f6,%f4 +/* 0x02b4 185 */ ld [%i1+44],%o4 +/* 0x02b8 182 */ fmuld %f8,%f6,%f8 +/* 0x02bc */ fmuld %f24,%f6,%f24 +/* 0x02c0 185 */ stx %o4,[%sp+360] +/* 0x02c4 182 */ fdtox %f4,%f4 +/* 0x02c8 */ fmuld %f10,%f6,%f10 +/* 0x02cc */ std %f4,[%sp+496] +/* 0x02d0 */ fdtox %f8,%f8 +/* 0x02d4 */ std %f8,[%sp+504] +/* 0x02d8 */ fitod %f17,%f8 +/* 0x02dc 185 */ ld [%i1+60],%o4 +/* 0x02e0 */ fxnor %f30,%f18,%f16 +/* 0x02e4 182 */ fdtox %f24,%f24 +/* 0x02e8 */ std %f24,[%sp+488] +/* 0x02ec 184 */ ldx [%sp+504],%o7 +/* 0x02f0 182 */ fsubd %f14,%f28,%f4 +/* 0x02f4 */ fitod %f16,%f18 +/* 0x02f8 */ fsubd %f14,%f8,%f8 +/* 0x02fc 184 */ add %o7,%g2,%g2 +/* 0x0300 */ st %g2,[%i4] +/* 0x0304 */ ldx [%sp+496],%o7 +/* 0x0308 182 */ fitod %f17,%f16 +/* 0x030c 184 */ srax %g2,32,%o5 +/* 0x0310 182 */ fmuld %f4,%f6,%f4 +/* 0x0314 */ fsubd %f14,%f18,%f18 +/* 0x0318 */ fdtox %f10,%f10 +/* 0x031c */ std %f10,[%sp+480] +/* 0x0320 184 */ add %o7,%g3,%g3 +/* 0x0324 182 */ fmuld %f8,%f6,%f24 +/* 0x0328 183 */ fitod %f20,%f8 +/* 0x032c 184 */ add %g3,%o5,%g3 +/* 0x0330 185 */ ld [%i1+48],%o5 +/* 0x0334 184 */ st %g3,[%i4+4] +/* 0x0338 182 */ fdtox %f4,%f4 +/* 0x033c */ fmuld %f18,%f6,%f10 +/* 0x0340 184 */ ldx [%sp+488],%o7 +/* 0x0344 */ fxnor %f30,%f22,%f18 +/* 0x0348 182 */ std %f4,[%sp+472] +/* 0x034c */ fsubd %f14,%f16,%f4 +/* 0x0350 184 */ stx %o5,[%sp+344] +/* 0x0354 183 */ fitod %f21,%f16 +/* 0x0358 184 */ srax %g3,32,%o5 +/* 0x035c 183 */ fsubd %f14,%f8,%f8 +/* 0x0360 184 */ add %o7,%g4,%g4 +/* 0x0364 185 */ ld [%i1+52],%o7 +/* 0x0368 182 */ fdtox %f24,%f20 +/* 0x036c */ std %f20,[%sp+464] +/* 0x0370 184 */ add %g4,%o5,%g4 +/* 0x0374 182 */ fmuld %f4,%f6,%f4 +/* 0x0378 184 */ stx %o7,[%sp+336] +/* 0x037c 182 */ fdtox %f10,%f10 +/* 0x0380 184 */ ldx [%sp+480],%o7 +/* 0x0384 183 */ fitod %f18,%f20 +/* 0x0388 */ fmuld %f8,%f6,%f8 +/* 0x038c 182 */ std %f10,[%sp+456] +/* 0x0390 183 */ fsubd %f14,%f16,%f10 +/* 0x0394 185 */ ld [%i1+56],%o5 +/* 0x0398 183 */ fitod %f19,%f16 +/* 0x039c 184 */ add %o7,%g5,%g5 +/* 0x03a0 */ ldx [%sp+472],%o7 +/* 0x03a4 182 */ fdtox %f4,%f4 +/* 0x03a8 184 */ stx %o5,[%sp+352] +/* 0x03ac */ srax %g4,32,%o5 +/* 0x03b0 183 */ fdtox %f8,%f8 +/* 0x03b4 182 */ std %f4,[%sp+448] +/* 0x03b8 183 */ fitod %f12,%f18 +/* 0x03bc 184 */ add %g5,%o5,%g5 +/* 0x03c0 183 */ fmuld %f10,%f6,%f4 +/* 0x03c4 184 */ ldx [%sp+464],%o5 +/* 0x03c8 183 */ fsubd %f14,%f20,%f10 +/* 0x03cc 184 */ add %o7,%o0,%o0 +/* 0x03d0 183 */ std %f8,[%sp+440] +/* 0x03d4 184 */ srax %g5,32,%o7 +/* 0x03d8 183 */ fsubd %f14,%f16,%f8 +/* 0x03dc 184 */ ldx [%sp+456],%g2 +/* 0x03e0 183 */ fdtox %f4,%f4 +/* 0x03e4 184 */ add %o0,%o7,%o0 +/* 0x03e8 183 */ std %f4,[%sp+432] +/* 0x03ec */ fxnor %f30,%f26,%f16 +/* 0x03f0 184 */ add %o5,%o1,%o1 +/* 0x03f4 183 */ fmuld %f10,%f6,%f10 +/* 0x03f8 184 */ ldx [%sp+448],%o7 +/* 0x03fc */ srax %o0,32,%o5 +/* 0x0400 183 */ fitod %f13,%f12 +/* 0x0404 */ fmuld %f8,%f6,%f4 +/* 0x0408 184 */ st %g4,[%i4+8] +/* 0x040c 183 */ fsubd %f14,%f18,%f8 +/* 0x0410 184 */ add %o1,%o5,%g3 +/* 0x0414 185 */ ldx [%sp+440],%o1 +/* 0x0418 183 */ fitod %f16,%f18 +/* 0x041c 184 */ add %g2,%o2,%g2 +/* 0x0420 */ st %g5,[%i4+12] +/* 0x0424 */ srax %g3,32,%o2 +/* 0x0428 183 */ fdtox %f10,%f10 +/* 0x042c */ std %f10,[%sp+424] +/* 0x0430 */ fsubd %f14,%f12,%f10 +/* 0x0434 184 */ add %g2,%o2,%o2 +/* 0x0438 183 */ fmuld %f8,%f6,%f8 +/* 0x043c 185 */ ldx [%sp+328],%g2 +/* 0x0440 183 */ fdtox %f4,%f4 +/* 0x0444 184 */ add %o7,%o3,%g4 +/* 0x0448 183 */ std %f4,[%sp+416] +/* 0x044c 184 */ srax %o2,32,%o3 +/* 0x0450 183 */ fitod %f17,%f12 +/* 0x0454 185 */ ldx [%sp+432],%g5 +/* 0x0458 184 */ add %g4,%o3,%o3 +/* 0x045c 185 */ add %o1,%g2,%o1 +/* 0x0460 183 */ fsubd %f14,%f18,%f4 +/* 0x0464 185 */ ldx [%sp+312],%o5 +/* 0x0468 */ srax %o3,32,%g4 +/* 0x046c 183 */ fdtox %f8,%f8 +/* 0x0470 */ fmuld %f10,%f6,%f10 +/* 0x0474 */ std %f8,[%sp+408] +/* 0x0478 185 */ add %o1,%g4,%o1 +/* 0x047c 183 */ fsubd %f14,%f12,%f8 +/* 0x0480 185 */ ldx [%sp+424],%o7 +/* 0x0484 */ add %g5,%o5,%g2 +/* 0x0488 183 */ fmuld %f4,%f6,%f4 +/* 0x048c 185 */ ldx [%sp+320],%g4 +/* 0x0490 */ srax %o1,32,%g5 +/* 0x0494 183 */ fdtox %f10,%f10 +/* 0x0498 184 */ st %g3,[%i4+20] +/* 0x049c 185 */ add %g2,%g5,%g2 +/* 0x04a0 183 */ fmuld %f8,%f6,%f6 +/* 0x04a4 185 */ ldx [%sp+360],%o5 +/* 0x04a8 */ srax %g2,32,%g5 +/* 0x04ac */ add %o7,%g4,%g4 +/* 0x04b0 */ ldx [%sp+416],%g3 +/* 0x04b4 */ add %g4,%g5,%g4 +/* 0x04b8 183 */ fdtox %f4,%f4 +/* 0x04bc */ std %f10,[%sp+400] +/* 0x04c0 184 */ st %o0,[%i4+16] +/* 0x04c4 185 */ add %g3,%o5,%g3 +/* 0x04c8 183 */ std %f4,[%sp+392] +/* 0x04cc 185 */ srax %g4,32,%o5 +/* 0x04d0 183 */ fdtox %f6,%f4 +/* 0x04d4 185 */ ldx [%sp+344],%o7 +/* 0x04d8 */ add %g3,%o5,%g3 +/* 0x04dc */ stx %g3,[%sp+368] +/* 0x04e0 */ srax %g3,32,%o5 +/* 0x04e4 */ ldx [%sp+408],%o0 +/* 0x04e8 */ ldx [%sp+400],%g5 +/* 0x04ec */ ldx [%sp+336],%g3 +/* 0x04f0 */ add %o0,%o7,%o0 +/* 0x04f4 183 */ std %f4,[%sp+384] +/* 0x04f8 185 */ add %g5,%g3,%g3 +/* 0x04fc */ add %o0,%o5,%g5 +/* 0x0500 */ stx %g5,[%sp+376] +/* 0x0504 */ ldx [%sp+392],%o7 +/* 0x0508 */ srax %g5,32,%o0 +/* 0x050c */ ldx [%sp+352],%g5 +/* 0x0510 */ add %g3,%o0,%g3 +/* 0x0514 */ ldx [%sp+384],%o5 +/* 0x0518 */ add %o7,%g5,%g5 +/* 0x051c 184 */ st %o2,[%i4+24] +/* 0x0520 185 */ srax %g3,32,%o2 +/* 0x0524 */ st %o1,[%i4+32] +/* 0x0528 */ add %g5,%o2,%g5 +/* 0x052c */ add %o5,%o4,%o0 +/* 0x0530 */ st %g2,[%i4+36] +/* 0x0534 */ srax %g5,32,%g2 +/* 0x0538 */ ldx [%sp+368],%o1 +/* 0x053c */ ldx [%sp+376],%o2 +/* 0x0540 */ st %g4,[%i4+40] +/* 0x0544 */ add %o0,%g2,%g4 +/* 0x0548 184 */ st %o3,[%i4+28] + +! 187 ! return c; + +/* 0x054c 187 */ srax %g4,32,%i0 +/* 0x0550 185 */ st %o1,[%i4+44] +/* 0x0554 */ st %o2,[%i4+48] +/* 0x0558 */ st %g3,[%i4+52] +/* 0x055c */ st %g5,[%i4+56] +/* 0x0560 */ st %g4,[%i4+60] +/* 0x0564 */ ret ! Result = %i0 +/* 0x0568 */ restore %g0,%g0,%g0 + .L77000112: + +! 189 ! } else { +! 190 ! DEF_VARS(BUFF_SIZE); + +/* 0x056c 190 */ ldd [%o1],%f8 + +! 191 ! t_s32 i, c = 0; +! 193 !#pragma pipeloop(0) +! 194 ! for (i = 0; i < (n+1)/2; i ++) { + +/* 0x0570 194 */ add %o2,1,%g2 +/* 0x0574 191 */ or %g0,0,%i0 +/* 0x0578 194 */ srl %g2,31,%g3 +/* 0x057c 190 */ ldd [%o1+8],%f18 +/* 0x0580 187 */ or %g0,%o7,%g4 +/* 0x0584 190 */ fmovs %f8,%f6 +/* 0x0588 194 */ add %g2,%g3,%g2 +/* 0x058c 187 */ add %fp,-2264,%g3 +/* 0x0590 194 */ sra %g2,1,%o0 +/* 0x0594 187 */ add %fp,-2256,%o7 +/* 0x0598 190 */ fsubd %f6,%f8,%f16 +/* 0x059c 194 */ cmp %o0,0 +/* 0x05a0 */ ble,pt %icc,.L900000199 +/* 0x05a4 */ cmp %o3,0 +/* 0x05a8 187 */ sub %o0,1,%g2 +/* 0x05ac */ add %g2,1,%o1 +/* 0x05b0 194 */ or %g0,0,%o0 +/* 0x05b4 */ cmp %o1,8 +/* 0x05b8 */ bl,pn %icc,.L77000113 +/* 0x05bc */ sub %g2,2,%o2 +/* 0x05c0 */ ldd [%g4],%f2 + +! 195 ! MUL_U32_S64_2(i); + +/* 0x05c4 195 */ or %g0,5,%o0 +/* 0x05c8 */ ldd [%g4+8],%f0 +/* 0x05cc */ add %g4,24,%o1 +/* 0x05d0 */ add %g4,16,%g4 +/* 0x05d4 */ fxnor %f30,%f2,%f4 +/* 0x05d8 */ ldd [%g4],%f2 +/* 0x05dc */ fxnor %f30,%f0,%f6 +/* 0x05e0 */ ldd [%g4+8],%f10 +/* 0x05e4 */ add %g4,16,%o1 +/* 0x05e8 */ fitod %f5,%f0 +/* 0x05ec */ ldd [%g4+16],%f12 +/* 0x05f0 */ fitod %f4,%f4 +/* 0x05f4 */ fxnor %f30,%f2,%f8 +/* 0x05f8 */ fitod %f7,%f2 +/* 0x05fc */ fsubd %f18,%f0,%f0 +/* 0x0600 */ fsubd %f18,%f4,%f4 +/* 0x0604 */ fxnor %f30,%f10,%f10 + .L900000177: +/* 0x0608 195 */ fitod %f9,%f22 +/* 0x060c */ add %o0,3,%o0 +/* 0x0610 */ add %o7,48,%o7 +/* 0x0614 */ fmuld %f0,%f16,%f0 +/* 0x0618 */ fmuld %f4,%f16,%f24 +/* 0x061c */ cmp %o0,%o2 +/* 0x0620 */ add %g3,48,%g3 +/* 0x0624 */ fsubd %f18,%f2,%f2 +/* 0x0628 */ fitod %f6,%f4 +/* 0x062c */ fdtox %f0,%f0 +/* 0x0630 */ ldd [%o1+8],%f20 +/* 0x0634 */ fdtox %f24,%f6 +/* 0x0638 */ fsubd %f18,%f4,%f4 +/* 0x063c */ std %f6,[%g3-48] +/* 0x0640 */ fxnor %f30,%f12,%f6 +/* 0x0644 */ std %f0,[%o7-48] +/* 0x0648 */ fitod %f11,%f0 +/* 0x064c */ fmuld %f2,%f16,%f2 +/* 0x0650 */ fmuld %f4,%f16,%f24 +/* 0x0654 */ fsubd %f18,%f22,%f12 +/* 0x0658 */ fitod %f8,%f4 +/* 0x065c */ fdtox %f2,%f2 +/* 0x0660 */ add %o1,16,%o1 +/* 0x0664 */ ldd [%o1],%f22 +/* 0x0668 */ fdtox %f24,%f8 +/* 0x066c */ fsubd %f18,%f4,%f4 +/* 0x0670 */ std %f8,[%g3-32] +/* 0x0674 */ fxnor %f30,%f20,%f8 +/* 0x0678 */ std %f2,[%o7-32] +/* 0x067c */ fitod %f7,%f2 +/* 0x0680 */ fmuld %f12,%f16,%f12 +/* 0x0684 */ fmuld %f4,%f16,%f24 +/* 0x0688 */ fsubd %f18,%f0,%f0 +/* 0x068c */ fitod %f10,%f4 +/* 0x0690 */ fdtox %f12,%f20 +/* 0x0694 */ add %o1,8,%o1 +/* 0x0698 */ ldd [%o1],%f12 +/* 0x069c */ fdtox %f24,%f10 +/* 0x06a0 */ fsubd %f18,%f4,%f4 +/* 0x06a4 */ std %f10,[%g3-16] +/* 0x06a8 */ fxnor %f30,%f22,%f10 +/* 0x06ac */ ble,pt %icc,.L900000177 +/* 0x06b0 */ std %f20,[%o7-16] + .L900000180: +/* 0x06b4 195 */ fitod %f6,%f6 +/* 0x06b8 */ fmuld %f4,%f16,%f24 +/* 0x06bc */ add %g3,80,%g3 +/* 0x06c0 */ fsubd %f18,%f2,%f2 +/* 0x06c4 */ fmuld %f0,%f16,%f22 +/* 0x06c8 */ add %o7,80,%o7 +/* 0x06cc */ fitod %f8,%f26 +/* 0x06d0 */ cmp %o0,%g2 +/* 0x06d4 */ add %o1,8,%g4 +/* 0x06d8 */ fsubd %f18,%f6,%f4 +/* 0x06dc */ fitod %f9,%f8 +/* 0x06e0 */ fxnor %f30,%f12,%f0 +/* 0x06e4 */ fmuld %f2,%f16,%f12 +/* 0x06e8 */ fitod %f10,%f6 +/* 0x06ec */ fmuld %f4,%f16,%f20 +/* 0x06f0 */ fitod %f11,%f4 +/* 0x06f4 */ fsubd %f18,%f26,%f10 +/* 0x06f8 */ fitod %f0,%f2 +/* 0x06fc */ fsubd %f18,%f8,%f8 +/* 0x0700 */ fitod %f1,%f0 +/* 0x0704 */ fmuld %f10,%f16,%f10 +/* 0x0708 */ fdtox %f24,%f24 +/* 0x070c */ std %f24,[%g3-80] +/* 0x0710 */ fsubd %f18,%f6,%f6 +/* 0x0714 */ fmuld %f8,%f16,%f8 +/* 0x0718 */ fdtox %f22,%f22 +/* 0x071c */ std %f22,[%o7-80] +/* 0x0720 */ fsubd %f18,%f4,%f4 +/* 0x0724 */ fdtox %f20,%f20 +/* 0x0728 */ std %f20,[%g3-64] +/* 0x072c */ fmuld %f6,%f16,%f6 +/* 0x0730 */ fsubd %f18,%f2,%f2 +/* 0x0734 */ fsubd %f18,%f0,%f0 +/* 0x0738 */ fmuld %f4,%f16,%f4 +/* 0x073c */ fdtox %f12,%f12 +/* 0x0740 */ std %f12,[%o7-64] +/* 0x0744 */ fdtox %f10,%f10 +/* 0x0748 */ std %f10,[%g3-48] +/* 0x074c */ fmuld %f2,%f16,%f2 +/* 0x0750 */ fdtox %f8,%f8 +/* 0x0754 */ std %f8,[%o7-48] +/* 0x0758 */ fmuld %f0,%f16,%f0 +/* 0x075c */ fdtox %f6,%f6 +/* 0x0760 */ std %f6,[%g3-32] +/* 0x0764 */ fdtox %f4,%f4 +/* 0x0768 */ std %f4,[%o7-32] +/* 0x076c */ fdtox %f2,%f2 +/* 0x0770 */ std %f2,[%g3-16] +/* 0x0774 */ fdtox %f0,%f0 +/* 0x0778 */ bg,pn %icc,.L77000057 +/* 0x077c */ std %f0,[%o7-16] + .L77000113: +/* 0x0780 */ ldd [%g4],%f0 + .L900000198: +/* 0x0784 */ fxnor %f30,%f0,%f0 +/* 0x0788 195 */ add %o0,1,%o0 +/* 0x078c */ add %g4,8,%g4 +/* 0x0790 */ cmp %o0,%g2 +/* 0x0794 */ fitod %f0,%f2 +/* 0x0798 */ fitod %f1,%f0 +/* 0x079c */ fsubd %f18,%f2,%f2 +/* 0x07a0 */ fsubd %f18,%f0,%f0 +/* 0x07a4 */ fmuld %f2,%f16,%f2 +/* 0x07a8 */ fmuld %f0,%f16,%f0 +/* 0x07ac */ fdtox %f2,%f2 +/* 0x07b0 */ std %f2,[%g3] +/* 0x07b4 */ add %g3,16,%g3 +/* 0x07b8 */ fdtox %f0,%f0 +/* 0x07bc */ std %f0,[%o7] +/* 0x07c0 */ add %o7,16,%o7 +/* 0x07c4 */ ble,a,pt %icc,.L900000198 +/* 0x07c8 */ ldd [%g4],%f0 + .L77000057: + +! 196 ! } +! 198 !#pragma pipeloop(0) +! 199 ! for (i = 0; i < n; i ++) { + +/* 0x07cc 199 */ cmp %o3,0 + .L900000199: +/* 0x07d0 199 */ ble,pt %icc,.L77000089 +/* 0x07d4 */ nop +/* 0x07d8 */ or %g0,%o4,%g2 +/* 0x07dc */ or %g0,%o5,%o4 +/* 0x07e0 */ sub %o3,1,%o7 +/* 0x07e4 */ or %g0,0,%g4 +/* 0x07e8 */ add %fp,-2264,%g3 +/* 0x07ec 195 */ cmp %o3,5 +/* 0x07f0 */ sub %o3,3,%o3 +/* 0x07f4 */ bl,pn %icc,.L77000114 +/* 0x07f8 */ ldx [%fp-2264],%o0 + +! 200 ! ADD_S64_U32(i); + +/* 0x07fc 200 */ add %o5,4,%o4 +/* 0x0800 0 */ add %fp,-2248,%g3 +/* 0x0804 200 */ ld [%g2],%o1 +/* 0x0808 */ sra %i0,0,%o5 +/* 0x080c */ or %g0,2,%g4 +/* 0x0810 */ ld [%g2+4],%o2 +/* 0x0814 */ add %g2,8,%g2 +/* 0x0818 */ add %o0,%o1,%o0 +/* 0x081c */ ldx [%fp-2256],%o1 +/* 0x0820 */ add %o0,%o5,%o0 +/* 0x0824 */ st %o0,[%o4-4] +/* 0x0828 */ srax %o0,32,%o0 + .L900000173: +/* 0x082c 200 */ ldx [%g3],%g5 +/* 0x0830 */ sra %o0,0,%o5 +/* 0x0834 */ add %o1,%o2,%o0 +/* 0x0838 */ ld [%g2],%o1 +/* 0x083c */ add %o0,%o5,%o0 +/* 0x0840 */ add %g4,3,%g4 +/* 0x0844 */ st %o0,[%o4] +/* 0x0848 */ srax %o0,32,%i0 +/* 0x084c */ cmp %g4,%o3 +/* 0x0850 */ ldx [%g3+8],%o0 +/* 0x0854 */ sra %i0,0,%o5 +/* 0x0858 */ add %g5,%o1,%o1 +/* 0x085c */ ld [%g2+4],%o2 +/* 0x0860 */ add %o1,%o5,%o1 +/* 0x0864 */ add %o4,12,%o4 +/* 0x0868 */ st %o1,[%o4-8] +/* 0x086c */ srax %o1,32,%o5 +/* 0x0870 */ add %g2,12,%g2 +/* 0x0874 */ ldx [%g3+16],%o1 +/* 0x0878 */ add %o0,%o2,%o0 +/* 0x087c */ ld [%g2-4],%o2 +/* 0x0880 */ add %o0,%o5,%o0 +/* 0x0884 */ add %g3,24,%g3 +/* 0x0888 */ st %o0,[%o4-4] +/* 0x088c */ ble,pt %icc,.L900000173 +/* 0x0890 */ srax %o0,32,%o0 + .L900000176: +/* 0x0894 200 */ sra %o0,0,%o3 +/* 0x0898 */ add %o1,%o2,%o0 +/* 0x089c */ add %o0,%o3,%o0 +/* 0x08a0 */ add %o4,4,%o4 +/* 0x08a4 */ st %o0,[%o4-4] +/* 0x08a8 */ cmp %g4,%o7 +/* 0x08ac */ bg,pn %icc,.L77000089 +/* 0x08b0 */ srax %o0,32,%i0 + .L77000114: +/* 0x08b4 200 */ ld [%g2],%o2 + .L900000197: +/* 0x08b8 200 */ ldx [%g3],%o0 +/* 0x08bc */ sra %i0,0,%o1 +/* 0x08c0 */ add %g4,1,%g4 +/* 0x08c4 */ add %g2,4,%g2 +/* 0x08c8 */ add %g3,8,%g3 +/* 0x08cc */ add %o0,%o2,%o0 +/* 0x08d0 */ cmp %g4,%o7 +/* 0x08d4 */ add %o0,%o1,%o0 +/* 0x08d8 */ st %o0,[%o4] +/* 0x08dc */ add %o4,4,%o4 +/* 0x08e0 */ srax %o0,32,%i0 +/* 0x08e4 */ ble,a,pt %icc,.L900000197 +/* 0x08e8 */ ld [%g2],%o2 + .L77000061: +/* 0x08ec */ ret ! Result = %i0 +/* 0x08f0 */ restore %g0,%g0,%g0 + .L77000062: +/* 0x08f4 */ sethi %hi(0x80000000),%g2 + +! 201 ! } +! 203 ! return c; +! 205 ! } +! 206 ! } else if (a < (1u << 31)) { +! 208 ! if (n == 8) { +! 209 ! DEF_VARS(2*8); +! 210 ! t_d64 d0, d1, db; +! 211 ! t_s32 c = 0; +! 213 ! da = (t_d64)(a & A_MASK); + +/* 0x08f8 213 */ ldd [%o1],%f6 +/* 0x08fc 206 */ cmp %o0,%g2 +/* 0x0900 */ bcc,pn %icc,.L77000076 +/* 0x0904 */ cmp %o2,8 +/* 0x0908 208 */ bne,pn %icc,.L77000065 +/* 0x090c */ sethi %hi(0xffe00000),%g2 +/* 0x0910 213 */ fmovs %f6,%f10 +/* 0x0914 */ ldd [%o7],%f4 + +! 214 ! db = (t_d64)(a &~ A_MASK); + +/* 0x0918 214 */ fmovs %f6,%f12 +/* 0x091c */ or %g0,%g2,%g3 +/* 0x0920 */ ldd [%o7+8],%f14 +/* 0x0924 213 */ andn %o0,%g2,%g2 +/* 0x0928 214 */ and %o0,%g3,%g3 +/* 0x092c 213 */ st %g2,[%sp+460] +/* 0x0930 */ fxnor %f30,%f4,%f4 +/* 0x0934 214 */ st %g3,[%sp+456] +/* 0x0938 */ fxnor %f30,%f14,%f14 + +! 216 ! MUL_U32_S64_D_8(0); + +/* 0x093c 216 */ ldd [%o1+8],%f16 +/* 0x0940 */ fitod %f4,%f8 +/* 0x0944 */ ldd [%o7+16],%f18 +/* 0x0948 */ fitod %f5,%f4 +/* 0x094c */ ldd [%o7+24],%f20 +/* 0x0950 213 */ ld [%sp+460],%f11 +/* 0x0954 216 */ fsubd %f16,%f8,%f8 +/* 0x0958 214 */ ld [%sp+456],%f13 +/* 0x095c 216 */ fsubd %f16,%f4,%f4 + +! 217 ! ADD_S64_U32_D_8(0); + +/* 0x0960 217 */ ld [%i1],%g2 +/* 0x0964 213 */ fsubd %f10,%f6,%f10 +/* 0x0968 217 */ ld [%i1+28],%o3 +/* 0x096c 214 */ fsubd %f12,%f6,%f6 +/* 0x0970 217 */ ld [%i1+4],%g3 +/* 0x0974 216 */ fitod %f14,%f12 +/* 0x0978 217 */ stx %o3,[%sp+312] +/* 0x097c 216 */ fitod %f15,%f14 +/* 0x0980 */ fmuld %f4,%f10,%f24 +/* 0x0984 217 */ ld [%i1+8],%g4 +/* 0x0988 */ fxnor %f30,%f18,%f18 +/* 0x098c 216 */ fmuld %f8,%f10,%f22 +/* 0x0990 217 */ ld [%i1+12],%g5 +/* 0x0994 216 */ fsubd %f16,%f12,%f12 +/* 0x0998 */ fmuld %f4,%f6,%f4 +/* 0x099c 217 */ ld [%i1+16],%o0 +/* 0x09a0 216 */ fitod %f18,%f26 +/* 0x09a4 */ fmuld %f8,%f6,%f8 +/* 0x09a8 217 */ ld [%i1+20],%o1 +/* 0x09ac 216 */ fsubd %f16,%f14,%f14 +/* 0x09b0 217 */ ld [%i1+24],%o2 +/* 0x09b4 216 */ fdtox %f4,%f4 +/* 0x09b8 */ fmuld %f12,%f10,%f28 +/* 0x09bc */ std %f4,[%sp+424] +/* 0x09c0 */ fdtox %f8,%f8 +/* 0x09c4 */ fmuld %f12,%f6,%f12 +/* 0x09c8 */ std %f8,[%sp+440] +/* 0x09cc */ fsubd %f16,%f26,%f4 +/* 0x09d0 */ fitod %f19,%f8 +/* 0x09d4 */ fmuld %f14,%f10,%f18 +/* 0x09d8 */ fdtox %f12,%f12 +/* 0x09dc */ std %f12,[%sp+408] +/* 0x09e0 */ fmuld %f14,%f6,%f14 +/* 0x09e4 217 */ ldx [%sp+440],%o5 +/* 0x09e8 216 */ fdtox %f22,%f22 +/* 0x09ec */ fmuld %f4,%f10,%f12 +/* 0x09f0 */ std %f22,[%sp+448] +/* 0x09f4 */ fxnor %f30,%f20,%f20 +/* 0x09f8 */ fmuld %f4,%f6,%f4 +/* 0x09fc */ fdtox %f24,%f22 +/* 0x0a00 */ std %f22,[%sp+432] +/* 0x0a04 217 */ ldx [%sp+448],%o4 +/* 0x0a08 216 */ fsubd %f16,%f8,%f8 +/* 0x0a0c */ fitod %f20,%f22 +/* 0x0a10 */ fdtox %f14,%f14 +/* 0x0a14 */ std %f14,[%sp+392] +/* 0x0a18 217 */ add %o4,%o5,%o4 +/* 0x0a1c */ ldx [%sp+432],%o5 +/* 0x0a20 216 */ fdtox %f28,%f24 +/* 0x0a24 217 */ add %o4,%g2,%o4 +/* 0x0a28 216 */ fmuld %f8,%f10,%f14 +/* 0x0a2c */ std %f24,[%sp+416] +/* 0x0a30 217 */ srax %o4,32,%o7 +/* 0x0a34 216 */ fitod %f21,%f20 +/* 0x0a38 */ fmuld %f8,%f6,%f8 +/* 0x0a3c 217 */ stx %o4,[%sp+320] +/* 0x0a40 216 */ fdtox %f4,%f4 +/* 0x0a44 */ std %f4,[%sp+376] +/* 0x0a48 */ fdtox %f18,%f18 +/* 0x0a4c */ std %f18,[%sp+400] +/* 0x0a50 */ fsubd %f16,%f20,%f4 +/* 0x0a54 217 */ ldx [%sp+424],%g2 +/* 0x0a58 216 */ fsubd %f16,%f22,%f18 +/* 0x0a5c 217 */ ldx [%sp+416],%o3 +/* 0x0a60 216 */ fdtox %f12,%f12 +/* 0x0a64 */ std %f12,[%sp+384] +/* 0x0a68 217 */ add %o5,%g2,%g2 +/* 0x0a6c 216 */ fdtox %f14,%f14 +/* 0x0a70 217 */ ldx [%sp+408],%o4 +/* 0x0a74 */ add %g2,%g3,%g2 +/* 0x0a78 216 */ fdtox %f8,%f8 +/* 0x0a7c */ fmuld %f18,%f10,%f12 +/* 0x0a80 */ std %f14,[%sp+368] +/* 0x0a84 217 */ add %g2,%o7,%g2 +/* 0x0a88 216 */ fmuld %f4,%f10,%f14 +/* 0x0a8c */ std %f8,[%sp+360] +/* 0x0a90 217 */ srax %g2,32,%o5 +/* 0x0a94 */ add %o3,%o4,%o3 +/* 0x0a98 216 */ fmuld %f18,%f6,%f16 +/* 0x0a9c 217 */ ldx [%sp+392],%o4 +/* 0x0aa0 */ add %o3,%g4,%g4 +/* 0x0aa4 216 */ fmuld %f4,%f6,%f4 +/* 0x0aa8 217 */ ldx [%sp+400],%g3 +/* 0x0aac */ add %g4,%o5,%g4 +/* 0x0ab0 216 */ fdtox %f12,%f6 +/* 0x0ab4 217 */ ldx [%sp+384],%o7 +/* 0x0ab8 */ ldx [%sp+376],%o3 +/* 0x0abc */ add %g3,%o4,%g3 +/* 0x0ac0 216 */ fdtox %f4,%f4 +/* 0x0ac4 */ std %f6,[%sp+352] +/* 0x0ac8 217 */ srax %g4,32,%o4 +/* 0x0acc */ add %g3,%g5,%g3 +/* 0x0ad0 */ ldx [%sp+368],%g5 +/* 0x0ad4 */ add %o7,%o3,%o3 +/* 0x0ad8 */ add %g3,%o4,%g3 +/* 0x0adc 216 */ std %f4,[%sp+328] +/* 0x0ae0 217 */ srax %g3,32,%o4 +/* 0x0ae4 */ add %o3,%o0,%o0 +/* 0x0ae8 */ ldx [%sp+360],%o3 +/* 0x0aec */ add %o0,%o4,%o4 +/* 0x0af0 216 */ fdtox %f16,%f6 +/* 0x0af4 */ std %f6,[%sp+344] +/* 0x0af8 */ fdtox %f14,%f6 +/* 0x0afc */ std %f6,[%sp+336] +/* 0x0b00 217 */ add %g5,%o3,%o3 +/* 0x0b04 */ ldx [%sp+352],%o5 +/* 0x0b08 */ srax %o4,32,%g5 +/* 0x0b0c */ add %o3,%o1,%o1 +/* 0x0b10 */ st %g2,[%i4+4] +/* 0x0b14 */ add %o1,%g5,%o1 +/* 0x0b18 */ ldx [%sp+344],%o7 +/* 0x0b1c */ ldx [%sp+320],%g5 +/* 0x0b20 */ ldx [%sp+336],%o3 +/* 0x0b24 */ add %o5,%o7,%o0 +/* 0x0b28 */ ldx [%sp+328],%o5 +/* 0x0b2c */ add %o0,%o2,%o2 +/* 0x0b30 */ st %g5,[%i4] +/* 0x0b34 */ srax %o1,32,%g5 +/* 0x0b38 */ ldx [%sp+312],%o7 +/* 0x0b3c */ add %o2,%g5,%o2 +/* 0x0b40 */ add %o3,%o5,%o3 +/* 0x0b44 */ st %o4,[%i4+16] +/* 0x0b48 */ srax %o2,32,%g2 +/* 0x0b4c */ st %o1,[%i4+20] +/* 0x0b50 */ add %o3,%o7,%o3 +/* 0x0b54 */ st %o2,[%i4+24] +/* 0x0b58 */ add %o3,%g2,%g2 +/* 0x0b5c */ st %g4,[%i4+8] + +! 219 ! return c; + +/* 0x0b60 219 */ srax %g2,32,%i0 +/* 0x0b64 217 */ st %g3,[%i4+12] +/* 0x0b68 */ st %g2,[%i4+28] +/* 0x0b6c */ ret ! Result = %i0 +/* 0x0b70 */ restore %g0,%g0,%g0 + .L77000065: + +! 221 ! } else if (n == 16) { + +/* 0x0b74 221 */ cmp %o2,16 +/* 0x0b78 */ bne,pn %icc,.L77000109 +/* 0x0b7c */ sethi %hi(0xffe00000),%g2 +/* 0x0b80 */ ldd [%o7],%f4 + +! 222 ! DEF_VARS(2*16); +! 223 ! t_d64 d0, d1, db; +! 224 ! t_s32 c = 0; +! 226 ! da = (t_d64)(a & A_MASK); +! 227 ! db = (t_d64)(a &~ A_MASK); + +/* 0x0b84 227 */ or %g0,%g2,%g3 +/* 0x0b88 226 */ andn %o0,%g2,%g2 +/* 0x0b8c */ st %g2,[%sp+572] +/* 0x0b90 227 */ and %o0,%g3,%g3 +/* 0x0b94 */ fxnor %f30,%f4,%f4 +/* 0x0b98 226 */ ldd [%o1],%f8 +/* 0x0b9c 227 */ st %g3,[%sp+568] + +! 229 ! MUL_U32_S64_D_8(0); + +/* 0x0ba0 229 */ fitod %f4,%f10 +/* 0x0ba4 */ ldd [%o1+8],%f16 +/* 0x0ba8 */ ldd [%o7+8],%f14 +/* 0x0bac */ fitod %f5,%f4 +/* 0x0bb0 226 */ ld [%sp+572],%f7 +/* 0x0bb4 229 */ fsubd %f16,%f10,%f10 +/* 0x0bb8 227 */ ld [%sp+568],%f13 +/* 0x0bbc */ fxnor %f30,%f14,%f14 +/* 0x0bc0 229 */ fsubd %f16,%f4,%f4 +/* 0x0bc4 226 */ fmovs %f8,%f6 +/* 0x0bc8 227 */ fmovs %f8,%f12 +/* 0x0bcc 226 */ fsubd %f6,%f8,%f6 +/* 0x0bd0 227 */ fsubd %f12,%f8,%f8 +/* 0x0bd4 229 */ fitod %f14,%f12 +/* 0x0bd8 */ fmuld %f10,%f6,%f18 +/* 0x0bdc */ fitod %f15,%f14 +/* 0x0be0 */ fmuld %f10,%f8,%f10 +/* 0x0be4 */ fsubd %f16,%f12,%f12 +/* 0x0be8 */ fmuld %f4,%f6,%f20 +/* 0x0bec */ fmuld %f4,%f8,%f4 +/* 0x0bf0 */ fsubd %f16,%f14,%f14 +/* 0x0bf4 */ fdtox %f10,%f10 +/* 0x0bf8 */ std %f10,[%sp+552] +/* 0x0bfc */ fmuld %f12,%f6,%f10 +/* 0x0c00 */ fdtox %f18,%f18 +/* 0x0c04 */ std %f18,[%sp+560] +/* 0x0c08 */ fmuld %f12,%f8,%f12 +/* 0x0c0c */ fdtox %f4,%f4 +/* 0x0c10 */ std %f4,[%sp+536] +/* 0x0c14 */ fmuld %f14,%f6,%f4 +/* 0x0c18 */ fdtox %f20,%f18 +/* 0x0c1c */ std %f18,[%sp+544] +/* 0x0c20 */ fdtox %f10,%f10 +/* 0x0c24 */ std %f10,[%sp+528] +/* 0x0c28 */ fmuld %f14,%f8,%f14 +/* 0x0c2c */ fdtox %f12,%f12 +/* 0x0c30 */ std %f12,[%sp+520] +/* 0x0c34 */ ldd [%o7+16],%f10 +/* 0x0c38 */ fdtox %f4,%f4 +/* 0x0c3c */ ldd [%o7+24],%f12 +/* 0x0c40 */ fdtox %f14,%f14 +/* 0x0c44 */ std %f4,[%sp+512] +/* 0x0c48 */ fxnor %f30,%f10,%f10 +/* 0x0c4c */ fxnor %f30,%f12,%f4 +/* 0x0c50 */ std %f14,[%sp+504] +/* 0x0c54 */ fitod %f10,%f12 +/* 0x0c58 */ fitod %f11,%f10 +/* 0x0c5c */ fitod %f4,%f14 +/* 0x0c60 */ fsubd %f16,%f12,%f12 +/* 0x0c64 */ fsubd %f16,%f10,%f10 +/* 0x0c68 */ fitod %f5,%f4 +/* 0x0c6c */ fmuld %f12,%f6,%f18 +/* 0x0c70 */ fsubd %f16,%f14,%f14 +/* 0x0c74 */ fmuld %f10,%f6,%f20 +/* 0x0c78 */ fmuld %f12,%f8,%f12 +/* 0x0c7c */ fsubd %f16,%f4,%f4 +/* 0x0c80 */ fmuld %f10,%f8,%f10 +/* 0x0c84 */ fdtox %f18,%f18 +/* 0x0c88 */ std %f18,[%sp+496] +/* 0x0c8c */ fdtox %f20,%f18 +/* 0x0c90 */ std %f18,[%sp+480] +/* 0x0c94 */ fdtox %f12,%f12 +/* 0x0c98 */ std %f12,[%sp+488] +/* 0x0c9c */ fmuld %f14,%f6,%f12 +/* 0x0ca0 */ fdtox %f10,%f10 +/* 0x0ca4 */ std %f10,[%sp+472] +/* 0x0ca8 */ fmuld %f4,%f6,%f10 +/* 0x0cac */ fmuld %f4,%f8,%f4 +/* 0x0cb0 */ fdtox %f12,%f12 +/* 0x0cb4 */ std %f12,[%sp+464] +/* 0x0cb8 */ fmuld %f14,%f8,%f14 +/* 0x0cbc */ fdtox %f10,%f10 +/* 0x0cc0 */ std %f10,[%sp+448] +/* 0x0cc4 */ ldd [%o7+32],%f12 +/* 0x0cc8 */ fdtox %f4,%f4 +/* 0x0ccc */ std %f4,[%sp+440] +/* 0x0cd0 */ fdtox %f14,%f14 +/* 0x0cd4 */ fxnor %f30,%f12,%f12 +/* 0x0cd8 */ std %f14,[%sp+456] +/* 0x0cdc */ ldd [%o7+40],%f14 + +! 230 ! MUL_U32_S64_D_8(4); + +/* 0x0ce0 230 */ fitod %f12,%f4 +/* 0x0ce4 */ fitod %f13,%f12 +/* 0x0ce8 */ fxnor %f30,%f14,%f10 +/* 0x0cec */ fsubd %f16,%f4,%f4 +/* 0x0cf0 */ fsubd %f16,%f12,%f12 +/* 0x0cf4 */ fitod %f10,%f14 +/* 0x0cf8 */ fitod %f11,%f10 +/* 0x0cfc */ fmuld %f4,%f6,%f18 +/* 0x0d00 */ fmuld %f12,%f6,%f20 +/* 0x0d04 */ fsubd %f16,%f14,%f14 +/* 0x0d08 */ fmuld %f4,%f8,%f4 +/* 0x0d0c */ fsubd %f16,%f10,%f10 +/* 0x0d10 */ fmuld %f12,%f8,%f12 +/* 0x0d14 */ fdtox %f18,%f18 +/* 0x0d18 */ std %f18,[%sp+432] +/* 0x0d1c */ fdtox %f4,%f4 +/* 0x0d20 */ std %f4,[%sp+424] +/* 0x0d24 */ fdtox %f12,%f12 +/* 0x0d28 */ std %f12,[%sp+408] +/* 0x0d2c */ fmuld %f14,%f6,%f4 +/* 0x0d30 */ fdtox %f20,%f18 +/* 0x0d34 */ std %f18,[%sp+416] +/* 0x0d38 */ fmuld %f10,%f6,%f12 +/* 0x0d3c */ fmuld %f10,%f8,%f10 +/* 0x0d40 */ fdtox %f4,%f4 +/* 0x0d44 */ std %f4,[%sp+400] +/* 0x0d48 */ fmuld %f14,%f8,%f14 +/* 0x0d4c */ fdtox %f12,%f12 +/* 0x0d50 */ std %f12,[%sp+384] +/* 0x0d54 */ ldd [%o7+48],%f4 +/* 0x0d58 */ fdtox %f10,%f10 +/* 0x0d5c */ std %f10,[%sp+376] +/* 0x0d60 */ fdtox %f14,%f14 +/* 0x0d64 */ std %f14,[%sp+392] +/* 0x0d68 */ fxnor %f30,%f4,%f4 +/* 0x0d6c */ ldd [%o7+56],%f14 +/* 0x0d70 */ fitod %f4,%f10 +/* 0x0d74 */ fitod %f5,%f4 +/* 0x0d78 */ fxnor %f30,%f14,%f12 +/* 0x0d7c */ fsubd %f16,%f10,%f10 +/* 0x0d80 */ fsubd %f16,%f4,%f4 +/* 0x0d84 */ fitod %f12,%f14 +/* 0x0d88 */ fitod %f13,%f12 +/* 0x0d8c */ fmuld %f10,%f6,%f18 +/* 0x0d90 */ fmuld %f4,%f6,%f20 +/* 0x0d94 */ fsubd %f16,%f14,%f14 +/* 0x0d98 */ fmuld %f10,%f8,%f10 +/* 0x0d9c */ fdtox %f18,%f18 +/* 0x0da0 */ std %f18,[%sp+368] +/* 0x0da4 */ fmuld %f4,%f8,%f4 +/* 0x0da8 */ fdtox %f10,%f10 +/* 0x0dac */ std %f10,[%sp+360] +/* 0x0db0 */ fdtox %f20,%f10 +/* 0x0db4 */ std %f10,[%sp+352] +/* 0x0db8 */ fdtox %f4,%f4 +/* 0x0dbc */ std %f4,[%sp+344] +/* 0x0dc0 */ fmuld %f14,%f6,%f10 +/* 0x0dc4 */ fmuld %f14,%f8,%f4 +/* 0x0dc8 */ fdtox %f10,%f10 +/* 0x0dcc */ std %f10,[%sp+336] +/* 0x0dd0 */ fdtox %f4,%f4 +/* 0x0dd4 */ std %f4,[%sp+328] + +! 231 ! ADD_S64_U32_D_8(0); + +/* 0x0dd8 231 */ ldx [%sp+552],%g3 +/* 0x0ddc 230 */ fsubd %f16,%f12,%f4 +/* 0x0de0 231 */ ldx [%sp+560],%g2 +/* 0x0de4 */ ld [%i1],%g4 +/* 0x0de8 */ ldx [%sp+544],%g5 +/* 0x0dec */ add %g2,%g3,%g2 +/* 0x0df0 230 */ fmuld %f4,%f6,%f6 +/* 0x0df4 231 */ ldx [%sp+536],%g3 +/* 0x0df8 */ add %g2,%g4,%g4 +/* 0x0dfc 230 */ fmuld %f4,%f8,%f4 +/* 0x0e00 231 */ ld [%i1+4],%g2 +/* 0x0e04 */ ldx [%sp+520],%o0 +/* 0x0e08 */ add %g5,%g3,%g3 +/* 0x0e0c 230 */ fdtox %f6,%f6 +/* 0x0e10 231 */ ldx [%sp+528],%g5 +/* 0x0e14 */ add %g3,%g2,%g2 +/* 0x0e18 230 */ fdtox %f4,%f4 +/* 0x0e1c 231 */ st %g4,[%i4] +/* 0x0e20 */ srax %g4,32,%g4 +/* 0x0e24 */ ld [%i1+8],%g3 +/* 0x0e28 */ add %g2,%g4,%g2 +/* 0x0e2c */ add %g5,%o0,%g4 +/* 0x0e30 */ ldx [%sp+512],%o0 +/* 0x0e34 */ srax %g2,32,%g5 +/* 0x0e38 */ ldx [%sp+504],%o1 +/* 0x0e3c */ add %g4,%g3,%g3 +/* 0x0e40 */ ld [%i1+12],%g4 +/* 0x0e44 */ add %g3,%g5,%g3 +/* 0x0e48 */ ldx [%sp+488],%o2 +/* 0x0e4c */ add %o0,%o1,%g5 +/* 0x0e50 */ ldx [%sp+496],%o1 +/* 0x0e54 */ srax %g3,32,%o0 +/* 0x0e58 */ add %g5,%g4,%g4 +/* 0x0e5c */ st %g2,[%i4+4] +/* 0x0e60 */ add %g4,%o0,%g4 +/* 0x0e64 */ ld [%i1+16],%g2 +/* 0x0e68 */ srax %g4,32,%o0 +/* 0x0e6c */ add %o1,%o2,%g5 +/* 0x0e70 */ ldx [%sp+480],%o1 +/* 0x0e74 */ ldx [%sp+472],%o2 +/* 0x0e78 */ add %g5,%g2,%g2 +/* 0x0e7c */ st %g3,[%i4+8] +/* 0x0e80 */ add %g2,%o0,%g2 +/* 0x0e84 */ ld [%i1+20],%g3 +/* 0x0e88 */ srax %g2,32,%o0 +/* 0x0e8c */ add %o1,%o2,%g5 +/* 0x0e90 */ ldx [%sp+464],%o1 +/* 0x0e94 */ ldx [%sp+456],%o2 +/* 0x0e98 */ add %g5,%g3,%g3 +/* 0x0e9c */ st %g4,[%i4+12] +/* 0x0ea0 */ add %g3,%o0,%g3 +/* 0x0ea4 */ ld [%i1+24],%g4 +/* 0x0ea8 */ srax %g3,32,%o0 +/* 0x0eac */ add %o1,%o2,%g5 +/* 0x0eb0 */ ldx [%sp+448],%o1 +/* 0x0eb4 */ ldx [%sp+440],%o2 +/* 0x0eb8 */ add %g5,%g4,%g4 +/* 0x0ebc */ st %g2,[%i4+16] +/* 0x0ec0 */ add %g4,%o0,%g4 +/* 0x0ec4 */ ld [%i1+28],%g2 +/* 0x0ec8 */ srax %g4,32,%o0 +/* 0x0ecc */ add %o1,%o2,%g5 + +! 232 ! ADD_S64_U32_D_8(8); + +/* 0x0ed0 232 */ ldx [%sp+432],%o1 +/* 0x0ed4 */ ldx [%sp+424],%o2 +/* 0x0ed8 231 */ add %g5,%g2,%g2 +/* 0x0edc */ st %g3,[%i4+20] +/* 0x0ee0 */ add %g2,%o0,%g2 +/* 0x0ee4 232 */ ld [%i1+32],%g3 +/* 0x0ee8 */ srax %g2,32,%o0 +/* 0x0eec */ add %o1,%o2,%g5 +/* 0x0ef0 */ ldx [%sp+416],%o1 +/* 0x0ef4 */ ldx [%sp+408],%o2 +/* 0x0ef8 */ add %g5,%g3,%g3 +/* 0x0efc 231 */ st %g4,[%i4+24] +/* 0x0f00 232 */ add %g3,%o0,%g3 +/* 0x0f04 */ ld [%i1+36],%g4 +/* 0x0f08 */ srax %g3,32,%o0 +/* 0x0f0c */ add %o1,%o2,%g5 +/* 0x0f10 */ ldx [%sp+400],%o1 +/* 0x0f14 */ ldx [%sp+392],%o2 +/* 0x0f18 */ add %g5,%g4,%g4 +/* 0x0f1c 231 */ st %g2,[%i4+28] +/* 0x0f20 232 */ add %g4,%o0,%g4 +/* 0x0f24 */ ld [%i1+40],%g2 +/* 0x0f28 */ srax %g4,32,%o0 +/* 0x0f2c */ add %o1,%o2,%g5 +/* 0x0f30 */ ldx [%sp+384],%o1 +/* 0x0f34 */ ldx [%sp+376],%o2 +/* 0x0f38 */ add %g5,%g2,%g2 +/* 0x0f3c */ st %g3,[%i4+32] +/* 0x0f40 */ add %g2,%o0,%g2 +/* 0x0f44 */ ld [%i1+44],%g3 +/* 0x0f48 */ srax %g2,32,%o0 +/* 0x0f4c */ add %o1,%o2,%g5 +/* 0x0f50 */ ldx [%sp+368],%o1 +/* 0x0f54 */ ldx [%sp+360],%o2 +/* 0x0f58 */ add %g5,%g3,%g3 +/* 0x0f5c */ st %g4,[%i4+36] +/* 0x0f60 */ add %g3,%o0,%g3 +/* 0x0f64 */ ld [%i1+48],%g4 +/* 0x0f68 */ srax %g3,32,%o0 +/* 0x0f6c */ add %o1,%o2,%g5 +/* 0x0f70 */ ldx [%sp+352],%o1 +/* 0x0f74 */ ldx [%sp+344],%o2 +/* 0x0f78 */ add %g5,%g4,%g4 +/* 0x0f7c 230 */ std %f6,[%sp+320] +/* 0x0f80 232 */ add %g4,%o0,%g4 +/* 0x0f84 230 */ std %f4,[%sp+312] +/* 0x0f88 232 */ srax %g4,32,%o0 +/* 0x0f8c */ add %o1,%o2,%g5 +/* 0x0f90 */ st %g2,[%i4+40] +/* 0x0f94 */ ld [%i1+52],%g2 +/* 0x0f98 */ ldx [%sp+336],%o1 +/* 0x0f9c */ ldx [%sp+328],%o2 +/* 0x0fa0 */ add %g5,%g2,%g2 +/* 0x0fa4 */ st %g3,[%i4+44] +/* 0x0fa8 */ add %g2,%o0,%g2 +/* 0x0fac */ ld [%i1+56],%g3 +/* 0x0fb0 */ add %o1,%o2,%g5 +/* 0x0fb4 */ ldx [%sp+320],%o1 +/* 0x0fb8 */ srax %g2,32,%o0 +/* 0x0fbc */ ldx [%sp+312],%o2 +/* 0x0fc0 */ add %g5,%g3,%g3 +/* 0x0fc4 */ st %g4,[%i4+48] +/* 0x0fc8 */ add %g3,%o0,%g3 +/* 0x0fcc */ ld [%i1+60],%g4 +/* 0x0fd0 */ add %o1,%o2,%g5 +/* 0x0fd4 */ st %g2,[%i4+52] +/* 0x0fd8 */ srax %g3,32,%o0 +/* 0x0fdc */ add %g5,%g4,%g2 +/* 0x0fe0 */ st %g3,[%i4+56] +/* 0x0fe4 */ add %g2,%o0,%g2 +/* 0x0fe8 */ st %g2,[%i4+60] + +! 234 ! return c; + +/* 0x0fec 234 */ srax %g2,32,%i0 +/* 0x0ff0 */ ret ! Result = %i0 +/* 0x0ff4 */ restore %g0,%g0,%g0 + .L77000109: + +! 236 ! } else { +! 237 ! DEF_VARS(2*BUFF_SIZE); +! 238 ! t_d64 d0, d1, db; +! 239 ! t_s32 i, c = 0; +! 241 ! da = (t_d64)(a & A_MASK); +! 242 ! db = (t_d64)(a &~ A_MASK); + +/* 0x0ff8 242 */ or %g0,%g2,%g3 +/* 0x0ffc 241 */ andn %o0,%g2,%g2 +/* 0x1000 */ st %g2,[%sp+316] +/* 0x1004 242 */ and %o0,%g3,%g2 +/* 0x1008 */ st %g2,[%sp+312] +/* 0x100c 239 */ or %g0,0,%g4 + +! 244 !#pragma pipeloop(0) +! 245 ! for (i = 0; i < (n+1)/2; i ++) { + +/* 0x1010 245 */ add %o2,1,%g2 +/* 0x1014 241 */ ldd [%o1],%f6 +/* 0x1018 234 */ sethi %hi(0x1800),%g1 +/* 0x101c 245 */ srl %g2,31,%g3 +/* 0x1020 234 */ xor %g1,-624,%g1 +/* 0x1024 237 */ ldd [%o1+8],%f20 +/* 0x1028 245 */ add %g2,%g3,%g2 +/* 0x102c 241 */ fmovs %f6,%f8 +/* 0x1030 234 */ add %g1,%fp,%g5 +/* 0x1034 242 */ fmovs %f6,%f10 +/* 0x1038 241 */ ld [%sp+316],%f9 +/* 0x103c 245 */ sra %g2,1,%o0 +/* 0x1040 242 */ ld [%sp+312],%f11 +/* 0x1044 245 */ cmp %o0,0 +/* 0x1048 234 */ sethi %hi(0x1800),%g1 +/* 0x104c 241 */ fsubd %f8,%f6,%f18 +/* 0x1050 234 */ xor %g1,-616,%g1 +/* 0x1054 */ or %g0,%o7,%o1 +/* 0x1058 242 */ fsubd %f10,%f6,%f16 +/* 0x105c 245 */ ble,pt %icc,.L900000196 +/* 0x1060 */ cmp %o3,0 +/* 0x1064 234 */ add %g1,%fp,%g3 +/* 0x1068 */ sethi %hi(0x1800),%g1 +/* 0x106c */ xor %g1,-608,%g1 +/* 0x1070 */ sub %o0,1,%o2 +/* 0x1074 */ add %g1,%fp,%g2 +/* 0x1078 */ sethi %hi(0x1800),%g1 +/* 0x107c */ xor %g1,-600,%g1 +/* 0x1080 245 */ cmp %o0,7 +/* 0x1084 */ or %g0,0,%i0 +/* 0x1088 234 */ add %g1,%fp,%o7 +/* 0x108c 245 */ bl,pn %icc,.L77000110 +/* 0x1090 */ sub %o0,3,%o0 +/* 0x1094 */ ldd [%o1],%f2 + +! 246 ! MUL_U32_S64_2_D(i); + +/* 0x1098 246 */ add %i2,16,%i1 +/* 0x109c */ ldd [%o1+8],%f0 +/* 0x10a0 */ add %o1,8,%o1 +/* 0x10a4 */ or %g0,4,%i0 +/* 0x10a8 */ fxnor %f30,%f2,%f6 +/* 0x10ac */ ldd [%i2+16],%f4 +/* 0x10b0 */ add %i1,16,%o1 +/* 0x10b4 */ fxnor %f30,%f0,%f12 +/* 0x10b8 */ ldd [%i2+24],%f0 +/* 0x10bc */ fitod %f7,%f2 +/* 0x10c0 */ fitod %f6,%f6 +/* 0x10c4 */ fxnor %f30,%f4,%f10 +/* 0x10c8 */ fsubd %f20,%f2,%f2 +/* 0x10cc */ fxnor %f30,%f0,%f8 +/* 0x10d0 */ fitod %f13,%f4 +/* 0x10d4 */ fsubd %f20,%f6,%f6 +/* 0x10d8 */ fmuld %f2,%f16,%f0 + .L900000181: +/* 0x10dc */ ldd [%o1],%f24 +/* 0x10e0 246 */ add %i0,3,%i0 +/* 0x10e4 */ add %o7,96,%o7 +/* 0x10e8 */ fitod %f11,%f22 +/* 0x10ec */ fsubd %f20,%f4,%f26 +/* 0x10f0 */ cmp %i0,%o0 +/* 0x10f4 */ add %g2,96,%g2 +/* 0x10f8 */ fmuld %f6,%f18,%f28 +/* 0x10fc */ fmuld %f6,%f16,%f6 +/* 0x1100 */ add %g3,96,%g3 +/* 0x1104 */ add %g5,96,%g5 +/* 0x1108 */ fdtox %f0,%f0 +/* 0x110c */ fitod %f12,%f4 +/* 0x1110 */ fmuld %f2,%f18,%f2 +/* 0x1114 */ fdtox %f28,%f12 +/* 0x1118 */ fdtox %f6,%f6 +/* 0x111c */ std %f12,[%g5-96] +/* 0x1120 */ std %f6,[%g3-96] +/* 0x1124 */ fdtox %f2,%f2 +/* 0x1128 */ fsubd %f20,%f4,%f6 +/* 0x112c */ std %f2,[%g2-96] +/* 0x1130 */ add %o1,8,%o1 +/* 0x1134 */ fxnor %f30,%f24,%f12 +/* 0x1138 */ fmuld %f26,%f16,%f4 +/* 0x113c */ std %f0,[%o7-96] +/* 0x1140 */ ldd [%o1],%f0 +/* 0x1144 */ fitod %f9,%f2 +/* 0x1148 */ fsubd %f20,%f22,%f28 +/* 0x114c */ fmuld %f6,%f18,%f24 +/* 0x1150 */ fmuld %f6,%f16,%f22 +/* 0x1154 */ fdtox %f4,%f4 +/* 0x1158 */ fitod %f10,%f6 +/* 0x115c */ fmuld %f26,%f18,%f10 +/* 0x1160 */ fdtox %f24,%f24 +/* 0x1164 */ fdtox %f22,%f22 +/* 0x1168 */ std %f24,[%g5-64] +/* 0x116c */ std %f22,[%g3-64] +/* 0x1170 */ fdtox %f10,%f10 +/* 0x1174 */ fsubd %f20,%f6,%f6 +/* 0x1178 */ std %f10,[%g2-64] +/* 0x117c */ add %o1,8,%o1 +/* 0x1180 */ fxnor %f30,%f0,%f10 +/* 0x1184 */ fmuld %f28,%f16,%f0 +/* 0x1188 */ std %f4,[%o7-64] +/* 0x118c */ ldd [%o1],%f22 +/* 0x1190 */ fitod %f13,%f4 +/* 0x1194 */ fsubd %f20,%f2,%f2 +/* 0x1198 */ fmuld %f6,%f18,%f26 +/* 0x119c */ fmuld %f6,%f16,%f24 +/* 0x11a0 */ fdtox %f0,%f0 +/* 0x11a4 */ fitod %f8,%f6 +/* 0x11a8 */ fmuld %f28,%f18,%f8 +/* 0x11ac */ fdtox %f26,%f26 +/* 0x11b0 */ fdtox %f24,%f24 +/* 0x11b4 */ std %f26,[%g5-32] +/* 0x11b8 */ std %f24,[%g3-32] +/* 0x11bc */ fdtox %f8,%f8 +/* 0x11c0 */ fsubd %f20,%f6,%f6 +/* 0x11c4 */ std %f8,[%g2-32] +/* 0x11c8 */ add %o1,8,%o1 +/* 0x11cc */ fxnor %f30,%f22,%f8 +/* 0x11d0 */ std %f0,[%o7-32] +/* 0x11d4 */ ble,pt %icc,.L900000181 +/* 0x11d8 */ fmuld %f2,%f16,%f0 + .L900000184: +/* 0x11dc 246 */ fitod %f12,%f28 +/* 0x11e0 */ fmuld %f6,%f18,%f24 +/* 0x11e4 */ add %g5,128,%g5 +/* 0x11e8 */ fitod %f10,%f12 +/* 0x11ec */ fmuld %f6,%f16,%f26 +/* 0x11f0 */ add %g3,128,%g3 +/* 0x11f4 */ fsubd %f20,%f4,%f4 +/* 0x11f8 */ fmuld %f2,%f18,%f22 +/* 0x11fc */ add %g2,128,%g2 +/* 0x1200 */ fdtox %f24,%f6 +/* 0x1204 */ std %f6,[%g5-128] +/* 0x1208 */ add %o7,128,%o7 +/* 0x120c */ fsubd %f20,%f28,%f2 +/* 0x1210 */ cmp %i0,%o2 +/* 0x1214 */ fitod %f11,%f6 +/* 0x1218 */ fmuld %f4,%f18,%f24 +/* 0x121c */ fdtox %f26,%f10 +/* 0x1220 */ std %f10,[%g3-128] +/* 0x1224 */ fdtox %f22,%f10 +/* 0x1228 */ std %f10,[%g2-128] +/* 0x122c */ fmuld %f2,%f18,%f26 +/* 0x1230 */ fsubd %f20,%f12,%f10 +/* 0x1234 */ fmuld %f2,%f16,%f2 +/* 0x1238 */ fsubd %f20,%f6,%f22 +/* 0x123c */ fmuld %f4,%f16,%f12 +/* 0x1240 */ fdtox %f0,%f0 +/* 0x1244 */ std %f0,[%o7-128] +/* 0x1248 */ fitod %f8,%f4 +/* 0x124c */ fmuld %f10,%f18,%f6 +/* 0x1250 */ fdtox %f26,%f0 +/* 0x1254 */ std %f0,[%g5-96] +/* 0x1258 */ fmuld %f10,%f16,%f10 +/* 0x125c */ fdtox %f2,%f2 +/* 0x1260 */ std %f2,[%g3-96] +/* 0x1264 */ fitod %f9,%f0 +/* 0x1268 */ fmuld %f22,%f18,%f2 +/* 0x126c */ fdtox %f24,%f8 +/* 0x1270 */ std %f8,[%g2-96] +/* 0x1274 */ fsubd %f20,%f4,%f4 +/* 0x1278 */ fmuld %f22,%f16,%f8 +/* 0x127c */ fdtox %f12,%f12 +/* 0x1280 */ std %f12,[%o7-96] +/* 0x1284 */ fsubd %f20,%f0,%f0 +/* 0x1288 */ fdtox %f6,%f6 +/* 0x128c */ std %f6,[%g5-64] +/* 0x1290 */ fdtox %f10,%f10 +/* 0x1294 */ std %f10,[%g3-64] +/* 0x1298 */ fmuld %f4,%f18,%f6 +/* 0x129c */ fdtox %f2,%f2 +/* 0x12a0 */ std %f2,[%g2-64] +/* 0x12a4 */ fmuld %f4,%f16,%f4 +/* 0x12a8 */ fmuld %f0,%f18,%f2 +/* 0x12ac */ fdtox %f8,%f8 +/* 0x12b0 */ std %f8,[%o7-64] +/* 0x12b4 */ fdtox %f6,%f6 +/* 0x12b8 */ std %f6,[%g5-32] +/* 0x12bc */ fmuld %f0,%f16,%f0 +/* 0x12c0 */ fdtox %f4,%f4 +/* 0x12c4 */ std %f4,[%g3-32] +/* 0x12c8 */ fdtox %f2,%f2 +/* 0x12cc */ std %f2,[%g2-32] +/* 0x12d0 */ fdtox %f0,%f0 +/* 0x12d4 */ bg,pn %icc,.L77000071 +/* 0x12d8 */ std %f0,[%o7-32] + .L77000110: +/* 0x12dc */ ldd [%o1],%f0 + .L900000195: +/* 0x12e0 */ fxnor %f30,%f0,%f0 +/* 0x12e4 246 */ add %i0,1,%i0 +/* 0x12e8 */ add %o1,8,%o1 +/* 0x12ec */ cmp %i0,%o2 +/* 0x12f0 */ fitod %f0,%f2 +/* 0x12f4 */ fitod %f1,%f0 +/* 0x12f8 */ fsubd %f20,%f2,%f2 +/* 0x12fc */ fsubd %f20,%f0,%f0 +/* 0x1300 */ fmuld %f2,%f18,%f6 +/* 0x1304 */ fmuld %f2,%f16,%f4 +/* 0x1308 */ fmuld %f0,%f18,%f2 +/* 0x130c */ fdtox %f6,%f6 +/* 0x1310 */ std %f6,[%g5] +/* 0x1314 */ fmuld %f0,%f16,%f0 +/* 0x1318 */ fdtox %f4,%f4 +/* 0x131c */ std %f4,[%g3] +/* 0x1320 */ add %g3,32,%g3 +/* 0x1324 */ fdtox %f2,%f2 +/* 0x1328 */ std %f2,[%g2] +/* 0x132c */ add %g2,32,%g2 +/* 0x1330 */ fdtox %f0,%f0 +/* 0x1334 */ std %f0,[%o7] +/* 0x1338 */ add %o7,32,%o7 +/* 0x133c */ add %g5,32,%g5 +/* 0x1340 */ ble,a,pt %icc,.L900000195 +/* 0x1344 */ ldd [%o1],%f0 + .L77000071: + +! 247 ! } +! 249 !#pragma pipeloop(0) +! 250 ! for (i = 0; i < n; i ++) { + +/* 0x1348 250 */ cmp %o3,0 + .L900000196: +/* 0x134c 250 */ ble,a,pt %icc,.L77000089 +/* 0x1350 */ or %g0,%g4,%i0 +/* 0x1354 */ sethi %hi(0x1800),%g1 +/* 0x1358 */ xor %g1,-624,%g1 +/* 0x135c */ or %g0,%o5,%g5 +/* 0x1360 */ add %g1,%fp,%g3 +/* 0x1364 */ sethi %hi(0x1800),%g1 +/* 0x1368 */ xor %g1,-616,%g1 +/* 0x136c */ or %g0,%o4,%i0 +/* 0x1370 */ add %g1,%fp,%o5 +/* 0x1374 */ or %g0,0,%i1 +/* 0x1378 */ sub %o3,1,%o7 +/* 0x137c 246 */ cmp %o3,5 +/* 0x1380 */ bl,pn %icc,.L77000111 +/* 0x1384 */ sethi %hi(0x1800),%g1 + +! 251 ! ADD_S64_U32_D(i); + +/* 0x1388 251 */ ld [%i0],%o2 +/* 0x138c 246 */ sub %o3,3,%o4 +/* 0x1390 251 */ xor %g1,-624,%g1 +/* 0x1394 */ add %g5,4,%g5 +/* 0x1398 */ add %g1,%fp,%g1 +/* 0x139c */ or %g0,2,%i1 +/* 0x13a0 */ ldx [%g1+8],%o1 +/* 0x13a4 */ ldx [%g1],%o0 +/* 0x13a8 */ ldx [%g1+16],%o3 +/* 0x13ac */ sethi %hi(0x1800),%g1 +/* 0x13b0 */ xor %g1,-592,%g1 +/* 0x13b4 */ add %o0,%o1,%o0 +/* 0x13b8 */ ld [%i0+4],%o1 +/* 0x13bc */ add %g1,%fp,%g3 +/* 0x13c0 */ sethi %hi(0x1800),%g1 +/* 0x13c4 */ xor %g1,-600,%g1 +/* 0x13c8 */ add %o0,%o2,%o0 +/* 0x13cc */ add %g1,%fp,%g1 +/* 0x13d0 */ add %i0,8,%i0 +/* 0x13d4 */ ldx [%g1],%o2 +/* 0x13d8 */ sethi %hi(0x1800),%g1 +/* 0x13dc */ st %o0,[%g5-4] +/* 0x13e0 */ srax %o0,32,%o0 +/* 0x13e4 */ xor %g1,-584,%g1 +/* 0x13e8 */ add %g1,%fp,%o5 + .L900000169: +/* 0x13ec 251 */ add %o3,%o2,%g4 +/* 0x13f0 */ ld [%i0],%o3 +/* 0x13f4 */ add %i1,3,%i1 +/* 0x13f8 */ ldx [%g3],%o2 +/* 0x13fc */ sra %o0,0,%g2 +/* 0x1400 */ add %g4,%o1,%o1 +/* 0x1404 */ ldx [%o5],%o0 +/* 0x1408 */ add %o1,%g2,%o1 +/* 0x140c */ cmp %i1,%o4 +/* 0x1410 */ st %o1,[%g5] +/* 0x1414 */ srax %o1,32,%g4 +/* 0x1418 */ add %g5,12,%g5 +/* 0x141c */ add %o2,%o0,%o1 +/* 0x1420 */ ld [%i0+4],%o2 +/* 0x1424 */ add %i0,12,%i0 +/* 0x1428 */ ldx [%g3+16],%o0 +/* 0x142c */ add %o1,%o3,%o3 +/* 0x1430 */ ldx [%o5+16],%o1 +/* 0x1434 */ add %o3,%g4,%o3 +/* 0x1438 */ add %o5,48,%o5 +/* 0x143c */ st %o3,[%g5-8] +/* 0x1440 */ srax %o3,32,%g2 +/* 0x1444 */ add %g3,48,%g3 +/* 0x1448 */ add %o0,%o1,%o0 +/* 0x144c */ ld [%i0-4],%o1 +/* 0x1450 */ ldx [%g3-16],%o3 +/* 0x1454 */ add %o0,%o2,%o0 +/* 0x1458 */ ldx [%o5-16],%o2 +/* 0x145c */ add %o0,%g2,%o0 +/* 0x1460 */ st %o0,[%g5-4] +/* 0x1464 */ ble,pt %icc,.L900000169 +/* 0x1468 */ srax %o0,32,%o0 + .L900000172: +/* 0x146c 251 */ add %o3,%o2,%o3 +/* 0x1470 */ add %g5,4,%g5 +/* 0x1474 */ sra %o0,0,%o2 +/* 0x1478 */ add %o3,%o1,%o0 +/* 0x147c */ add %o0,%o2,%o0 +/* 0x1480 */ st %o0,[%g5-4] +/* 0x1484 */ cmp %i1,%o7 +/* 0x1488 */ srax %o0,32,%g4 +/* 0x148c */ bg,a,pn %icc,.L77000089 +/* 0x1490 */ or %g0,%g4,%i0 + .L77000111: +/* 0x1494 251 */ ldx [%g3],%o0 + .L900000194: +/* 0x1498 251 */ ldx [%o5],%o3 +/* 0x149c */ sra %g4,0,%o1 +/* 0x14a0 */ add %i1,1,%i1 +/* 0x14a4 */ ld [%i0],%o2 +/* 0x14a8 */ add %g3,16,%g3 +/* 0x14ac */ add %o5,16,%o5 +/* 0x14b0 */ add %o0,%o3,%o0 +/* 0x14b4 */ add %i0,4,%i0 +/* 0x14b8 */ add %o0,%o2,%o0 +/* 0x14bc */ cmp %i1,%o7 +/* 0x14c0 */ add %o0,%o1,%o0 +/* 0x14c4 */ st %o0,[%g5] +/* 0x14c8 */ add %g5,4,%g5 +/* 0x14cc */ srax %o0,32,%g4 +/* 0x14d0 */ ble,a,pt %icc,.L900000194 +/* 0x14d4 */ ldx [%g3],%o0 + .L77000075: +/* 0x14d8 */ ret ! Result = %i0 +/* 0x14dc */ restore %g0,%g4,%o0 + .L77000076: + +! 252 ! } +! 254 ! return c; +! 255 ! } +! 257 ! } else { +! 259 ! if (n == 8) { + +/* 0x14e0 259 */ bne,pn %icc,.L77000078 +/* 0x14e4 */ sethi %hi(0xffe00000),%g2 +/* 0x14e8 */ ldd [%o7],%f4 + +! 260 ! DEF_VARS(2*8); +! 261 ! t_d64 d0, d1, db; +! 262 ! t_u32 uc = 0; +! 264 ! da = (t_d64)(a & A_MASK); + +/* 0x14ec 264 */ ldd [%o1],%f6 +/* 0x14f0 */ or %g0,%g2,%g3 + +! 265 ! db = (t_d64)(a &~ A_MASK); + +/* 0x14f4 265 */ and %o0,%g2,%g2 +/* 0x14f8 */ st %g2,[%sp+456] +/* 0x14fc */ fxnor %f30,%f4,%f4 +/* 0x1500 264 */ andn %o0,%g3,%g2 +/* 0x1504 */ st %g2,[%sp+460] + +! 267 ! MUL_U32_S64_E_8(0); + +/* 0x1508 267 */ ldd [%o1+8],%f12 +/* 0x150c */ fitod %f4,%f10 +/* 0x1510 */ ldd [%o7+8],%f14 +/* 0x1514 */ fitod %f5,%f4 +/* 0x1518 */ ldd [%o1+16],%f18 +/* 0x151c 265 */ ld [%sp+456],%f9 +/* 0x1520 267 */ fsubd %f12,%f10,%f10 +/* 0x1524 264 */ ld [%sp+460],%f17 +/* 0x1528 267 */ fsubd %f12,%f4,%f4 + +! 268 ! ADD_S64_U32_E_8(0); + +/* 0x152c 268 */ sethi %hi(0x80000000),%g3 +/* 0x1530 */ ldd [%o7+16],%f20 +/* 0x1534 */ fxnor %f30,%f14,%f14 +/* 0x1538 */ sllx %g3,32,%g3 +/* 0x153c */ ldd [%o7+24],%f22 +/* 0x1540 */ ld [%i1+24],%o3 +/* 0x1544 267 */ fitod %f14,%f26 +/* 0x1548 268 */ ld [%i1+28],%o4 +/* 0x154c 267 */ fitod %f15,%f14 +/* 0x1550 268 */ stx %o3,[%sp+320] +/* 0x1554 */ fxnor %f30,%f20,%f20 +/* 0x1558 */ stx %o4,[%sp+312] +/* 0x155c 267 */ fsubd %f12,%f26,%f26 +/* 0x1560 268 */ ld [%i1],%g2 +/* 0x1564 267 */ fsubd %f12,%f14,%f14 +/* 0x1568 268 */ ld [%i1+4],%g4 +/* 0x156c */ ld [%i1+8],%g5 +/* 0x1570 */ ld [%i1+12],%o0 +/* 0x1574 265 */ fmovs %f6,%f8 +/* 0x1578 268 */ ld [%i1+16],%o1 +/* 0x157c 264 */ fmovs %f6,%f16 +/* 0x1580 268 */ ld [%i1+20],%o2 +/* 0x1584 265 */ fsubd %f8,%f6,%f8 +/* 0x1588 264 */ fsubd %f16,%f6,%f6 +/* 0x158c 267 */ fmuld %f10,%f8,%f24 +/* 0x1590 */ fmuld %f4,%f8,%f16 +/* 0x1594 */ fmuld %f4,%f6,%f4 +/* 0x1598 */ faddd %f24,%f18,%f24 +/* 0x159c */ fmuld %f10,%f6,%f10 +/* 0x15a0 */ faddd %f16,%f18,%f16 +/* 0x15a4 */ fmuld %f26,%f8,%f28 +/* 0x15a8 */ fdtox %f4,%f4 +/* 0x15ac */ std %f4,[%sp+432] +/* 0x15b0 */ fmuld %f26,%f6,%f26 +/* 0x15b4 */ fdtox %f24,%f24 +/* 0x15b8 */ std %f24,[%sp+440] +/* 0x15bc */ fmuld %f14,%f6,%f4 +/* 0x15c0 */ fdtox %f10,%f10 +/* 0x15c4 */ std %f10,[%sp+448] +/* 0x15c8 */ fmuld %f14,%f8,%f24 +/* 0x15cc 268 */ ldx [%sp+432],%o4 +/* 0x15d0 267 */ fdtox %f16,%f14 +/* 0x15d4 */ std %f14,[%sp+424] +/* 0x15d8 */ fitod %f20,%f10 +/* 0x15dc 268 */ ldx [%sp+440],%o7 +/* 0x15e0 267 */ faddd %f28,%f18,%f14 +/* 0x15e4 268 */ ldx [%sp+448],%o5 +/* 0x15e8 267 */ fitod %f21,%f16 +/* 0x15ec */ fsubd %f12,%f10,%f10 +/* 0x15f0 268 */ ldx [%sp+424],%o3 +/* 0x15f4 267 */ fdtox %f14,%f14 +/* 0x15f8 268 */ add %o5,%o7,%o5 +/* 0x15fc 267 */ std %f14,[%sp+408] +/* 0x1600 */ fxnor %f30,%f22,%f20 +/* 0x1604 268 */ add %o5,%g2,%g2 +/* 0x1608 267 */ faddd %f24,%f18,%f14 +/* 0x160c 268 */ add %o4,%o3,%o3 +/* 0x1610 */ sub %g2,%g3,%g2 +/* 0x1614 */ st %g2,[%i4] +/* 0x1618 267 */ fdtox %f26,%f22 +/* 0x161c 268 */ srlx %g2,32,%o5 +/* 0x1620 267 */ fmuld %f10,%f8,%f26 +/* 0x1624 */ std %f22,[%sp+416] +/* 0x1628 */ fsubd %f12,%f16,%f16 +/* 0x162c 268 */ add %o3,%g4,%g4 +/* 0x1630 267 */ fmuld %f10,%f6,%f10 +/* 0x1634 */ fdtox %f4,%f4 +/* 0x1638 */ std %f4,[%sp+400] +/* 0x163c 268 */ add %g4,%o5,%g4 +/* 0x1640 */ ldx [%sp+416],%o7 +/* 0x1644 267 */ fdtox %f14,%f4 +/* 0x1648 268 */ sub %g4,%g3,%g4 +/* 0x164c 267 */ std %f4,[%sp+392] +/* 0x1650 */ fitod %f20,%f22 +/* 0x1654 */ fmuld %f16,%f8,%f14 +/* 0x1658 268 */ ldx [%sp+408],%o3 +/* 0x165c 267 */ faddd %f26,%f18,%f4 +/* 0x1660 */ fmuld %f16,%f6,%f16 +/* 0x1664 268 */ st %g4,[%i4+4] +/* 0x1668 267 */ fitod %f21,%f20 +/* 0x166c 268 */ ldx [%sp+392],%o5 +/* 0x1670 267 */ fsubd %f12,%f22,%f22 +/* 0x1674 268 */ add %o7,%o3,%o3 +/* 0x1678 */ ldx [%sp+400],%o4 +/* 0x167c 267 */ fdtox %f4,%f4 +/* 0x1680 268 */ add %o3,%g5,%o3 +/* 0x1684 267 */ std %f4,[%sp+376] +/* 0x1688 */ fdtox %f10,%f10 +/* 0x168c 268 */ srlx %g4,32,%g5 +/* 0x1690 267 */ faddd %f14,%f18,%f4 +/* 0x1694 */ std %f10,[%sp+384] +/* 0x1698 */ fmuld %f22,%f8,%f10 +/* 0x169c 268 */ ldx [%sp+312],%g4 +/* 0x16a0 267 */ fsubd %f12,%f20,%f12 +/* 0x16a4 268 */ add %o4,%o5,%o4 +/* 0x16a8 267 */ fmuld %f22,%f6,%f14 +/* 0x16ac */ fdtox %f16,%f16 +/* 0x16b0 */ std %f16,[%sp+368] +/* 0x16b4 268 */ add %o3,%g5,%o3 +/* 0x16b8 267 */ fdtox %f4,%f4 +/* 0x16bc */ std %f4,[%sp+360] +/* 0x16c0 268 */ add %o4,%o0,%o0 +/* 0x16c4 267 */ faddd %f10,%f18,%f4 +/* 0x16c8 268 */ ldx [%sp+376],%o4 +/* 0x16cc */ sub %o3,%g3,%o3 +/* 0x16d0 267 */ fmuld %f12,%f8,%f16 +/* 0x16d4 268 */ ldx [%sp+384],%g5 +/* 0x16d8 */ srlx %o3,32,%o5 +/* 0x16dc 267 */ fdtox %f14,%f14 +/* 0x16e0 */ fmuld %f12,%f6,%f6 +/* 0x16e4 */ std %f14,[%sp+352] +/* 0x16e8 268 */ add %o0,%o5,%o0 +/* 0x16ec */ add %g5,%o4,%g5 +/* 0x16f0 267 */ fdtox %f4,%f4 +/* 0x16f4 */ std %f4,[%sp+344] +/* 0x16f8 268 */ ldx [%sp+368],%o7 +/* 0x16fc */ sub %o0,%g3,%o0 +/* 0x1700 */ add %g5,%o1,%o1 +/* 0x1704 267 */ faddd %f16,%f18,%f4 +/* 0x1708 268 */ ldx [%sp+360],%o4 +/* 0x170c */ srlx %o0,32,%g5 +/* 0x1710 267 */ fdtox %f6,%f6 +/* 0x1714 268 */ add %o1,%g5,%o1 +/* 0x1718 267 */ std %f6,[%sp+336] +/* 0x171c 268 */ add %o7,%o4,%o4 +/* 0x1720 */ sub %o1,%g3,%o1 +/* 0x1724 */ ldx [%sp+352],%o5 +/* 0x1728 */ add %o4,%o2,%o2 +/* 0x172c 267 */ fdtox %f4,%f4 +/* 0x1730 */ std %f4,[%sp+328] +/* 0x1734 268 */ ldx [%sp+344],%o4 +/* 0x1738 */ srlx %o1,32,%g5 +/* 0x173c */ add %o2,%g5,%o2 +/* 0x1740 */ st %o3,[%i4+8] +/* 0x1744 */ add %o5,%o4,%g5 +/* 0x1748 */ ldx [%sp+320],%o5 +/* 0x174c */ sub %o2,%g3,%o2 +/* 0x1750 */ ldx [%sp+336],%o7 +/* 0x1754 */ srlx %o2,32,%g2 +/* 0x1758 */ ldx [%sp+328],%o4 +/* 0x175c */ add %g5,%o5,%g5 +/* 0x1760 */ add %g5,%g2,%g2 +/* 0x1764 */ st %o0,[%i4+12] +/* 0x1768 */ add %o7,%o4,%o4 +/* 0x176c */ sub %g2,%g3,%g2 +/* 0x1770 */ st %o1,[%i4+16] +/* 0x1774 */ srlx %g2,32,%g5 +/* 0x1778 */ add %o4,%g4,%g4 +/* 0x177c */ st %o2,[%i4+20] +/* 0x1780 */ add %g4,%g5,%g4 +/* 0x1784 */ st %g2,[%i4+24] +/* 0x1788 */ sub %g4,%g3,%g3 +/* 0x178c */ st %g3,[%i4+28] + +! 270 ! return uc; + +/* 0x1790 270 */ srlx %g3,32,%i0 +/* 0x1794 */ ret ! Result = %i0 +/* 0x1798 */ restore %g0,%g0,%g0 + .L77000078: + +! 272 ! } else if (n == 16) { + +/* 0x179c 272 */ cmp %o2,16 +/* 0x17a0 */ bne,pn %icc,.L77000106 +/* 0x17a4 */ sethi %hi(0xffe00000),%g2 +/* 0x17a8 */ ldd [%o7],%f6 + +! 273 ! DEF_VARS(2*16); +! 274 ! t_d64 d0, d1, db; +! 275 ! t_u32 uc = 0; +! 277 ! da = (t_d64)(a & A_MASK); + +/* 0x17ac 277 */ or %g0,%g2,%g3 + +! 278 ! db = (t_d64)(a &~ A_MASK); + +/* 0x17b0 278 */ and %o0,%g2,%g2 +/* 0x17b4 */ st %g2,[%sp+312] +/* 0x17b8 277 */ andn %o0,%g3,%g2 +/* 0x17bc */ sethi %hi(0x80000000),%g3 +/* 0x17c0 */ fxnor %f30,%f6,%f6 +/* 0x17c4 */ ldd [%o1],%f8 +/* 0x17c8 */ sllx %g3,32,%o0 +/* 0x17cc */ st %g2,[%sp+316] + +! 280 ! MUL_U32_S64_E_8(0); + +/* 0x17d0 280 */ fitod %f6,%f12 +/* 0x17d4 */ ldd [%o1+8],%f4 +/* 0x17d8 */ fitod %f7,%f6 +/* 0x17dc */ ldd [%o1+16],%f2 + +! 281 ! MUL_U32_S64_E_8(4); +! 282 ! ADD_S64_U32_E_8(0); + +/* 0x17e0 282 */ stx %o0,[%sp+96] +/* 0x17e4 278 */ ld [%sp+312],%f11 +/* 0x17e8 280 */ fsubd %f4,%f6,%f6 +/* 0x17ec 277 */ ld [%sp+316],%f15 +/* 0x17f0 282 */ ldx [%sp+96],%o3 +/* 0x17f4 278 */ fmovs %f8,%f10 +/* 0x17f8 277 */ fmovs %f8,%f14 +/* 0x17fc 278 */ fsubd %f10,%f8,%f16 +/* 0x1800 280 */ fsubd %f4,%f12,%f10 +/* 0x1804 277 */ fsubd %f14,%f8,%f14 +/* 0x1808 280 */ fmuld %f6,%f16,%f12 +/* 0x180c */ fmuld %f10,%f16,%f8 +/* 0x1810 */ fmuld %f6,%f14,%f6 +/* 0x1814 */ faddd %f12,%f2,%f12 +/* 0x1818 */ fmuld %f10,%f14,%f10 +/* 0x181c */ faddd %f8,%f2,%f8 +/* 0x1820 */ fdtox %f6,%f6 +/* 0x1824 */ std %f6,[%sp+288] +/* 0x1828 */ fdtox %f12,%f6 +/* 0x182c */ std %f6,[%sp+280] +/* 0x1830 */ fdtox %f10,%f10 +/* 0x1834 */ std %f10,[%sp+304] +/* 0x1838 */ fdtox %f8,%f8 +/* 0x183c */ std %f8,[%sp+296] +/* 0x1840 */ ldd [%o7+8],%f0 +/* 0x1844 */ fxnor %f30,%f0,%f6 +/* 0x1848 */ ldx [%sp+296],%g3 +/* 0x184c */ fitod %f6,%f8 +/* 0x1850 */ ldx [%sp+304],%g2 +/* 0x1854 */ fitod %f7,%f6 +/* 0x1858 */ add %g2,%g3,%g2 +/* 0x185c */ fsubd %f4,%f8,%f8 +/* 0x1860 */ fsubd %f4,%f6,%f6 +/* 0x1864 */ fmuld %f8,%f16,%f10 +/* 0x1868 */ fmuld %f6,%f16,%f12 +/* 0x186c */ fmuld %f8,%f14,%f8 +/* 0x1870 */ fmuld %f6,%f14,%f6 +/* 0x1874 */ faddd %f10,%f2,%f10 +/* 0x1878 */ faddd %f12,%f2,%f12 +/* 0x187c */ fdtox %f8,%f8 +/* 0x1880 */ std %f8,[%sp+272] +/* 0x1884 */ fdtox %f6,%f6 +/* 0x1888 */ std %f6,[%sp+256] +/* 0x188c */ fdtox %f10,%f8 +/* 0x1890 */ std %f8,[%sp+264] +/* 0x1894 */ fdtox %f12,%f6 +/* 0x1898 */ std %f6,[%sp+248] +/* 0x189c */ ldd [%o7+16],%f0 +/* 0x18a0 */ fxnor %f30,%f0,%f6 +/* 0x18a4 */ fitod %f6,%f8 +/* 0x18a8 */ fitod %f7,%f6 +/* 0x18ac */ fsubd %f4,%f8,%f8 +/* 0x18b0 */ fsubd %f4,%f6,%f6 +/* 0x18b4 */ fmuld %f8,%f16,%f10 +/* 0x18b8 */ fmuld %f6,%f16,%f12 +/* 0x18bc */ fmuld %f8,%f14,%f8 +/* 0x18c0 */ fmuld %f6,%f14,%f6 +/* 0x18c4 */ faddd %f10,%f2,%f10 +/* 0x18c8 */ faddd %f12,%f2,%f12 +/* 0x18cc */ fdtox %f8,%f8 +/* 0x18d0 */ std %f8,[%sp+240] +/* 0x18d4 */ fdtox %f6,%f6 +/* 0x18d8 */ std %f6,[%sp+224] +/* 0x18dc */ fdtox %f10,%f8 +/* 0x18e0 */ std %f8,[%sp+232] +/* 0x18e4 */ fdtox %f12,%f6 +/* 0x18e8 */ std %f6,[%sp+216] +/* 0x18ec */ ldd [%o7+24],%f0 +/* 0x18f0 */ fxnor %f30,%f0,%f6 +/* 0x18f4 */ fitod %f6,%f8 +/* 0x18f8 */ fitod %f7,%f6 +/* 0x18fc */ fsubd %f4,%f8,%f8 +/* 0x1900 */ fsubd %f4,%f6,%f6 +/* 0x1904 */ fmuld %f8,%f16,%f10 +/* 0x1908 */ fmuld %f6,%f16,%f12 +/* 0x190c */ fmuld %f8,%f14,%f8 +/* 0x1910 */ fmuld %f6,%f14,%f6 +/* 0x1914 */ faddd %f10,%f2,%f10 +/* 0x1918 */ faddd %f12,%f2,%f12 +/* 0x191c */ fdtox %f8,%f8 +/* 0x1920 */ std %f8,[%sp+208] +/* 0x1924 */ fdtox %f6,%f6 +/* 0x1928 */ std %f6,[%sp+192] +/* 0x192c */ fdtox %f10,%f8 +/* 0x1930 */ std %f8,[%sp+200] +/* 0x1934 */ fdtox %f12,%f6 +/* 0x1938 */ std %f6,[%sp+184] +/* 0x193c */ ldd [%o7+32],%f0 +/* 0x1940 */ fxnor %f30,%f0,%f6 +/* 0x1944 281 */ fitod %f6,%f8 +/* 0x1948 */ fitod %f7,%f6 +/* 0x194c */ fsubd %f4,%f8,%f8 +/* 0x1950 */ fsubd %f4,%f6,%f6 +/* 0x1954 */ fmuld %f8,%f16,%f10 +/* 0x1958 */ fmuld %f6,%f16,%f12 +/* 0x195c */ fmuld %f8,%f14,%f8 +/* 0x1960 */ fmuld %f6,%f14,%f6 +/* 0x1964 */ faddd %f10,%f2,%f10 +/* 0x1968 */ faddd %f12,%f2,%f12 +/* 0x196c */ fdtox %f8,%f8 +/* 0x1970 */ std %f8,[%sp+176] +/* 0x1974 */ fdtox %f6,%f6 +/* 0x1978 */ std %f6,[%sp+160] +/* 0x197c */ fdtox %f10,%f8 +/* 0x1980 */ std %f8,[%sp+168] +/* 0x1984 */ fdtox %f12,%f6 +/* 0x1988 */ std %f6,[%sp+152] +/* 0x198c */ ldd [%o7+40],%f0 +/* 0x1990 */ fxnor %f30,%f0,%f6 +/* 0x1994 */ fitod %f6,%f8 +/* 0x1998 */ fitod %f7,%f6 +/* 0x199c */ fsubd %f4,%f8,%f8 +/* 0x19a0 */ fsubd %f4,%f6,%f6 +/* 0x19a4 */ fmuld %f8,%f16,%f10 +/* 0x19a8 */ fmuld %f6,%f16,%f12 +/* 0x19ac */ fmuld %f8,%f14,%f8 +/* 0x19b0 */ fmuld %f6,%f14,%f6 +/* 0x19b4 */ faddd %f10,%f2,%f10 +/* 0x19b8 */ faddd %f12,%f2,%f12 +/* 0x19bc */ fdtox %f8,%f8 +/* 0x19c0 */ std %f8,[%sp+144] +/* 0x19c4 */ fdtox %f6,%f6 +/* 0x19c8 */ std %f6,[%sp+128] +/* 0x19cc */ fdtox %f10,%f8 +/* 0x19d0 */ std %f8,[%sp+136] +/* 0x19d4 */ fdtox %f12,%f6 +/* 0x19d8 */ std %f6,[%sp+120] +/* 0x19dc */ ldd [%o7+48],%f0 +/* 0x19e0 */ fxnor %f30,%f0,%f6 +/* 0x19e4 */ fitod %f6,%f8 +/* 0x19e8 */ fitod %f7,%f6 +/* 0x19ec */ fsubd %f4,%f8,%f8 +/* 0x19f0 */ fsubd %f4,%f6,%f12 +/* 0x19f4 */ fmuld %f8,%f16,%f6 +/* 0x19f8 */ fmuld %f8,%f14,%f8 +/* 0x19fc */ fmuld %f12,%f14,%f10 +/* 0x1a00 */ faddd %f6,%f2,%f6 +/* 0x1a04 */ fdtox %f8,%f8 +/* 0x1a08 */ std %f8,[%sp+112] +/* 0x1a0c */ fdtox %f10,%f0 +/* 0x1a10 */ fdtox %f6,%f6 +/* 0x1a14 */ std %f6,[%sp+104] +/* 0x1a18 */ ld [%i1],%g3 +/* 0x1a1c */ fmuld %f12,%f16,%f6 +/* 0x1a20 282 */ ld [%i1+4],%g5 +/* 0x1a24 */ add %g2,%g3,%g2 +/* 0x1a28 */ ld [%i1+8],%o4 +/* 0x1a2c */ sub %g2,%o0,%o0 +/* 0x1a30 */ st %o0,[%i4] +/* 0x1a34 281 */ faddd %f6,%f2,%f6 +/* 0x1a38 282 */ ldx [%sp+280],%g4 +/* 0x1a3c */ srlx %o0,32,%g2 +/* 0x1a40 */ ldx [%sp+288],%g3 +/* 0x1a44 */ ld [%i1+20],%o2 +/* 0x1a48 281 */ fdtox %f6,%f6 +/* 0x1a4c 282 */ add %g3,%g4,%g3 +/* 0x1a50 */ add %g3,%g5,%g3 +/* 0x1a54 */ ld [%i1+12],%g5 +/* 0x1a58 */ add %g3,%g2,%g2 +/* 0x1a5c */ ld [%i1+16],%g3 +/* 0x1a60 */ sub %g2,%o3,%g2 +/* 0x1a64 */ st %g2,[%i4+4] +/* 0x1a68 */ ldx [%sp+264],%o1 +/* 0x1a6c */ srlx %g2,32,%g2 +/* 0x1a70 */ ldx [%sp+272],%o0 +/* 0x1a74 */ add %o0,%o1,%o0 +/* 0x1a78 */ ld [%i1+24],%o1 +/* 0x1a7c */ add %o0,%o4,%g4 +/* 0x1a80 */ ld [%i1+28],%o0 +/* 0x1a84 */ add %g4,%g2,%g4 + +! 283 ! ADD_S64_U32_E_8(8); + +/* 0x1a88 283 */ ld [%i1+32],%g2 +/* 0x1a8c 282 */ sub %g4,%o3,%g4 +/* 0x1a90 */ st %g4,[%i4+8] +/* 0x1a94 */ ldx [%sp+248],%o4 +/* 0x1a98 */ srlx %g4,32,%g4 +/* 0x1a9c */ ldx [%sp+256],%o3 +/* 0x1aa0 */ ldd [%o7+56],%f8 +/* 0x1aa4 */ add %o3,%o4,%o3 +/* 0x1aa8 */ ldx [%sp+96],%o7 +/* 0x1aac */ add %o3,%g5,%g5 +/* 0x1ab0 */ fxnor %f30,%f8,%f8 +/* 0x1ab4 281 */ std %f6,[%sp+360] +/* 0x1ab8 282 */ add %g5,%g4,%o4 +/* 0x1abc 281 */ std %f0,[%sp+368] +/* 0x1ac0 282 */ sub %o4,%o7,%o4 +/* 0x1ac4 */ st %o4,[%i4+12] +/* 0x1ac8 281 */ fitod %f8,%f10 +/* 0x1acc 282 */ ldx [%sp+232],%o7 +/* 0x1ad0 */ srlx %o4,32,%o4 +/* 0x1ad4 281 */ fitod %f9,%f8 +/* 0x1ad8 282 */ ldx [%sp+240],%g5 +/* 0x1adc 281 */ fsubd %f4,%f10,%f10 +/* 0x1ae0 283 */ ld [%i1+44],%g4 +/* 0x1ae4 282 */ add %g5,%o7,%g5 +/* 0x1ae8 */ ldx [%sp+96],%o7 +/* 0x1aec 281 */ fsubd %f4,%f8,%f6 +/* 0x1af0 282 */ add %g5,%g3,%g3 +/* 0x1af4 283 */ ld [%i1+48],%g5 +/* 0x1af8 282 */ add %g3,%o4,%g3 +/* 0x1afc 281 */ fmuld %f10,%f16,%f8 +/* 0x1b00 283 */ stx %g4,[%sp+320] +/* 0x1b04 282 */ sub %g3,%o7,%g3 +/* 0x1b08 */ st %g3,[%i4+16] +/* 0x1b0c 281 */ fmuld %f10,%f14,%f10 +/* 0x1b10 282 */ stx %g5,[%sp+312] +/* 0x1b14 */ srlx %g3,32,%g3 +/* 0x1b18 281 */ fmuld %f6,%f16,%f12 +/* 0x1b1c 282 */ ldx [%sp+224],%o7 +/* 0x1b20 281 */ faddd %f8,%f2,%f8 +/* 0x1b24 */ fmuld %f6,%f14,%f6 +/* 0x1b28 282 */ ldx [%sp+216],%g5 +/* 0x1b2c 281 */ fdtox %f10,%f10 +/* 0x1b30 283 */ ldx [%sp+368],%o4 +/* 0x1b34 282 */ add %o7,%g5,%g5 +/* 0x1b38 283 */ ldx [%sp+360],%g4 +/* 0x1b3c 281 */ fdtox %f8,%f8 +/* 0x1b40 282 */ add %g5,%o2,%o2 +/* 0x1b44 283 */ ld [%i1+52],%g5 +/* 0x1b48 281 */ fdtox %f6,%f6 +/* 0x1b4c 282 */ add %o2,%g3,%g3 +/* 0x1b50 */ ldx [%sp+96],%o2 +/* 0x1b54 283 */ add %o4,%g4,%g4 +/* 0x1b58 281 */ std %f10,[%sp+352] +/* 0x1b5c 283 */ add %g4,%g5,%o4 +/* 0x1b60 281 */ faddd %f12,%f2,%f10 +/* 0x1b64 282 */ sub %g3,%o2,%g3 +/* 0x1b68 */ st %g3,[%i4+20] +/* 0x1b6c */ ldx [%sp+200],%o7 +/* 0x1b70 */ srlx %g3,32,%g3 +/* 0x1b74 */ ldx [%sp+208],%o2 +/* 0x1b78 281 */ std %f8,[%sp+344] +/* 0x1b7c */ fdtox %f10,%f8 +/* 0x1b80 282 */ add %o2,%o7,%o2 +/* 0x1b84 281 */ std %f6,[%sp+336] +/* 0x1b88 282 */ add %o2,%o1,%g4 +/* 0x1b8c */ ldx [%sp+96],%o1 +/* 0x1b90 */ add %g4,%g3,%g3 +/* 0x1b94 283 */ ldx [%sp+352],%g5 +/* 0x1b98 282 */ sub %g3,%o1,%g3 +/* 0x1b9c */ st %g3,[%i4+24] +/* 0x1ba0 283 */ ldx [%sp+344],%o7 +/* 0x1ba4 282 */ srlx %g3,32,%g3 +/* 0x1ba8 281 */ std %f8,[%sp+328] +/* 0x1bac 282 */ ldx [%sp+192],%o1 +/* 0x1bb0 283 */ add %g5,%o7,%o2 +/* 0x1bb4 282 */ ldx [%sp+184],%g4 +/* 0x1bb8 283 */ ld [%i1+56],%g5 +/* 0x1bbc 282 */ add %o1,%g4,%g4 +/* 0x1bc0 */ ldx [%sp+96],%o7 +/* 0x1bc4 283 */ add %o2,%g5,%o2 +/* 0x1bc8 282 */ add %g4,%o0,%g4 +/* 0x1bcc 283 */ ldx [%sp+336],%o1 +/* 0x1bd0 */ ldx [%sp+328],%g5 +/* 0x1bd4 282 */ add %g4,%g3,%g3 +/* 0x1bd8 283 */ ld [%i1+60],%g4 +/* 0x1bdc 282 */ sub %g3,%o7,%g3 +/* 0x1be0 283 */ add %o1,%g5,%g5 +/* 0x1be4 282 */ st %g3,[%i4+28] +/* 0x1be8 283 */ add %g5,%g4,%o1 +/* 0x1bec */ ldx [%sp+176],%o0 +/* 0x1bf0 */ ldx [%sp+168],%g4 +/* 0x1bf4 */ srlx %g3,32,%g3 +/* 0x1bf8 */ ld [%i1+36],%o5 +/* 0x1bfc */ add %o0,%g4,%g4 +/* 0x1c00 */ ld [%i1+40],%o3 +/* 0x1c04 */ add %g4,%g2,%g2 +/* 0x1c08 */ add %g2,%g3,%g2 +/* 0x1c0c */ sub %g2,%o7,%g2 +/* 0x1c10 */ st %g2,[%i4+32] +/* 0x1c14 */ ldx [%sp+160],%g5 +/* 0x1c18 */ srlx %g2,32,%g2 +/* 0x1c1c */ ldx [%sp+152],%g4 +/* 0x1c20 */ add %g5,%g4,%g3 +/* 0x1c24 */ add %g3,%o5,%g3 +/* 0x1c28 */ add %g3,%g2,%g2 +/* 0x1c2c */ sub %g2,%o7,%g2 +/* 0x1c30 */ st %g2,[%i4+36] +/* 0x1c34 */ ldx [%sp+144],%g5 +/* 0x1c38 */ srlx %g2,32,%g2 +/* 0x1c3c */ ldx [%sp+136],%g4 +/* 0x1c40 */ add %g5,%g4,%g3 +/* 0x1c44 */ ldx [%sp+320],%g5 +/* 0x1c48 */ add %g3,%o3,%o3 +/* 0x1c4c */ add %o3,%g2,%o3 +/* 0x1c50 */ sub %o3,%o7,%o3 +/* 0x1c54 */ st %o3,[%i4+40] +/* 0x1c58 */ ldx [%sp+128],%g4 +/* 0x1c5c */ srlx %o3,32,%o3 +/* 0x1c60 */ ldx [%sp+120],%g3 +/* 0x1c64 */ add %g4,%g3,%g2 +/* 0x1c68 */ add %g2,%g5,%g2 +/* 0x1c6c */ ldx [%sp+312],%g5 +/* 0x1c70 */ add %g2,%o3,%o3 +/* 0x1c74 */ sub %o3,%o7,%o3 +/* 0x1c78 */ st %o3,[%i4+44] +/* 0x1c7c */ ldx [%sp+112],%g4 +/* 0x1c80 */ srlx %o3,32,%o3 +/* 0x1c84 */ ldx [%sp+104],%g3 +/* 0x1c88 */ add %g4,%g3,%g2 +/* 0x1c8c */ add %g2,%g5,%g2 +/* 0x1c90 */ add %g2,%o3,%o3 +/* 0x1c94 */ sub %o3,%o7,%o3 +/* 0x1c98 */ st %o3,[%i4+48] +/* 0x1c9c */ srlx %o3,32,%o3 +/* 0x1ca0 */ add %o4,%o3,%g2 +/* 0x1ca4 */ sub %g2,%o7,%g2 +/* 0x1ca8 */ st %g2,[%i4+52] +/* 0x1cac */ srlx %g2,32,%g2 +/* 0x1cb0 */ add %o2,%g2,%g2 +/* 0x1cb4 */ sub %g2,%o7,%g2 +/* 0x1cb8 */ st %g2,[%i4+56] +/* 0x1cbc */ srlx %g2,32,%g2 +/* 0x1cc0 */ add %o1,%g2,%g2 +/* 0x1cc4 */ sub %g2,%o7,%g2 +/* 0x1cc8 */ st %g2,[%i4+60] + +! 285 ! return uc; + +/* 0x1ccc 285 */ srlx %g2,32,%i0 +/* 0x1cd0 */ ret ! Result = %i0 +/* 0x1cd4 */ restore %g0,%g0,%g0 + .L77000106: + +! 287 ! } else { +! 288 ! DEF_VARS(2*BUFF_SIZE); +! 289 ! t_d64 d0, d1, db; +! 290 ! t_u32 uc = 0; +! 291 ! t_s32 i; +! 293 ! da = (t_d64)(a & A_MASK); +! 294 ! db = (t_d64)(a &~ A_MASK); + +/* 0x1cd8 294 */ or %g0,%g2,%g3 +/* 0x1cdc 293 */ andn %o0,%g2,%g2 +/* 0x1ce0 */ st %g2,[%sp+316] +/* 0x1ce4 288 */ fmovd %f30,%f14 +/* 0x1ce8 294 */ and %o0,%g3,%g2 +/* 0x1cec */ st %g2,[%sp+312] +/* 0x1cf0 290 */ or %g0,0,%g4 + +! 296 !#pragma pipeloop(0) +! 297 ! for (i = 0; i < (n+1)/2; i ++) { + +/* 0x1cf4 297 */ add %o2,1,%g2 +/* 0x1cf8 293 */ ldd [%o1],%f6 +/* 0x1cfc 285 */ sethi %hi(0x2c00),%g1 +/* 0x1d00 297 */ srl %g2,31,%g3 +/* 0x1d04 285 */ xor %g1,-8,%g1 +/* 0x1d08 288 */ ldd [%o1+8],%f22 +/* 0x1d0c 297 */ add %g2,%g3,%g2 +/* 0x1d10 293 */ fmovs %f6,%f8 +/* 0x1d14 285 */ add %g1,%fp,%g5 +/* 0x1d18 294 */ fmovs %f6,%f10 +/* 0x1d1c 293 */ ld [%sp+316],%f9 +/* 0x1d20 297 */ sra %g2,1,%o0 +/* 0x1d24 294 */ ld [%sp+312],%f11 +/* 0x1d28 297 */ cmp %o0,0 +/* 0x1d2c 285 */ sethi %hi(0x2800),%g1 +/* 0x1d30 293 */ fsubd %f8,%f6,%f20 +/* 0x1d34 285 */ xor %g1,-1024,%g1 +/* 0x1d38 */ ldd [%o1+16],%f16 +/* 0x1d3c 294 */ fsubd %f10,%f6,%f18 +/* 0x1d40 297 */ ble,pt %icc,.L900000193 +/* 0x1d44 */ cmp %o3,0 +/* 0x1d48 285 */ add %g1,%fp,%g3 +/* 0x1d4c */ sethi %hi(0x2800),%g1 +/* 0x1d50 */ xor %g1,-1016,%g1 +/* 0x1d54 */ or %g0,%o7,%o1 +/* 0x1d58 */ add %g1,%fp,%g2 +/* 0x1d5c */ sethi %hi(0x2800),%g1 +/* 0x1d60 */ xor %g1,-1008,%g1 +/* 0x1d64 */ sub %o0,1,%o2 +/* 0x1d68 297 */ cmp %o0,7 +/* 0x1d6c */ or %g0,0,%i0 +/* 0x1d70 285 */ add %g1,%fp,%o7 +/* 0x1d74 297 */ bl,pn %icc,.L77000107 +/* 0x1d78 */ add %o1,8,%o0 +/* 0x1d7c */ ldd [%o1],%f2 + +! 298 ! MUL_U32_S64_2_E(i); + +/* 0x1d80 298 */ add %i2,16,%i1 +/* 0x1d84 297 */ sub %o2,2,%o1 +/* 0x1d88 */ ldd [%o0],%f0 +/* 0x1d8c 298 */ or %g0,4,%i0 +/* 0x1d90 */ add %i1,8,%o0 +/* 0x1d94 */ fxnor %f30,%f2,%f6 +/* 0x1d98 */ ldd [%i2+16],%f4 +/* 0x1d9c */ fxnor %f30,%f0,%f12 +/* 0x1da0 */ ldd [%i2+24],%f0 +/* 0x1da4 */ fitod %f7,%f2 +/* 0x1da8 */ fitod %f6,%f6 +/* 0x1dac */ fxnor %f30,%f4,%f10 +/* 0x1db0 */ fsubd %f22,%f2,%f2 +/* 0x1db4 */ fxnor %f30,%f0,%f8 +/* 0x1db8 */ fitod %f13,%f4 +/* 0x1dbc */ fsubd %f22,%f6,%f6 +/* 0x1dc0 */ fmuld %f2,%f20,%f0 + .L900000185: +/* 0x1dc4 298 */ fitod %f11,%f26 +/* 0x1dc8 */ add %i0,3,%i0 +/* 0x1dcc */ add %o7,96,%o7 +/* 0x1dd0 */ fmuld %f2,%f18,%f32 +/* 0x1dd4 */ fsubd %f22,%f4,%f4 +/* 0x1dd8 */ add %o0,8,%o0 +/* 0x1ddc */ cmp %i0,%o1 +/* 0x1de0 */ fmuld %f6,%f18,%f30 +/* 0x1de4 */ ldd [%o0],%f2 +/* 0x1de8 */ add %g2,96,%g2 +/* 0x1dec */ add %g3,96,%g3 +/* 0x1df0 */ fdtox %f0,%f24 +/* 0x1df4 */ fmuld %f6,%f20,%f28 +/* 0x1df8 */ faddd %f32,%f16,%f0 +/* 0x1dfc */ add %g5,96,%g5 +/* 0x1e00 */ faddd %f30,%f16,%f30 +/* 0x1e04 */ fitod %f12,%f6 +/* 0x1e08 */ fdtox %f28,%f28 +/* 0x1e0c */ fdtox %f30,%f12 +/* 0x1e10 */ std %f28,[%g5-96] +/* 0x1e14 */ std %f12,[%g3-96] +/* 0x1e18 */ fdtox %f0,%f0 +/* 0x1e1c */ fsubd %f22,%f6,%f28 +/* 0x1e20 */ std %f24,[%g2-96] +/* 0x1e24 */ fxnor %f14,%f2,%f12 +/* 0x1e28 */ fmuld %f4,%f20,%f24 +/* 0x1e2c */ std %f0,[%o7-96] +/* 0x1e30 */ fitod %f9,%f2 +/* 0x1e34 */ fmuld %f4,%f18,%f4 +/* 0x1e38 */ fsubd %f22,%f26,%f0 +/* 0x1e3c */ fmuld %f28,%f18,%f26 +/* 0x1e40 */ add %o0,8,%o0 +/* 0x1e44 */ ldd [%o0],%f6 +/* 0x1e48 */ fdtox %f24,%f24 +/* 0x1e4c */ faddd %f4,%f16,%f4 +/* 0x1e50 */ fmuld %f28,%f20,%f28 +/* 0x1e54 */ faddd %f26,%f16,%f26 +/* 0x1e58 */ fitod %f10,%f10 +/* 0x1e5c */ fdtox %f28,%f28 +/* 0x1e60 */ fdtox %f26,%f26 +/* 0x1e64 */ std %f28,[%g5-64] +/* 0x1e68 */ std %f26,[%g3-64] +/* 0x1e6c */ fdtox %f4,%f4 +/* 0x1e70 */ fsubd %f22,%f10,%f28 +/* 0x1e74 */ std %f24,[%g2-64] +/* 0x1e78 */ fxnor %f14,%f6,%f10 +/* 0x1e7c */ fmuld %f0,%f20,%f26 +/* 0x1e80 */ std %f4,[%o7-64] +/* 0x1e84 */ fitod %f13,%f4 +/* 0x1e88 */ fmuld %f0,%f18,%f0 +/* 0x1e8c */ fsubd %f22,%f2,%f2 +/* 0x1e90 */ fmuld %f28,%f18,%f6 +/* 0x1e94 */ add %o0,8,%o0 +/* 0x1e98 */ ldd [%o0],%f24 +/* 0x1e9c */ fdtox %f26,%f26 +/* 0x1ea0 */ faddd %f0,%f16,%f0 +/* 0x1ea4 */ fmuld %f28,%f20,%f28 +/* 0x1ea8 */ faddd %f6,%f16,%f30 +/* 0x1eac */ fitod %f8,%f6 +/* 0x1eb0 */ fdtox %f28,%f28 +/* 0x1eb4 */ fdtox %f30,%f8 +/* 0x1eb8 */ std %f28,[%g5-32] +/* 0x1ebc */ std %f8,[%g3-32] +/* 0x1ec0 */ fdtox %f0,%f0 +/* 0x1ec4 */ fsubd %f22,%f6,%f6 +/* 0x1ec8 */ std %f26,[%g2-32] +/* 0x1ecc */ fxnor %f14,%f24,%f8 +/* 0x1ed0 */ std %f0,[%o7-32] +/* 0x1ed4 */ ble,pt %icc,.L900000185 +/* 0x1ed8 */ fmuld %f2,%f20,%f0 + .L900000188: +/* 0x1edc 298 */ fitod %f12,%f24 +/* 0x1ee0 */ fmuld %f6,%f18,%f26 +/* 0x1ee4 */ add %g5,128,%g5 +/* 0x1ee8 */ fitod %f10,%f12 +/* 0x1eec */ fmuld %f6,%f20,%f28 +/* 0x1ef0 */ add %g3,128,%g3 +/* 0x1ef4 */ fsubd %f22,%f4,%f4 +/* 0x1ef8 */ fmuld %f2,%f18,%f2 +/* 0x1efc */ add %g2,128,%g2 +/* 0x1f00 */ fsubd %f22,%f24,%f24 +/* 0x1f04 */ add %o7,128,%o7 +/* 0x1f08 */ cmp %i0,%o2 +/* 0x1f0c */ faddd %f26,%f16,%f6 +/* 0x1f10 */ add %o0,8,%o1 +/* 0x1f14 */ fdtox %f28,%f28 +/* 0x1f18 */ std %f28,[%g5-128] +/* 0x1f1c */ fmuld %f4,%f18,%f30 +/* 0x1f20 */ faddd %f2,%f16,%f2 +/* 0x1f24 */ fmuld %f24,%f18,%f26 +/* 0x1f28 */ fitod %f11,%f10 +/* 0x1f2c */ fmuld %f24,%f20,%f28 +/* 0x1f30 */ fsubd %f22,%f12,%f24 +/* 0x1f34 */ fmuld %f4,%f20,%f4 +/* 0x1f38 */ fdtox %f6,%f6 +/* 0x1f3c */ std %f6,[%g3-128] +/* 0x1f40 */ fdtox %f0,%f0 +/* 0x1f44 */ std %f0,[%g2-128] +/* 0x1f48 */ fitod %f8,%f6 +/* 0x1f4c */ fmuld %f24,%f18,%f12 +/* 0x1f50 */ fdtox %f2,%f0 +/* 0x1f54 */ std %f0,[%o7-128] +/* 0x1f58 */ fmuld %f24,%f20,%f24 +/* 0x1f5c */ fsubd %f22,%f10,%f10 +/* 0x1f60 */ faddd %f26,%f16,%f26 +/* 0x1f64 */ fitod %f9,%f2 +/* 0x1f68 */ fsubd %f22,%f6,%f6 +/* 0x1f6c */ fmuld %f10,%f18,%f0 +/* 0x1f70 */ fdtox %f28,%f28 +/* 0x1f74 */ std %f28,[%g5-96] +/* 0x1f78 */ fmuld %f10,%f20,%f10 +/* 0x1f7c */ faddd %f30,%f16,%f8 +/* 0x1f80 */ fdtox %f26,%f26 +/* 0x1f84 */ std %f26,[%g3-96] +/* 0x1f88 */ fdtox %f4,%f4 +/* 0x1f8c */ std %f4,[%g2-96] +/* 0x1f90 */ fsubd %f22,%f2,%f2 +/* 0x1f94 */ fmuld %f6,%f18,%f4 +/* 0x1f98 */ faddd %f12,%f16,%f12 +/* 0x1f9c */ fmuld %f6,%f20,%f6 +/* 0x1fa0 */ fdtox %f8,%f8 +/* 0x1fa4 */ std %f8,[%o7-96] +/* 0x1fa8 */ faddd %f0,%f16,%f8 +/* 0x1fac */ fmuld %f2,%f18,%f0 +/* 0x1fb0 */ fdtox %f24,%f24 +/* 0x1fb4 */ std %f24,[%g5-64] +/* 0x1fb8 */ fmuld %f2,%f20,%f2 +/* 0x1fbc */ fdtox %f12,%f12 +/* 0x1fc0 */ std %f12,[%g3-64] +/* 0x1fc4 */ fdtox %f10,%f10 +/* 0x1fc8 */ std %f10,[%g2-64] +/* 0x1fcc */ faddd %f4,%f16,%f4 +/* 0x1fd0 */ fdtox %f8,%f8 +/* 0x1fd4 */ std %f8,[%o7-64] +/* 0x1fd8 */ faddd %f0,%f16,%f0 +/* 0x1fdc */ fdtox %f6,%f6 +/* 0x1fe0 */ std %f6,[%g5-32] +/* 0x1fe4 */ fdtox %f4,%f4 +/* 0x1fe8 */ std %f4,[%g3-32] +/* 0x1fec */ fdtox %f2,%f2 +/* 0x1ff0 */ std %f2,[%g2-32] +/* 0x1ff4 */ fdtox %f0,%f0 +/* 0x1ff8 */ bg,pn %icc,.L77000084 +/* 0x1ffc */ std %f0,[%o7-32] + .L77000107: +/* 0x2000 */ ldd [%o1],%f0 + .L900000192: +/* 0x2004 */ fxnor %f14,%f0,%f2 +/* 0x2008 298 */ add %i0,1,%i0 +/* 0x200c */ add %o1,8,%o1 +/* 0x2010 */ cmp %i0,%o2 +/* 0x2014 */ fitod %f2,%f0 +/* 0x2018 */ fitod %f3,%f2 +/* 0x201c */ fsubd %f22,%f0,%f0 +/* 0x2020 */ fsubd %f22,%f2,%f2 +/* 0x2024 */ fmuld %f0,%f18,%f4 +/* 0x2028 */ fmuld %f0,%f20,%f6 +/* 0x202c */ fmuld %f2,%f18,%f0 +/* 0x2030 */ faddd %f4,%f16,%f4 +/* 0x2034 */ fmuld %f2,%f20,%f2 +/* 0x2038 */ fdtox %f6,%f6 +/* 0x203c */ std %f6,[%g5] +/* 0x2040 */ add %g5,32,%g5 +/* 0x2044 */ faddd %f0,%f16,%f0 +/* 0x2048 */ fdtox %f4,%f4 +/* 0x204c */ std %f4,[%g3] +/* 0x2050 */ add %g3,32,%g3 +/* 0x2054 */ fdtox %f2,%f2 +/* 0x2058 */ std %f2,[%g2] +/* 0x205c */ add %g2,32,%g2 +/* 0x2060 */ fdtox %f0,%f0 +/* 0x2064 */ std %f0,[%o7] +/* 0x2068 */ add %o7,32,%o7 +/* 0x206c */ ble,a,pt %icc,.L900000192 +/* 0x2070 */ ldd [%o1],%f0 + .L77000084: + +! 299 ! } +! 301 !#pragma pipeloop(0) +! 302 ! for (i = 0; i < n; i ++) { + +/* 0x2074 302 */ cmp %o3,0 + .L900000193: +/* 0x2078 302 */ ble,pt %icc,.L77000089 +/* 0x207c */ or %g0,%g4,%i0 +/* 0x2080 */ sethi %hi(0x2c00),%g1 +/* 0x2084 */ xor %g1,-8,%g1 +/* 0x2088 */ or %g0,%o4,%i1 +/* 0x208c */ add %g1,%fp,%g5 +/* 0x2090 */ sethi %hi(0x2800),%g1 +/* 0x2094 */ xor %g1,-1024,%g1 +/* 0x2098 */ or %g0,0,%i2 +/* 0x209c */ add %g1,%fp,%g3 +/* 0x20a0 */ sub %o3,1,%o7 +/* 0x20a4 */ or %g0,%i4,%i0 +/* 0x20a8 298 */ cmp %o3,7 +/* 0x20ac */ bl,pn %icc,.L77000108 +/* 0x20b0 */ sethi %hi(0x2c00),%g1 +/* 0x20b4 */ sub %o3,4,%o4 + +! 303 ! ADD_S64_U32_E(i); + +/* 0x20b8 303 */ ld [%i1],%o3 +/* 0x20bc */ xor %g1,-8,%g1 +/* 0x20c0 */ ld [%i1+4],%o1 +/* 0x20c4 */ sethi %hi(0x80000000),%o5 +/* 0x20c8 */ add %g1,%fp,%g1 +/* 0x20cc */ add %i4,4,%i0 +/* 0x20d0 */ ldx [%g1+8],%o2 +/* 0x20d4 */ sllx %o5,32,%o5 +/* 0x20d8 */ add %i1,8,%i1 +/* 0x20dc */ ldx [%g1],%o0 +/* 0x20e0 */ or %g0,3,%i2 +/* 0x20e4 */ ldx [%g1+24],%g2 +/* 0x20e8 */ add %o0,%o2,%o0 +/* 0x20ec */ ldx [%g1+16],%o2 +/* 0x20f0 */ sethi %hi(0x2800),%g1 +/* 0x20f4 */ xor %g1,-992,%g1 +/* 0x20f8 */ add %o0,%o3,%o0 +/* 0x20fc */ add %g1,%fp,%g3 +/* 0x2100 */ sethi %hi(0x2800),%g1 +/* 0x2104 */ xor %g1,-1000,%g1 +/* 0x2108 */ sub %o0,%o5,%o0 +/* 0x210c */ add %g1,%fp,%g1 +/* 0x2110 */ add %o2,%g2,%o2 +/* 0x2114 */ ldx [%g1],%o3 +/* 0x2118 */ sethi %hi(0x2800),%g1 +/* 0x211c */ st %o0,[%i4] +/* 0x2120 */ srlx %o0,32,%o0 +/* 0x2124 */ xor %g1,-984,%g1 +/* 0x2128 */ add %g1,%fp,%g5 + .L900000165: +/* 0x212c 303 */ ldx [%g3],%g4 +/* 0x2130 */ srl %o0,0,%g2 +/* 0x2134 */ add %o2,%o1,%o0 +/* 0x2138 */ ld [%i1],%o2 +/* 0x213c */ add %o0,%g2,%g2 +/* 0x2140 */ add %i2,4,%i2 +/* 0x2144 */ ldx [%g5],%o1 +/* 0x2148 */ add %o3,%g4,%o0 +/* 0x214c */ sub %g2,%o5,%o3 +/* 0x2150 */ st %o3,[%i0] +/* 0x2154 */ srlx %o3,32,%o3 +/* 0x2158 */ cmp %i2,%o4 +/* 0x215c */ ldx [%g3+16],%g2 +/* 0x2160 */ add %o0,%o2,%o0 +/* 0x2164 */ ld [%i1+4],%o2 +/* 0x2168 */ add %o0,%o3,%o3 +/* 0x216c */ add %i0,16,%i0 +/* 0x2170 */ ldx [%g5+16],%o0 +/* 0x2174 */ add %o1,%g2,%o1 +/* 0x2178 */ sub %o3,%o5,%o3 +/* 0x217c */ st %o3,[%i0-12] +/* 0x2180 */ srlx %o3,32,%g4 +/* 0x2184 */ add %i1,16,%i1 +/* 0x2188 */ ldx [%g3+32],%g2 +/* 0x218c */ add %o1,%o2,%o2 +/* 0x2190 */ ld [%i1-8],%o1 +/* 0x2194 */ add %o2,%g4,%o3 +/* 0x2198 */ add %g3,64,%g3 +/* 0x219c */ ldx [%g5+32],%o2 +/* 0x21a0 */ add %o0,%g2,%o0 +/* 0x21a4 */ sub %o3,%o5,%o3 +/* 0x21a8 */ st %o3,[%i0-8] +/* 0x21ac */ srlx %o3,32,%o3 +/* 0x21b0 */ add %g5,64,%g5 +/* 0x21b4 */ ldx [%g3-16],%g2 +/* 0x21b8 */ add %o0,%o1,%o0 +/* 0x21bc */ ld [%i1-4],%o1 +/* 0x21c0 */ add %o0,%o3,%o0 +/* 0x21c4 */ ldx [%g5-16],%o3 +/* 0x21c8 */ add %o2,%g2,%o2 +/* 0x21cc */ sub %o0,%o5,%o0 +/* 0x21d0 */ st %o0,[%i0-4] +/* 0x21d4 */ ble,pt %icc,.L900000165 +/* 0x21d8 */ srlx %o0,32,%o0 + .L900000168: +/* 0x21dc 303 */ srl %o0,0,%o4 +/* 0x21e0 */ ldx [%g3],%o0 +/* 0x21e4 */ add %o2,%o1,%o1 +/* 0x21e8 */ ld [%i1],%o2 +/* 0x21ec */ add %o1,%o4,%o1 +/* 0x21f0 */ add %i0,8,%i0 +/* 0x21f4 */ sub %o1,%o5,%o1 +/* 0x21f8 */ add %o3,%o0,%o0 +/* 0x21fc */ st %o1,[%i0-8] +/* 0x2200 */ srlx %o1,32,%o1 +/* 0x2204 */ add %o0,%o2,%o0 +/* 0x2208 */ add %o0,%o1,%o0 +/* 0x220c */ cmp %i2,%o7 +/* 0x2210 */ sub %o0,%o5,%o0 +/* 0x2214 */ st %o0,[%i0-4] +/* 0x2218 */ bg,pn %icc,.L77000088 +/* 0x221c */ srlx %o0,32,%g4 +/* 0x2220 */ add %i1,4,%i1 +/* 0x2224 */ add %g3,16,%g3 + .L77000108: +/* 0x2228 303 */ ldx [%g5],%o0 + .L900000191: +/* 0x222c 303 */ sethi %hi(0x80000000),%o2 +/* 0x2230 */ ldx [%g3],%o3 +/* 0x2234 */ add %i2,1,%i2 +/* 0x2238 */ sllx %o2,32,%o5 +/* 0x223c */ ld [%i1],%o2 +/* 0x2240 */ add %g5,16,%g5 +/* 0x2244 */ srl %g4,0,%o1 +/* 0x2248 */ add %o0,%o3,%o0 +/* 0x224c */ add %o0,%o2,%o0 +/* 0x2250 */ add %i1,4,%i1 +/* 0x2254 */ add %o0,%o1,%o0 +/* 0x2258 */ add %g3,16,%g3 +/* 0x225c */ sub %o0,%o5,%o0 +/* 0x2260 */ st %o0,[%i0] +/* 0x2264 */ cmp %i2,%o7 +/* 0x2268 */ srlx %o0,32,%g4 +/* 0x226c */ add %i0,4,%i0 +/* 0x2270 */ ble,a,pt %icc,.L900000191 +/* 0x2274 */ ldx [%g5],%o0 + .L77000088: + +! 304 ! } +! 306 ! return uc; + +/* 0x2278 306 */ or %g0,%g4,%i0 + .L77000089: +/* 0x227c */ ret ! Result = %i0 +/* 0x2280 */ restore %g0,%g0,%g0 +/* 0x2284 0 */ .type mul_add,2 +/* 0x2284 */ .size mul_add,(.-mul_add) + + .section ".text",#alloc,#execinstr +/* 000000 0 */ .align 4 +! +! SUBROUTINE mul_add_inp +! +! OFFSET SOURCE LINE LABEL INSTRUCTION + + .global mul_add_inp + mul_add_inp: +/* 000000 */ or %g0,%o2,%g1 +/* 0x0004 */ or %g0,%o0,%g3 +/* 0x0008 */ or %g0,%o1,%g2 +/* 0x000c */ or %g0,%o3,%o4 + +! 307 ! } +! 308 ! } +! 309 !} +! 311 !/***************************************************************/ +! 313 !t_u32 mul_add_inp(t_u32 *x, t_u32 *y, int n, t_u32 a) +! 314 !{ +! 315 ! return mul_add(x, x, y, n, a); + +/* 0x0010 315 */ or %g0,%g1,%o3 +/* 0x0014 */ or %g0,%g3,%o1 +/* 0x0018 */ or %g0,%g2,%o2 +/* 0x001c */ or %g0,%o7,%g1 +/* 0x0020 */ call mul_add ! params = %o0 %o1 %o2 %o3 %o4 ! Result = ! (tail call) +/* 0x0024 */ or %g0,%g1,%o7 +/* 0x0028 0 */ .type mul_add_inp,2 +/* 0x0028 */ .size mul_add_inp,(.-mul_add_inp) + +! Begin Disassembling Stabs + .xstabs ".stab.index","Xa ; O ; P ; V=3.1 ; R=WorkShop Compilers 5.0 98/12/15 C 5.0",60,0,0,0 ! (/usr/tmp/acompAAA52aaHc:1) + .xstabs ".stab.index","/h/interzone/d3/nelsonb/nss_28x/ns/security/lib/crypto; /tools/ns/workshop-5.0/bin/../SC5.0/bin/cc -fast -xO5 -xrestrict=%%all -xdepend -xchip=ultra -xarch=v8plusa -KPIC -mt -S vis_32.il mul_add.c -W0,-xp",52,0,0,0 ! (/usr/tmp/acompAAA52aaHc:2) +! End Disassembling Stabs + +! Begin Disassembling Ident + .ident "cg: WorkShop Compilers 5.0 99/08/12 Compiler Common 5.0 Patch 107357-05" ! (NO SOURCE LINE) + .ident "@(#)vis_proto.h\t1.3\t97/03/30 SMI" ! (/usr/tmp/acompAAA52aaHc:4) + .ident "acomp: WorkShop Compilers 5.0 98/12/15 C 5.0" ! (/usr/tmp/acompAAA52aaHc:12) +! End Disassembling Ident diff --git a/security/nss/lib/freebl/rsa.c b/security/nss/lib/freebl/rsa.c index ff748ba3b..e91ed3c22 100644 --- a/security/nss/lib/freebl/rsa.c +++ b/security/nss/lib/freebl/rsa.c @@ -259,6 +259,7 @@ RSA_NewKey(int keySizeInBits, SECItem *publicExponent) SECITEM_TO_MPINT(*publicExponent, &e); kiter = 0; do { + prerr = 0; PORT_SetError(0); CHECK_SEC_OK( generate_prime(&p, primeLen) ); CHECK_SEC_OK( generate_prime(&q, primeLen) ); diff --git a/security/nss/lib/nss/nss.def b/security/nss/lib/nss/nss.def index 755fec374..bedb16f27 100644 --- a/security/nss/lib/nss/nss.def +++ b/security/nss/lib/nss/nss.def @@ -447,3 +447,12 @@ PK11_NeedUserInit; ;+ local: ;+ *; ;+}; +;+NSS_3.2.1 { # NSS 3.2 release +;+ global: +CERT_AddRDN; +CERT_CreateRDN; +CERT_CreateAVA; +CERT_CreateName; +;+ local: +;+ *; +;+}; diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h index 1be4ad8f0..db55cd159 100644 --- a/security/nss/lib/nss/nss.h +++ b/security/nss/lib/nss/nss.h @@ -49,10 +49,10 @@ SEC_BEGIN_PROTOS * The format of the version string should be * "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define NSS_VERSION "3.2" +#define NSS_VERSION "3.2.1" #define NSS_VMAJOR 3 #define NSS_VMINOR 2 -#define NSS_VPATCH 0 +#define NSS_VPATCH 1 #define NSS_BETA PR_FALSE diff --git a/security/nss/lib/pk11wrap/pk11cert.c b/security/nss/lib/pk11wrap/pk11cert.c index bcf6b16e6..2306a3eee 100644 --- a/security/nss/lib/pk11wrap/pk11cert.c +++ b/security/nss/lib/pk11wrap/pk11cert.c @@ -2570,7 +2570,17 @@ pk11ListCertCallback(CERTCertificate *cert, SECItem *derCert, void *arg) PK11CertListType type = listCertP->type; CERTCertList *certList = listCertP->certList; CERTCertTrust *trust; + PRBool isUnique = PR_FALSE; + char *nickname = NULL; + + if ((type == PK11CertListUnique) || (type == PK11CertListRootUnique)) { + isUnique = PR_TRUE; + } + /* at this point the nickname is correct for the cert. save it for later */ + if (!isUnique) { + nickname = PORT_ArenaStrdup(listCertP->certList->arena,cert->nickname); + } if (derCert == NULL) { newCert=CERT_DupCertificate(cert); } else { @@ -2583,16 +2593,24 @@ pk11ListCertCallback(CERTCertificate *cert, SECItem *derCert, void *arg) /* if we want user certs and we don't have one skip this cert */ if ((type == PK11CertListUser) && - ( (cert->slot == NULL) || - (trust == NULL) || (((trust->sslFlags & CERTDB_USER == 0) && - ((trust->emailFlags & CERTDB_USER) == 0))) ) ) { + ((trust == NULL) || + ( ((trust->sslFlags & CERTDB_USER) == 0) && + ((trust->emailFlags & CERTDB_USER) == 0) )) ) { + CERT_DestroyCertificate(newCert); + return SECSuccess; + } + + /* if we want root certs, skip the user certs */ + if ((type == PK11CertListRootUnique) && + ((trust) && (((trust->sslFlags & CERTDB_USER ) || + (trust->emailFlags & CERTDB_USER))) ) ) { CERT_DestroyCertificate(newCert); return SECSuccess; } /* if we want Unique certs and we already have it on our list, skip it */ - if ((type == PK11CertListUnique) && (isOnList(certList,newCert))) { + if ( isUnique && isOnList(certList,newCert) ) { CERT_DestroyCertificate(newCert); return SECSuccess; } @@ -2600,9 +2618,9 @@ pk11ListCertCallback(CERTCertificate *cert, SECItem *derCert, void *arg) /* put slot certs at the end */ if (newCert->slot && !PK11_IsInternal(newCert->slot)) { - CERT_AddCertToListTail(certList,newCert); + CERT_AddCertToListTailWithData(certList,newCert,nickname); } else { - CERT_AddCertToListHead(certList,newCert); + CERT_AddCertToListHeadWithData(certList,newCert,nickname); } return SECSuccess; } @@ -2618,7 +2636,8 @@ PK11_ListCerts(PK11CertListType type, void *pwarg) listCerts.type = type; listCerts.certList = certList; - SEC_TraversePermCerts(CERT_GetDefaultCertDB(),pk11ListCertCallback,&listCerts); + SEC_TraversePermCerts(CERT_GetDefaultCertDB(),pk11ListCertCallback, + &listCerts); PK11_TraverseSlotCerts(pk11ListCertCallback,&listCerts,pwarg); diff --git a/security/nss/lib/pk11wrap/pk11slot.c b/security/nss/lib/pk11wrap/pk11slot.c index 571177438..3f3f453cd 100644 --- a/security/nss/lib/pk11wrap/pk11slot.c +++ b/security/nss/lib/pk11wrap/pk11slot.c @@ -1666,7 +1666,7 @@ PK11_InitToken(PK11SlotInfo *slot, PRBool loadCerts) /* initialize the maxKeyCount value */ if (tokenInfo.ulMaxSessionCount == 0) { - slot->maxKeyCount = 300; /* should be #define or a config param */ + slot->maxKeyCount = 800; /* should be #define or a config param */ } else if (tokenInfo.ulMaxSessionCount < 20) { /* don't have enough sessions to keep that many keys around */ slot->maxKeyCount = 0; diff --git a/security/nss/lib/pk11wrap/secmodt.h b/security/nss/lib/pk11wrap/secmodt.h index 949edee26..b2d401e24 100644 --- a/security/nss/lib/pk11wrap/secmodt.h +++ b/security/nss/lib/pk11wrap/secmodt.h @@ -97,8 +97,9 @@ struct PK11RSAGenParamsStr { }; typedef enum { - PK11CertListUnique = 0, - PK11CertListUser = 1 + PK11CertListUnique = 0, + PK11CertListUser = 1, + PK11CertListRootUnique = 2 } PK11CertListType; /* diff --git a/security/nss/lib/pkcs12/p12d.c b/security/nss/lib/pkcs12/p12d.c index f822a7778..9abae13c8 100644 --- a/security/nss/lib/pkcs12/p12d.c +++ b/security/nss/lib/pkcs12/p12d.c @@ -703,6 +703,9 @@ sec_pkcs12_decoder_safe_contents_callback(void *arg, const char *buf, /* update the decoder */ rv = SEC_ASN1DecoderUpdate(safeContentsCtx->safeContentsDcx, buf, len); if(rv != SECSuccess) { + /* if we fail while trying to decode a 'safe', it's probably because + * we didn't have the correct password. */ + PORT_SetError(SEC_ERROR_BAD_PASSWORD); p12dcx->errorValue = SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE; goto loser; } diff --git a/security/nss/lib/smime/smime.def b/security/nss/lib/smime/smime.def index f1c0f293d..31bf8d4ae 100644 --- a/security/nss/lib/smime/smime.def +++ b/security/nss/lib/smime/smime.def @@ -169,3 +169,9 @@ SEC_PKCS12SetPreferredCipher; ;+ local: ;+ *; ;+}; +;+NSS_3.2.1 { # NSS 3.2.1 release +;+ global: +NSSSMIME_VersionCheck; +;+ local: +;+ *; +;+}; diff --git a/security/nss/lib/smime/smimeutil.c b/security/nss/lib/smime/smimeutil.c index 1a4d4073e..b76a58883 100644 --- a/security/nss/lib/smime/smimeutil.c +++ b/security/nss/lib/smime/smimeutil.c @@ -715,3 +715,28 @@ loser: return cert; } + +extern const char __nss_smime_rcsid[]; +extern const char __nss_smime_sccsid[]; + +PRBool +NSSSMIME_VersionCheck(const char *importedVersion) +{ + /* + * This is the secret handshake algorithm. + * + * This release has a simple version compatibility + * check algorithm. This release is not backward + * compatible with previous major releases. It is + * not compatible with future major, minor, or + * patch releases. + */ + int vmajor = 0, vminor = 0, vpatch = 0; + const char *ptr = importedVersion; + volatile char c; /* force a reference that won't get optimized away */ + + c = __nss_smime_rcsid[0] + __nss_smime_sccsid[0]; + + return NSS_VersionCheck(importedVersion); +} + diff --git a/security/nss/lib/ssl/ssl.def b/security/nss/lib/ssl/ssl.def index c0a23f923..0fee478ba 100644 --- a/security/nss/lib/ssl/ssl.def +++ b/security/nss/lib/ssl/ssl.def @@ -99,3 +99,9 @@ SSL_SetURL; ;+ local: ;+*; ;+}; +;+NSS_3.2.1 { # NSS 3.2.1 release +;+ global: +NSSSSL_VersionCheck; +;+ local: +;+*; +;+}; diff --git a/security/nss/lib/ssl/sslcon.c b/security/nss/lib/ssl/sslcon.c index 05d5ed744..dc57e73f5 100644 --- a/security/nss/lib/ssl/sslcon.c +++ b/security/nss/lib/ssl/sslcon.c @@ -3684,3 +3684,25 @@ loser: return SECFailure; } +extern const char __nss_ssl_rcsid[]; +extern const char __nss_ssl_sccsid[]; + +PRBool +NSSSSL_VersionCheck(const char *importedVersion) +{ + /* + * This is the secret handshake algorithm. + * + * This release has a simple version compatibility + * check algorithm. This release is not backward + * compatible with previous major releases. It is + * not compatible with future major, minor, or + * patch releases. + */ + int vmajor = 0, vminor = 0, vpatch = 0; + const char *ptr = importedVersion; + volatile char c; /* force a reference that won't get optimized away */ + + c = __nss_ssl_rcsid[0] + __nss_ssl_sccsid[0]; + return NSS_VersionCheck(importedVersion); +} diff --git a/security/nss/lib/ssl/sslsocks.c b/security/nss/lib/ssl/sslsocks.c new file mode 100644 index 000000000..d82d72c06 --- /dev/null +++ b/security/nss/lib/ssl/sslsocks.c @@ -0,0 +1,1157 @@ +/* + * Implementation of Socks protocol. + * None of this code is supported any longer. + * NSS officially does NOT support Socks. + * + * 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. + * + * $Id$ + */ +#include "prtypes.h" +#include "prnetdb.h" +#include "cert.h" +#include "ssl.h" +#include "sslimpl.h" +#include "prsystem.h" +#include <stdio.h> +#include "nspr.h" + +#ifdef XP_UNIX +#include "prprf.h" +#endif + +#ifdef XP_UNIX +#define SOCKS_FILE "/etc/socks.conf" +#endif +#ifdef XP_MAC +#define SOCKS_FILE NULL +#endif +#ifdef XP_WIN +#define SOCKS_FILE NULL +#endif +#ifdef XP_OS2 +#define SOCKS_FILE NULL +#endif + +#define SOCKS_VERSION 4 + +#define DEF_SOCKD_PORT 1080 + +#define SOCKS_CONNECT 1 +#define SOCKS_BIND 2 + +#define SOCKS_RESULT 90 +#define SOCKS_FAIL 91 +#define SOCKS_NO_IDENTD 92 /* Failed to connect to Identd on client machine */ +#define SOCKS_BAD_ID 93 /* Client's Identd reported a different user-id */ + +#define MAKE_IN_ADDR(a,b,c,d) \ + PR_htonl(((PRUint32)(a) << 24) | ((PRUint32)(b) << 16) | ((c) << 8) | (d)) + +struct sslSocksInfoStr { + PRUint32 sockdHost; + PRUint16 sockdPort; + + char direct; + char didBind; + + PRNetAddr bindAddr; + + /* Data returned by sockd. */ + PRUint32 destHost; + PRUint16 destPort; +}; + +typedef enum { + OP_LESS = 1, + OP_EQUAL = 2, + OP_LEQUAL = 3, + OP_GREATER = 4, + OP_NOTEQUAL = 5, + OP_GEQUAL = 6, + OP_ALWAYS = 7 +} SocksOp; + +typedef struct SocksConfItemStr SocksConfItem; + +struct SocksConfItemStr { + SocksConfItem *next; + PRUint32 daddr; /* host IP addr, in network byte order. */ + PRUint32 dmask; /* mask for IP, in network byte order. */ + PRUint16 port; /* port number, in host byte order. */ + SocksOp op; + char direct; +}; + +static PRUint32 ourHost; /* network byte order. */ +static SocksConfItem *ssl_socks_confs; + +SECStatus +ssl_CreateSocksInfo(sslSocket *ss) +{ + sslSocksInfo *si; + + if (ss->socks) { + /* Already been done */ + return SECSuccess; + } + + si = (sslSocksInfo*) PORT_ZAlloc(sizeof(sslSocksInfo)); + if (si) { + ss->socks = si; + if (!ss->gather) { + ss->gather = ssl_NewGather(); + if (!ss->gather) { + return SECFailure; + } + } + return SECSuccess; + } + return SECFailure; +} + +SECStatus +ssl_CopySocksInfo(sslSocket *ss, sslSocket *os) +{ + SECStatus rv; + +#ifdef __cplusplus + os = os; +#endif + rv = ssl_CreateSocksInfo(ss); + return rv; +} + +void +ssl_DestroySocksInfo(sslSocksInfo *si) +{ + if (si) { + PORT_Memset(si, 0x2f, sizeof *si); + PORT_Free(si); + } +} + +/* Sets the global variable ourHost to the IP address returned from + * calling GetHostByName on our system's name. + * Called from SSL_ReadSocksConfFile(). + */ +static SECStatus +GetOurHost(void) +{ + PRStatus rv; + PRHostEnt hpbuf; + char name[100]; + char dbbuf[PR_NETDB_BUF_SIZE]; + + PR_GetSystemInfo(PR_SI_HOSTNAME, name, sizeof name); + + rv = PR_GetHostByName(name, dbbuf, sizeof dbbuf, &hpbuf); + if (rv != PR_SUCCESS) + return SECFailure; + +#undef h_addr +#define h_addr h_addr_list[0] /* address, in network byte order. */ + + PORT_Memcpy(&ourHost, hpbuf.h_addr, hpbuf.h_length); + return SECSuccess; +} + +/* +** Setup default SocksConfItem list so that loopback is direct, things to the +** same subnet (?) address are direct, everything else uses sockd +*/ +static void +BuildDefaultConfList(void) +{ + SocksConfItem *ci; + SocksConfItem **lp; + + /* Put loopback onto direct list */ + lp = &ssl_socks_confs; + ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem)); + if (!ci) { + return; + } + ci->direct = 1; + ci->daddr = MAKE_IN_ADDR(127,0,0,1); + ci->dmask = MAKE_IN_ADDR(255,255,255,255); + ci->op = OP_ALWAYS; + *lp = ci; + lp = &ci->next; + + /* Put our hosts's subnet onto direct list */ + ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem)); + if (!ci) { + return; + } + ci->direct = 1; + ci->daddr = ourHost; + ci->dmask = MAKE_IN_ADDR(255,255,255,0); + ci->op = OP_ALWAYS; + *lp = ci; + lp = &ci->next; + + /* Everything else goes to sockd */ + ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem)); + if (!ci) { + return; + } + ci->daddr = MAKE_IN_ADDR(255,255,255,255); + ci->op = OP_ALWAYS; + *lp = ci; +} + +static int +FragmentLine(char *cp, char **argv, int maxargc) +{ + int argc = 0; + char *save; + char ch; + + save = cp; + for (; (ch = *cp) != 0; cp++) { + if ((ch == '#') || (ch == '\n')) { + /* Done */ + break; + } + if (ch == ':') { + break; + } + if ((ch == ' ') || (ch == '\t')) { + /* Seperator. see if it seperated anything */ + if (cp - save > 0) { + /* Put a null at the end of the word */ + *cp = 0; + argc++; + *argv++ = save; + SSL_TRC(20, ("%d: SSL: argc=%d word=\"%s\"", + SSL_GETPID(), argc, save)); + if (argc == maxargc) { + return argc; + } + } + save = cp + 1; + } + } + if (cp - save > 0) { + *cp = 0; + argc++; + *argv = save; + SSL_TRC(20, ("%d: SSL: argc=%d word=\"%s\"", + SSL_GETPID(), argc, save)); + } + return argc; +} + +/* XXX inet_addr? */ +static char * +ConvertOne(char *cp, unsigned char *rvp) +{ + char *s = PORT_Strchr(cp, '.'); + if (s) { + *s = 0; + } + *rvp = PORT_Atoi(cp) & 0xff; + return s ? s+1 : cp; +} + +/* returns host address in network byte order. */ +static PRUint32 +ConvertAddr(char *buf) +{ + unsigned char b0, b1, b2, b3; + PRUint32 addr; + + buf = ConvertOne(buf, &b0); + buf = ConvertOne(buf, &b1); + buf = ConvertOne(buf, &b2); + buf = ConvertOne(buf, &b3); + addr = ((PRUint32)b0 << 24) | + ((PRUint32)b1 << 16) | + ((PRUint32)b2 << 8) | + (PRUint32)b3; /* host byte order. */ + + return PR_htonl(addr); /* network byte order. */ +} + +static char * +ReadLine(char *buf, int len, PRFileDesc *fd) +{ + char c, *p = buf; + PRInt32 n; + + while(len > 0) { + n = PR_Read(fd, &c, 1); + if (n < 0) + return NULL; + if (n == 0) { + if (p == buf) { + return NULL; + } + *p = '\0'; + return buf; + } + if (c == '\n') { + *p = '\0'; + return buf; + } + *p++ = c; + len--; + } + *p = '\0'; + return buf; +} + +int +SSL_ReadSocksConfFile(PRFileDesc *fp) +{ + SocksConfItem * ci; + SocksConfItem **lp; + char * file = "socks file"; /* XXX Move to nav */ + SocksOp op; + int direct; + int port = 0; + int lineNumber = 0; + int rv = GetOurHost(); + + if (rv < 0) { + /* If we can't figure out our host id, use socks. Loser! */ + return SECFailure; + } + +#if 0 /* XXX Move to nav */ + fp = XP_FileOpen(file, xpSocksConfig, XP_FILE_READ); +#endif + if (!fp) { + BuildDefaultConfList(); + return SECSuccess; + } + + /* Parse config file and generate config item list */ + lp = &ssl_socks_confs; + for (;;) { + char * s; + char * argv[10]; + int argc; + PRUint32 daddr; + PRUint32 dmask; + char buf[1000]; + + s = ReadLine(buf, sizeof buf, fp); + if (!s) { + break; + } + lineNumber++; + argc = FragmentLine(buf, argv, 10); + if (argc < 3) { + if (argc == 0) { + /* must be a comment/empty line */ + continue; + } +#ifdef XP_UNIX + PR_fprintf(PR_STDERR, "%s:%d: bad config line\n", + file, lineNumber); +#endif + continue; + } + if (PORT_Strcmp(argv[0], "direct") == 0) { + direct = 1; + } else if (PORT_Strcmp(argv[0], "sockd") == 0) { + direct = 0; + } else { +#ifdef XP_UNIX + PR_fprintf(PR_STDERR, "%s:%d: bad command: \"%s\"\n", + file, lineNumber, argv[0]); +#endif + continue; + } + + /* Look for port spec */ + op = OP_ALWAYS; + if (argc > 4) { + if (PORT_Strcmp(argv[3], "lt") == 0) { + op = OP_LESS; + } else if (PORT_Strcmp(argv[3], "eq") == 0) { + op = OP_EQUAL; + } else if (PORT_Strcmp(argv[3], "le") == 0) { + op = OP_LEQUAL; + } else if (PORT_Strcmp(argv[3], "gt") == 0) { + op = OP_GREATER; + } else if (PORT_Strcmp(argv[3], "neq") == 0) { + op = OP_NOTEQUAL; + } else if (PORT_Strcmp(argv[3], "ge") == 0) { + op = OP_GEQUAL; + } else { +#ifdef XP_UNIX + PR_fprintf(PR_STDERR, "%s:%d: bad comparison op: \"%s\"\n", + file, lineNumber, argv[3]); +#endif + continue; + } + port = PORT_Atoi(argv[4]); + } + + ci = (SocksConfItem*) PORT_ZAlloc(sizeof(SocksConfItem)); + if (!ci) { + break; + } + daddr = ConvertAddr(argv[1]); /* net byte order. */ + dmask = ConvertAddr(argv[2]); /* net byte order. */ + ci->daddr = daddr; /* net byte order. */ + ci->dmask = dmask; /* net byte order. */ + ci->direct = direct; + ci->op = op; + ci->port = port; /* host byte order. */ + daddr = PR_ntohl(daddr); /* host byte order. */ + dmask = PR_ntohl(dmask); /* host byte order. */ + SSL_TRC(10, ( +"%d: SSL: line=%d direct=%d addr=%d.%d.%d.%d mask=%d.%d.%d.%d op=%d port=%d", + SSL_GETPID(), lineNumber, ci->direct, + (daddr >> 24) & 0xff, + (daddr >> 16) & 0xff, + (daddr >> 8) & 0xff, + (daddr >> 0) & 0xff, + (dmask >> 24) & 0xff, + (dmask >> 16) & 0xff, + (dmask >> 8) & 0xff, + (dmask >> 0) & 0xff, + ci->op, ci->port)); + *lp = ci; + lp = &ci->next; + } + + + if (!ssl_socks_confs) { + /* Empty file. Fix it for the user */ + BuildDefaultConfList(); + } + return SECSuccess; +} + +static int +ChooseAddress(sslSocket *ss, const PRNetAddr *direct) +{ + PRUint32 dstAddr; + PRUint16 dstPort; + SocksConfItem *ci; + int rv; + + if (!ssl_socks_confs) { + rv = SSL_ReadSocksConfFile(NULL); + if (rv) { + return rv; + } + } + + /* + ** Scan socks config info and look for a direct match or a force to + ** use the sockd. Bail on first hit. + */ + dstAddr = direct->inet.ip; + dstPort = PR_ntohs(direct->inet.port); + ci = ssl_socks_confs; + while (ci) { + SSL_TRC(10, ( + "%d: SSL[%d]: match, direct=%d daddr=0x%x mask=0x%x op=%d port=%d", + SSL_GETPID(), ss->fd, ci->direct, PR_ntohl(ci->daddr), + PR_ntohl(ci->dmask), ci->op, ci->port)); + if ((ci->daddr & ci->dmask) == (dstAddr & ci->dmask)) { + int portMatch = 0; + switch (ci->op) { + case OP_LESS: portMatch = dstPort < ci->port; break; + case OP_EQUAL: portMatch = dstPort == ci->port; break; + case OP_LEQUAL: portMatch = dstPort <= ci->port; break; + case OP_GREATER: portMatch = dstPort > ci->port; break; + case OP_NOTEQUAL: portMatch = dstPort != ci->port; break; + case OP_GEQUAL: portMatch = dstPort >= ci->port; break; + case OP_ALWAYS: portMatch = 1; break; + } + if (portMatch) { + SSL_TRC(10, ("%d: SSL[%d]: socks config match", + SSL_GETPID(), ss->fd)); + return ci->direct; + } + } + ci = ci->next; + } + SSL_TRC(10, ("%d: SSL[%d]: socks config: no match", + SSL_GETPID(), ss->fd)); + return 0; +} + +/* +** Find port # and host # of socks daemon. Use info in ss->socks struct +** when valid. If not valid, try to figure it all out. +*/ +static int +FindDaemon(sslSocket *ss, PRNetAddr *out) +{ + sslSocksInfo *si; + PRUint32 host; /* network byte order. */ + PRUint16 port; /* host byte order. */ + + PORT_Assert(ss->socks != 0); + si = ss->socks; + + /* For now, assume we are using the socks daemon */ + host = si->sockdHost; + port = si->sockdPort; +#ifdef XP_UNIX + if (!port) { + static char firstTime = 1; + static PRUint16 sockdPort; + + if (firstTime) { + struct servent *sp; + + firstTime = 0; + sp = getservbyname("socks", "tcp"); + if (sp) { + sockdPort = sp->s_port; + } else { + SSL_TRC(10, ("%d: SSL[%d]: getservbyname of (socks,tcp) fails", + SSL_GETPID(), ss->fd)); + } + } + port = sockdPort; + } +#endif + if (!port) { + port = DEF_SOCKD_PORT; + } + if (host == 0) { + SSL_TRC(10, ("%d: SSL[%d]: no socks server found", + SSL_GETPID(), ss->fd)); + PORT_SetError(PR_INVALID_ARGUMENT_ERROR); + return SECFailure; + } + + /* We know the ip addr of the socks server */ + out->inet.family = PR_AF_INET; + out->inet.port = PR_htons(port); + out->inet.ip = host; + host = PR_ntohl(host); /* now host byte order. */ + SSL_TRC(10, ("%d: SSL[%d]: socks server at %d.%d.%d.%d:%d", + SSL_GETPID(), ss->fd, + (host >> 24) & 0xff, + (host >> 16) & 0xff, + (host >> 8) & 0xff, + (host >> 0) & 0xff, + port)); + return SECSuccess; +} + +/* +** Send our desired address and our user name to the socks daemon. +** cmd is either SOCKS_CONNECT (client) or SOCKS_BIND (server). +*/ +static int +SayHello(sslSocket *ss, int cmd, const PRNetAddr *sa, char *user) +{ + int rv, len; + unsigned char msg[8]; + PRUint16 port; + PRUint32 host; + + /* Send dst message to sockd */ + port = sa->inet.port; + host = sa->inet.ip; + msg[0] = SOCKS_VERSION; + msg[1] = cmd; + PORT_Memcpy(msg+2, &port, 2); + PORT_Memcpy(msg+4, &host, 4); + SSL_TRC(10, ("%d: SSL[%d]: socks real dest=%d.%d.%d.%d:%d", + SSL_GETPID(), ss->fd, msg[4], msg[5], msg[6], msg[7], + port)); + + rv = ssl_DefSend(ss, msg, sizeof(msg), 0); + if (rv < 0) { + goto io_error; + } + /* XXX Deal with short write !! */ + + /* Send src-user message to sockd */ + len = strlen(user)+1; + rv = ssl_DefSend(ss, (unsigned char *)user, len, 0); + if (rv < 0) { + goto io_error; + } + /* XXX Deal with short write !! */ + + return SECSuccess; + + io_error: + SSL_TRC(10, ("%d: SSL[%d]: socks, io error saying hello to sockd errno=%d", + SSL_GETPID(), ss->fd, PORT_GetError())); + return SECFailure; +} + +/* Handle the reply from the socks proxy/daemon. +** Called from ssl_Do1stHandshake(). +*/ +static SECStatus +SocksHandleReply(sslSocket *ss) +{ + unsigned char *msg; + unsigned char cmd; + + PORT_Assert( ssl_Have1stHandshakeLock(ss) ); + + ssl_GetRecvBufLock(ss); + PORT_Assert(ss->gather != 0); + + msg = ss->gather->buf.buf; + cmd = msg[1]; + SSL_TRC(10, ("%d: SSL[%d]: socks result: cmd=%d", + SSL_GETPID(), ss->fd, cmd)); + + /* This is Bogus. The socks spec says these fields are undefined in + * the reply from the socks daemon/proxy. No point in saving garbage. + */ + PORT_Memcpy(&ss->socks->destPort, msg+2, 2); + PORT_Memcpy(&ss->socks->destHost, msg+4, 4); + + ss->gather->recordLen = 0; + ssl_ReleaseRecvBufLock(ss); + + /* Check status back from sockd */ + switch (cmd) { + case SOCKS_FAIL: + case SOCKS_NO_IDENTD: + case SOCKS_BAD_ID: + SSL_DBG(("%d: SSL[%d]: sockd returns an error: %d", + SSL_GETPID(), ss->fd, cmd)); + PORT_SetError(PR_CONNECT_REFUSED_ERROR); + return SECFailure; + + default: + break; + } + + /* All done */ + SSL_TRC(1, ("%d: SSL[%d]: using sockd at %d.%d.%d.%d", + SSL_GETPID(), ss->fd, + (PR_ntohl(ss->socks->sockdHost) >> 24) & 0xff, + (PR_ntohl(ss->socks->sockdHost) >> 16) & 0xff, + (PR_ntohl(ss->socks->sockdHost) >> 8) & 0xff, + (PR_ntohl(ss->socks->sockdHost) >> 0) & 0xff)); + ss->handshake = 0; + ss->nextHandshake = 0; + return SECSuccess; +} + +static SECStatus +SocksGatherRecord(sslSocket *ss) +{ + int rv; + + PORT_Assert( ssl_Have1stHandshakeLock(ss) ); + ssl_GetRecvBufLock(ss); + rv = ssl2_GatherRecord(ss, 0); + ssl_ReleaseRecvBufLock(ss); + if (rv <= 0) { + if (rv == 0) + /* Unexpected EOF */ + PORT_SetError(PR_END_OF_FILE_ERROR); + return SECFailure; + } + ss->handshake = 0; + return SECSuccess; +} + +static SECStatus +SocksStartGather(sslSocket *ss) +{ + int rv; + + ss->handshake = SocksGatherRecord; + ss->nextHandshake = SocksHandleReply; + rv = ssl2_StartGatherBytes(ss, ss->gather, 8); + if (rv <= 0) { + if (rv == 0) { + /* Unexpected EOF */ + PORT_SetError(PR_END_OF_FILE_ERROR); + return SECFailure; + } + return (SECStatus)rv; + } + ss->handshake = 0; + return SECSuccess; +} + +/************************************************************************/ + + +/* BSDI etc. ain't got no cuserid() */ +#if defined(__386BSD__) || defined(FREEBSD) +#define NEED_CUSERID 1 +#endif + +#ifdef NEED_CUSERID +#include <pwd.h> +static char * +my_cuserid(char *b) +{ + struct passwd *pw = getpwuid(getuid()); + + if (!b) + return pw ? pw->pw_name : NULL; + + if (!pw || !pw->pw_name) + b[0] = '\0'; + else + strcpy(b, pw->pw_name); + return b; +} +#endif + + +/* sa identifies the server to which we want to connect. + * First determine whether or not to use socks. + * If not, connect directly to server. + * If so, connect to socks proxy, and send SOCKS_CONNECT cmd, but + * Does NOT wait for reply from socks proxy. + */ +int +ssl_SocksConnect(sslSocket *ss, const PRNetAddr *sa) +{ + int rv, err, direct; + PRNetAddr daemon; + const PRNetAddr *sip; + char *user; + PRFileDesc *osfd = ss->fd->lower; + + /* Figure out where to connect to */ + rv = FindDaemon(ss, &daemon); + if (rv) { + return SECFailure; + } + direct = ChooseAddress(ss, sa); + if (direct) { + sip = sa; + ss->socks->direct = 1; + } else { + sip = &daemon; + ss->socks->direct = 0; + } + SSL_TRC(10, ("%d: SSL[%d]: socks %s connect to %d.%d.%d.%d:%d", + SSL_GETPID(), ss->fd, + direct ? "direct" : "sockd", + (PR_ntohl(sip->inet.ip) >> 24) & 0xff, + (PR_ntohl(sip->inet.ip) >> 16) & 0xff, + (PR_ntohl(sip->inet.ip) >> 8) & 0xff, + PR_ntohl(sip->inet.ip) & 0xff, + PR_ntohs(sip->inet.port))); + + /* Attempt first connection */ + rv = osfd->methods->connect(osfd, sip, ss->cTimeout); + err = PORT_GetError(); +#ifdef _WIN32 + PR_Sleep(PR_INTERVAL_NO_WAIT); /* workaround NT winsock connect bug. */ +#endif + if (rv < 0) { + if (err != PR_IS_CONNECTED_ERROR) { + return rv; + } + /* Async connect finished */ + } + + /* If talking to sockd, do handshake */ + if (!direct) { + /* Find user */ +#ifdef XP_UNIX +#ifdef NEED_CUSERID + user = my_cuserid(NULL); +#else + user = cuserid(NULL); +#endif + if (!user) { + PORT_SetError(PR_UNKNOWN_ERROR); + SSL_DBG(("%d: SSL[%d]: cuserid fails, errno=%d", + SSL_GETPID(), ss->fd, PORT_GetError())); + return SECFailure; + } +#else + user = "SSL"; +#endif + + /* Send our message to it */ + rv = SayHello(ss, SOCKS_CONNECT, sa, user); + if (rv) { + return rv; + } + + ss->handshake = SocksStartGather; + ss->nextHandshake = 0; + + /* save up who we're really talking to so we can index the cache */ + if ((sa->inet.family & 0xff) == PR_AF_INET) { + PR_ConvertIPv4AddrToIPv6(sa->inet.ip, &ss->peer); + ss->port = sa->inet.port; + } else { + PORT_Assert(sa->ipv6.family == PR_AF_INET6); + ss->peer = sa->ipv6.ip; + ss->port = sa->ipv6.port; + } + } + return 0; +} + +/* Called from ssl_SocksBind(), SSL_BindForSockd(), and ssl_SocksAccept(). + * NOT called from ssl_SocksConnect(). + */ +static int +SocksWaitForResponse(sslSocket *ss) +{ + int rv; + + ss->handshake = SocksStartGather; + ss->nextHandshake = 0; + + /* Get response. Do it now, spinning if necessary (!) */ + for (;;) { + ssl_Get1stHandshakeLock(ss); + rv = ssl_Do1stHandshake(ss); + ssl_Release1stHandshakeLock(ss); + if (rv == SECWouldBlock || + (rv == SECFailure && PORT_GetError() == PR_WOULD_BLOCK_ERROR)) { +#ifdef XP_UNIX + /* + ** Spinning is really evil under unix. Call select and + ** continue when a read select returns true. We only get + ** here if the socket was marked async before the bind + ** call. + */ + PRPollDesc spin; + spin.fd = ss->fd->lower; + spin.in_flags = PR_POLL_READ; + rv = PR_Poll(&spin, 1, PR_INTERVAL_NO_TIMEOUT); + if (rv < 0) { + return rv; + } +#else + PRIntervalTime ticks = PR_MillisecondsToInterval(1); + PR_Sleep(ticks); +#endif + continue; + } + break; + } + return rv; +} + +/* sa identifies the server address we want to bind to. + * First, determine if we need to register with a socks proxy. + * If socks, then Connect to Socks proxy daemon, send SOCKS_BIND message, + * wait for response from socks proxy. + */ +int +ssl_SocksBind(sslSocket *ss, const PRNetAddr *sa) +{ + sslSocksInfo * si; + PRFileDesc * osfd = ss->fd->lower; + char * user; + int rv; + int direct; + PRNetAddr daemon; + + PORT_Assert(ss->socks != 0); + si = ss->socks; + + /* Figure out where to connect to */ + rv = FindDaemon(ss, &daemon); + if (rv) { + return SECFailure; + } + direct = ChooseAddress(ss, sa); + if (direct) { + ss->socks->direct = 1; + rv = osfd->methods->bind(osfd, sa); + PORT_Memcpy(&ss->socks->bindAddr, sa, sizeof(PRNetAddr)); + } else { + ss->socks->direct = 0; + SSL_TRC(10, ("%d: SSL[%d]: socks sockd bind to %d.%d.%d.%d:%d", + SSL_GETPID(), ss->fd, + (PR_ntohl(daemon.inet.ip) >> 24) & 0xff, + (PR_ntohl(daemon.inet.ip) >> 16) & 0xff, + (PR_ntohl(daemon.inet.ip) >> 8) & 0xff, + PR_ntohl(daemon.inet.ip) & 0xff, + PR_ntohs(daemon.inet.port))); + + /* First connect to socks daemon. ASYNC connects must be disabled! */ + rv = osfd->methods->connect(osfd, &daemon, ss->cTimeout); + if (rv < 0) { + return rv; + } + + /* Find user */ +#ifdef XP_UNIX +#ifdef NEED_CUSERID + user = my_cuserid(NULL); +#else + user = cuserid(NULL); +#endif + if (!user) { + SSL_DBG(("%d: SSL[%d]: cuserid fails, errno=%d", + SSL_GETPID(), ss->fd, PORT_GetError())); + PORT_SetError(PR_UNKNOWN_ERROR); + return SECFailure; + } +#else + user = "SSL"; +#endif + /* Send message to sockd */ + rv = SayHello(ss, SOCKS_BIND, sa, user); + if (rv) { + return rv; + } + + /* SocksGatherRecord up bind response from sockd */ + rv = SocksWaitForResponse(ss); + if (rv == 0) { + /* Done */ + si->bindAddr.inet.family = PR_AF_INET; + si->bindAddr.inet.port = si->destPort; + if (PR_ntohl(si->destHost) == PR_INADDR_ANY) { + si->bindAddr.inet.ip = daemon.inet.ip; + } else { + si->bindAddr.inet.ip = si->destHost; + } + } + } + si->didBind = 1; + return rv; +} + + +PRFileDesc * +ssl_SocksAccept(sslSocket *ss, PRNetAddr *addr) +{ + PORT_Assert(0); +#if 0 /* XXX This doesn't work. */ + sslSocket *ns; + sslSocksInfo *si; + PRFileDesc *fd, *osfd = ss->fd->lower; + int rv; + + PORT_Assert(ss->socks != 0); + si = ss->socks; + + if (!si->didBind || si->direct) { + /* + ** If we didn't do the bind yet this call will generate an error + ** from the OS. If we did do the bind then we must be direct and + ** let the OS do the accept. + */ + fd = osfd->methods->accept(osfd, addr, ss->cTimeout); + return NULL; + } + + /* Get next accept response from server */ + rv = SocksWaitForResponse(ss); + if (rv) { + return NULL; + } + + /* Handshake finished. Give dest address back to caller */ + addr->inet.family = PR_AF_INET; + addr->inet.port = si->destPort; + addr->inet.ip = si->destHost; + + /* Dup the descriptor and return it */ + fd = osfd->methods->dup(osfd); + if (fd == NULL) { + return NULL; + } + + /* Dup the socket structure */ + ns = ssl_DupSocket(ss, fd); + if (ns == NULL) { + PR_Close(fd); + return NULL; + } + + return fd; +#else + return NULL; +#endif /* 0 */ +} + +int +ssl_SocksListen(sslSocket *ss, int backlog) +{ + PRFileDesc *osfd = ss->fd->lower; + int rv; + + PORT_Assert(ss->socks != 0); + + if (ss->socks->direct) { + rv = osfd->methods->listen(osfd, backlog); + return rv; + } + return 0; +} + +int +ssl_SocksGetsockname(sslSocket *ss, PRNetAddr *name) +{ + PRFileDesc *osfd = ss->fd->lower; + int rv; + + PORT_Assert(ss->socks != 0); + if (!ss->socks->didBind || ss->socks->direct) { + rv = osfd->methods->getsockname(osfd, name); + return rv; + } + + PORT_Memcpy(name, &ss->socks->bindAddr, sizeof(PRNetAddr)); + return 0; +} + +int +ssl_SocksRecv(sslSocket *ss, unsigned char *buf, int len, int flags) +{ + int rv; + + PORT_Assert(ss->socks != 0); + + if (ss->handshake) { + ssl_Get1stHandshakeLock(ss); + rv = ssl_Do1stHandshake(ss); + ssl_Release1stHandshakeLock(ss); + if (rv < 0) { + return rv; + } + rv = ssl_SendSavedWriteData(ss, &ss->saveBuf, ssl_DefSend); + if (rv < 0) { + return SECFailure; + } + /* XXX Deal with short write !! */ + } + + rv = ssl_DefRecv(ss, buf, len, flags); + SSL_TRC(2, ("%d: SSL[%d]: recving %d bytes from sockd", + SSL_GETPID(), ss->fd, rv)); + return rv; +} + +int +ssl_SocksRead(sslSocket *ss, unsigned char *buf, int len) +{ + return ssl_SocksRecv(ss, buf, len, 0); +} + +int +ssl_SocksSend(sslSocket *ss, const unsigned char *buf, int len, int flags) +{ + int rv; + + PORT_Assert(ss->socks != 0); + + if (len == 0) + return 0; + if (ss->handshake) { + ssl_Get1stHandshakeLock(ss); + rv = ssl_Do1stHandshake(ss); + ssl_Release1stHandshakeLock(ss); + if (rv < 0) { + if (rv == SECWouldBlock) { + return len; /* ????? XXX */ + } + return rv; + } + rv = ssl_SendSavedWriteData(ss, &ss->saveBuf, ssl_DefSend); + if (rv < 0) { + return SECFailure; + } + /* XXX Deal with short write !! */ + } + + SSL_TRC(2, ("%d: SSL[%d]: sending %d bytes using socks", + SSL_GETPID(), ss->fd, len)); + + /* Send out the data */ + rv = ssl_DefSend(ss, buf, len, flags); + /* XXX Deal with short write !! */ + return rv; +} + +int +ssl_SocksWrite(sslSocket *ss, const unsigned char *buf, int len) +{ + return ssl_SocksSend(ss, buf, len, 0); +} + +/* returns > 0 if direct + * returns == 0 if socks + * returns < 0 if error. + */ +int +SSL_CheckDirectSock(PRFileDesc *s) +{ + sslSocket *ss; + + ss = ssl_FindSocket(s); + if (!ss) { + SSL_DBG(("%d: SSL[%d]: bad socket in CheckDirectSock", SSL_GETPID(), s)); + return SECFailure; + } + + if (ss->socks != NULL) { + return ss->socks->direct; + } + return SECFailure; +} + + +SECStatus +SSL_ConfigSockd(PRFileDesc *s, PRUint32 host, PRUint16 port) +{ + sslSocket *ss; + SECStatus rv; + + ss = ssl_FindSocket(s); + if (!ss) { + SSL_DBG(("%d: SSL[%d]: bad socket in ConfigSocks", SSL_GETPID(), s)); + return SECFailure; + } + + /* Create socks info if not already done */ + rv = ssl_CreateSocksInfo(ss); + if (rv) { + return rv; + } + ss->socks->sockdHost = host; + ss->socks->sockdPort = port; + return SECSuccess; +} + diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c index e8a394401..6f9c510c9 100644 --- a/security/nss/lib/util/secport.c +++ b/security/nss/lib/util/secport.c @@ -49,6 +49,7 @@ #include "prmon.h" #include "nsslocks.h" #include "secport.h" +#include "prvrsion.h" #ifdef DEBUG #define THREADMARK @@ -72,15 +73,21 @@ typedef struct threadmark_mark_str { void *mark; } threadmark_mark; -typedef struct threadmark_arena_str { +#endif /* THREADMARK */ + +/* The value of this magic must change each time PORTArenaPool changes. */ +#define ARENAPOOL_MAGIC 0xB8AC9BDF + +typedef struct PORTArenaPool_str { PLArenaPool arena; - PRUint32 magic; + PRUint32 magic; + PRLock * lock; +#ifdef THREADMARK PRThread *marking_thread; threadmark_mark *first_mark; -} threadmark_arena; +#endif +} PORTArenaPool; -#define THREADMARK_MAGIC 0xB8AC9BDD /* In honor of nelsonb */ -#endif /* THREADMARK */ /* count of allocation failures. */ unsigned long port_allocFailures; @@ -182,50 +189,24 @@ PORT_GetError(void) /********************* Arena code follows *****************************/ -PZMonitor * arenaMonitor; - -static void -getArenaLock(void) -{ - if (!arenaMonitor) { - nss_InitMonitor(&arenaMonitor, nssILockArena); - } - if (arenaMonitor) - PZ_EnterMonitor(arenaMonitor); -} - -static void -releaseArenaLock(void) -{ - if (arenaMonitor) - PZ_ExitMonitor(arenaMonitor); -} - PLArenaPool * PORT_NewArena(unsigned long chunksize) { - PLArenaPool *arena; + PORTArenaPool *pool; - getArenaLock(); -#ifdef THREADMARK - { - threadmark_arena *tarena = (threadmark_arena *) - PORT_ZAlloc(sizeof(threadmark_arena)); - if( (threadmark_arena *)NULL != tarena ) { - arena = &tarena->arena; - tarena->magic = THREADMARK_MAGIC; - } else { - arena = (PLArenaPool *)NULL; - } + pool = PORT_ZNew(PORTArenaPool); + if (!pool) { + return NULL; } -#else /* THREADMARK */ - arena = (PLArenaPool*)PORT_ZAlloc(sizeof(PLArenaPool)); -#endif /* THREADMARK */ - if ( arena != NULL ) { - PL_InitArenaPool(arena, "security", chunksize, sizeof(double)); + pool->magic = ARENAPOOL_MAGIC; + pool->lock = PZ_NewLock(nssILockArena); + if (!pool->lock) { + ++port_allocFailures; + PORT_Free(pool); + return NULL; } - releaseArenaLock(); - return(arena); + PL_InitArenaPool(&pool->arena, "security", chunksize, sizeof(double)); + return(&pool->arena); } void * @@ -233,33 +214,29 @@ PORT_ArenaAlloc(PLArenaPool *arena, size_t size) { void *p; - getArenaLock(); + PORTArenaPool *pool = (PORTArenaPool *)arena; + + /* Is it one of ours? Assume so and check the magic */ + if (ARENAPOOL_MAGIC == pool->magic ) { + PZ_Lock(pool->lock); #ifdef THREADMARK - { - /* Is it one of ours? Assume so and check the magic */ - threadmark_arena *tarena = (threadmark_arena *)arena; - if( THREADMARK_MAGIC == tarena->magic ) { /* Most likely one of ours. Is there a thread id? */ - if( (PRThread *)NULL != tarena->marking_thread ) { - /* Yes. Has this arena been marked by this thread? */ - if( tarena->marking_thread == PR_GetCurrentThread() ) { - /* Yup. Everything's okay. */ - ; - } else { - /* Nope. BZZT! error */ - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return (void *)NULL; - } - } /* tid != null */ - } /* tarena */ - } /* scope */ + if (pool->marking_thread && + pool->marking_thread != PR_GetCurrentThread() ) { + /* Another thread holds a mark in this arena */ + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return NULL; + } /* tid != null */ #endif /* THREADMARK */ + PL_ARENA_ALLOCATE(p, arena, size); + PZ_Unlock(pool->lock); + } else { + PL_ARENA_ALLOCATE(p, arena, size); + } - PL_ARENA_ALLOCATE(p, arena, size); - releaseArenaLock(); - if (p == NULL) { + if (!p) { ++port_allocFailures; PORT_SetError(SEC_ERROR_NO_MEMORY); } @@ -270,38 +247,9 @@ PORT_ArenaAlloc(PLArenaPool *arena, size_t size) void * PORT_ArenaZAlloc(PLArenaPool *arena, size_t size) { - void *p; - - getArenaLock(); -#ifdef THREADMARK - { - /* Is it one of ours? Assume so and check the magic */ - threadmark_arena *tarena = (threadmark_arena *)arena; - if( THREADMARK_MAGIC == tarena->magic ) { - /* Most likely one of ours. Is there a thread id? */ - if( (PRThread *)NULL != tarena->marking_thread ) { - /* Yes. Has this arena been marked by this thread? */ - if( tarena->marking_thread == PR_GetCurrentThread() ) { - /* Yup. Everything's okay. */ - ; - } else { - /* No, it was a different thread BZZT! error */ - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return (void *)NULL; - } - } /* tid != null */ - } /* tarena */ - } /* scope */ -#endif /* THREADMARK */ + void *p = PORT_ArenaAlloc(arena, size); - PL_ARENA_ALLOCATE(p, arena, size); - releaseArenaLock(); - if (p == NULL) { - ++port_allocFailures; - PORT_SetError(SEC_ERROR_NO_MEMORY); - } else { + if (p) { PORT_Memset(p, 0, size); } @@ -312,21 +260,51 @@ PORT_ArenaZAlloc(PLArenaPool *arena, size_t size) void PORT_FreeArena(PLArenaPool *arena, PRBool zero) { - getArenaLock(); + PORTArenaPool *pool = (PORTArenaPool *)arena; + PRLock * lock = (PRLock *)0; + size_t len = sizeof *arena; + extern const PRVersionDescription * libVersionPoint(void); + static const PRVersionDescription * pvd; + static PRBool doFreeArenaPool; + + if (ARENAPOOL_MAGIC == pool->magic ) { + len = sizeof *pool; + lock = pool->lock; + PZ_Lock(lock); + } + if (!pvd) { + /* no need for thread protection here */ + pvd = libVersionPoint(); + if ((pvd->vMajor > 4) || + (pvd->vMajor == 4 && pvd->vMinor > 1) || + (pvd->vMajor == 4 && pvd->vMinor == 1 && pvd->vPatch >= 1)) { + doFreeArenaPool = PR_TRUE; + } + } + if (doFreeArenaPool) + PL_FreeArenaPool(arena); PL_FinishArenaPool(arena); - PORT_Free(arena); - releaseArenaLock(); + PORT_ZFree(arena, len); + if (lock) { + PZ_Unlock(lock); + PZ_DestroyLock(lock); + } } void * PORT_ArenaGrow(PLArenaPool *arena, void *ptr, size_t oldsize, size_t newsize) { + PORTArenaPool *pool = (PORTArenaPool *)arena; PORT_Assert(newsize >= oldsize); - getArenaLock(); - /* Do we do a THREADMARK check here? */ - PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) ); - releaseArenaLock(); + if (ARENAPOOL_MAGIC == pool->magic ) { + PZ_Lock(pool->lock); + /* Do we do a THREADMARK check here? */ + PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) ); + PZ_Unlock(pool->lock); + } else { + PL_ARENA_GROW(ptr, arena, oldsize, ( newsize - oldsize ) ); + } return(ptr); } @@ -336,144 +314,140 @@ PORT_ArenaMark(PLArenaPool *arena) { void * result; - getArenaLock(); + PORTArenaPool *pool = (PORTArenaPool *)arena; + if (ARENAPOOL_MAGIC == pool->magic ) { + PZ_Lock(pool->lock); #ifdef THREADMARK - { - threadmark_mark *tm, **pw; - - threadmark_arena *tarena = (threadmark_arena *)arena; - if( THREADMARK_MAGIC == tarena->magic ) { - /* one of ours */ - if( (PRThread *)NULL == tarena->marking_thread ) { - /* First mark */ - tarena->marking_thread = PR_GetCurrentThread(); - } else { - if( PR_GetCurrentThread() != tarena->marking_thread ) { - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return (void *)NULL; - } - } - - result = PL_ARENA_MARK(arena); - PL_ARENA_ALLOCATE(tm, arena, sizeof(threadmark_mark)); - if( (threadmark_mark *)NULL == tm ) { - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - return (void *)NULL; - } - - tm->mark = result; - tm->next = (threadmark_mark *)NULL; - - pw = &tarena->first_mark; - while( (threadmark_mark *)NULL != *pw ) { - pw = &(*pw)->next; - } - - *pw = tm; - } else { - /* a "pure" NSPR arena */ - result = PL_ARENA_MARK(arena); - } - } + { + threadmark_mark *tm, **pw; + PRThread * currentThread = PR_GetCurrentThread(); + + if (! pool->marking_thread ) { + /* First mark */ + pool->marking_thread = currentThread; + } else if (currentThread != pool->marking_thread ) { + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return NULL; + } + + result = PL_ARENA_MARK(arena); + PL_ARENA_ALLOCATE(tm, arena, sizeof(threadmark_mark)); + if (!tm) { + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + return NULL; + } + + tm->mark = result; + tm->next = (threadmark_mark *)NULL; + + pw = &pool->first_mark; + while( *pw ) { + pw = &(*pw)->next; + } + + *pw = tm; + } #else /* THREADMARK */ - result = PL_ARENA_MARK(arena); + result = PL_ARENA_MARK(arena); #endif /* THREADMARK */ - releaseArenaLock(); + PZ_Unlock(pool->lock); + } else { + /* a "pure" NSPR arena */ + result = PL_ARENA_MARK(arena); + } return result; } void PORT_ArenaRelease(PLArenaPool *arena, void *mark) { - getArenaLock(); + PORTArenaPool *pool = (PORTArenaPool *)arena; + if (ARENAPOOL_MAGIC == pool->magic ) { + PZ_Lock(pool->lock); #ifdef THREADMARK - { - threadmark_arena *tarena = (threadmark_arena *)arena; - if( THREADMARK_MAGIC == tarena->magic ) { - threadmark_mark **pw, *tm; - - if( PR_GetCurrentThread() != tarena->marking_thread ) { - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return /* no error indication available */ ; - } - - pw = &tarena->first_mark; - while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) { - pw = &(*pw)->next; - } - - if( (threadmark_mark *)NULL == *pw ) { - /* bad mark */ - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return /* no error indication available */ ; - } - - tm = *pw; - *pw = (threadmark_mark *)NULL; - - PL_ARENA_RELEASE(arena, mark); - - if( (threadmark_mark *)NULL == tarena->first_mark ) { - tarena->marking_thread = (PRThread *)NULL; - } - } else { - PL_ARENA_RELEASE(arena, mark); - } - } + { + threadmark_mark **pw, *tm; + + if (PR_GetCurrentThread() != pool->marking_thread ) { + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return /* no error indication available */ ; + } + + pw = &pool->first_mark; + while( *pw && (mark != (*pw)->mark) ) { + pw = &(*pw)->next; + } + + if (! *pw ) { + /* bad mark */ + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return /* no error indication available */ ; + } + + tm = *pw; + *pw = (threadmark_mark *)NULL; + + PL_ARENA_RELEASE(arena, mark); + + if (! pool->first_mark ) { + pool->marking_thread = (PRThread *)NULL; + } + } #else /* THREADMARK */ - PL_ARENA_RELEASE(arena, mark); + PL_ARENA_RELEASE(arena, mark); #endif /* THREADMARK */ - releaseArenaLock(); + PZ_Unlock(pool->lock); + } else { + PL_ARENA_RELEASE(arena, mark); + } } void PORT_ArenaUnmark(PLArenaPool *arena, void *mark) { #ifdef THREADMARK - getArenaLock(); - { - threadmark_arena *tarena = (threadmark_arena *)arena; - if( THREADMARK_MAGIC == tarena->magic ) { - threadmark_mark **pw, *tm; - - if( PR_GetCurrentThread() != tarena->marking_thread ) { - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return /* no error indication available */ ; - } - - pw = &tarena->first_mark; - while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) { - pw = &(*pw)->next; - } - - if( (threadmark_mark *)NULL == *pw ) { - /* bad mark */ - releaseArenaLock(); - PORT_SetError(SEC_ERROR_NO_MEMORY); - PORT_Assert(0); - return /* no error indication available */ ; - } - - tm = *pw; - *pw = (threadmark_mark *)NULL; - - if( (threadmark_mark *)NULL == tarena->first_mark ) { - tarena->marking_thread = (PRThread *)NULL; - } - } else { - PL_ARENA_RELEASE(arena, mark); - } + PORTArenaPool *pool = (PORTArenaPool *)arena; + if (ARENAPOOL_MAGIC == pool->magic ) { + threadmark_mark **pw, *tm; + + PZ_Lock(pool->lock); + + if (PR_GetCurrentThread() != pool->marking_thread ) { + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return /* no error indication available */ ; + } + + pw = &pool->first_mark; + while( ((threadmark_mark *)NULL != *pw) && (mark != (*pw)->mark) ) { + pw = &(*pw)->next; + } + + if ((threadmark_mark *)NULL == *pw ) { + /* bad mark */ + PZ_Unlock(pool->lock); + PORT_SetError(SEC_ERROR_NO_MEMORY); + PORT_Assert(0); + return /* no error indication available */ ; + } + + tm = *pw; + *pw = (threadmark_mark *)NULL; + + if (! pool->first_mark ) { + pool->marking_thread = (PRThread *)NULL; + } + + PZ_Unlock(pool->lock); } - releaseArenaLock(); #endif /* THREADMARK */ } @@ -482,9 +456,7 @@ PORT_ArenaStrdup(PLArenaPool *arena, char *str) { int len = PORT_Strlen(str)+1; char *newstr; - getArenaLock(); newstr = (char*)PORT_ArenaAlloc(arena,len); - releaseArenaLock(); if (newstr) { PORT_Memcpy(newstr,str,len); } diff --git a/security/nss/macbuild/NSS.mcp b/security/nss/macbuild/NSS.mcp Binary files differindex 1d2a0c84a..3307eb25f 100755 --- a/security/nss/macbuild/NSS.mcp +++ b/security/nss/macbuild/NSS.mcp diff --git a/security/nss/makefile.win b/security/nss/makefile.win index 943edd461..4710e1089 100644 --- a/security/nss/makefile.win +++ b/security/nss/makefile.win @@ -43,6 +43,7 @@ include <$(DEPTH)\config\config.mak> GMAKE = gmake.exe GMAKE_FLAGS = OBJDIR_NAME=$(OBJDIR) MOZILLA_CLIENT=1 +GMAKE_FLAGS = $(GMAKE_FLAGS) SOURCE_MDHEADERS_DIR=$(MOZ_SRC:\=/)/mozilla/dist/include/nspr # # The Client's debug build uses MSVC's debug runtime library (/MDd). diff --git a/security/nss/manifest.mn b/security/nss/manifest.mn index 3a015d503..02a22f816 100644 --- a/security/nss/manifest.mn +++ b/security/nss/manifest.mn @@ -34,7 +34,7 @@ CORE_DEPTH = .. DEPTH = .. IMPORTS = nspr20/$(NSPR_IMPORT_VERSION) \ - dbm/DBM_1_54 \ + dbm/DBM_1_55_RTM \ $(NULL) RELEASE = security diff --git a/security/nss/tests/cert/cert.sh b/security/nss/tests/cert/cert.sh index aa378f24e..c8ff11986 100755 --- a/security/nss/tests/cert/cert.sh +++ b/security/nss/tests/cert/cert.sh @@ -154,10 +154,7 @@ cert_init_cert() # local shell function to create client certs # initialize DB, import # root cert -# generate request -# sign request -# import Cert -# +# add cert to DB ######################################################################## cert_create_cert() { @@ -175,6 +172,19 @@ cert_create_cert() if [ "$RET" -ne 0 ]; then return $RET fi + cert_add_cert + return $? +} + +############################# cert_add_cert ############################ +# local shell function to add client certs to an existing CERT DB +# generate request +# sign request +# import Cert +# +######################################################################## +cert_add_cert() +{ CU_ACTION="Generate Cert Request for $CERTNAME" CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US" @@ -323,8 +333,8 @@ cert_ssl() cert_create_cert ${CLIENTDIR} "TestUser" 6 echo "$SCRIPTNAME: Creating Server CA Issued Certificate for \\" - echo " ${HOST}.${DOMSUF} ------------------------------------" - cert_init_cert ${SERVERDIR} "${HOST}.${DOMSUF}" 1 + echo " ${HOSTADDR} ------------------------------------" + cert_init_cert ${SERVERDIR} "${HOSTADDR}" 1 cp ${CADIR}/*.db . CU_ACTION="Creating ${CERTNAME}'s Server Cert" CU_SUBJECT="CN=${CERTNAME}, O=BOGUS Netscape, L=Mountain View, ST=California, C=US" @@ -341,6 +351,37 @@ cert_ssl() cert_log "SUCCESS: SSL passed" fi } +############################## cert_stresscerts ################################ +# local shell function to create client certs for SSL stresstest +######################################################################## +cert_stresscerts() +{ + + ############### Creating Certs for SSL stress test ####################### + # + CERTDIR="$CLIENTDIR" + cd "${CERTDIR}" + + CERTFAILED=0 + echo "$SCRIPTNAME: Creating Client CA Issued Certificates ===============" + + CONTINUE=$GLOB_MAX_CERT + CERTSERIAL=10 + + while [ $CONTINUE -ge $GLOB_MIN_CERT ] + do + CERTNAME="TestUser$CONTINUE" + cert_add_cert ${CLIENTDIR} "TestUser$CONTINUE" $CERTSERIAL + CERTSERIAL=`expr $CERTSERIAL + 1 ` + CONTINUE=`expr $CONTINUE - 1 ` + done + if [ "$CERTFAILED" != 0 ] ; then + cert_log "ERROR: StressCert failed $RET" + else + cert_log "SUCCESS: StressCert passed" + fi +} + ############################## cert_cleanup ############################ # local shell function to finish this script (no exit since it might be @@ -356,8 +397,15 @@ cert_cleanup() ################## main ################################################# -cert_init -cert_CA -cert_smime_client -cert_ssl +cert_init +cert_CA +cert_ssl +cert_smime_client +if [ -n "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then + cert_stresscerts + #following lines to be used when databases are to be reused + #cp -r /u/sonmi/tmp/stress/kentuckyderby.13/* $HOSTDIR + #cp -r $HOSTDIR/../clio.8/* $HOSTDIR + +fi cert_cleanup diff --git a/security/nss/tests/common/init.sh b/security/nss/tests/common/init.sh index f7d07f9ef..78db19ffb 100644 --- a/security/nss/tests/common/init.sh +++ b/security/nss/tests/common/init.sh @@ -149,17 +149,19 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then OS_ARCH=`(cd $COMMON; gmake os_arch)` OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//"` - if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" != "CYGWIN_NT" ]; then - PATH=${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH - PATH=`perl ../path_uniq -d ';' "$PATH"` - else - PATH=${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH - PATH=`perl ../path_uniq -d ':' "$PATH"` - fi + if [ -z "${DON_T_SET_PATHS}" -o "${DON_T_SET_PATHS}" != "TRUE" ] ; then + if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" != "CYGWIN_NT" ]; then + PATH=${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH + PATH=`perl ../path_uniq -d ';' "$PATH"` + else + PATH=${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH + PATH=`perl ../path_uniq -d ':' "$PATH"` + fi - LD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib - SHLIB_PATH=${DIST}/${OBJDIR}/lib - LIBPATH=${DIST}/${OBJDIR}/lib + LD_LIBRARY_PATH=${DIST}/${OBJDIR}/lib + SHLIB_PATH=${DIST}/${OBJDIR}/lib + LIBPATH=${DIST}/${OBJDIR}/lib + fi if [ ! -d "${TESTDIR}" ]; then echo "$SCRIPTNAME init: Creating ${TESTDIR}" @@ -173,7 +175,7 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then ?*) ;; *) - echo "$SCRIPTNAME: HOST environment variable is not defined." + echo "$SCRIPTNAME: Fatal HOST environment variable is not defined." exit 1 #does not need to be Exit, very early in script ;; esac @@ -181,16 +183,36 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then if [ -z "${DOMSUF}" ]; then DOMSUF=`domainname` if [ -z "${DOMSUF}" ]; then - echo "$SCRIPTNAME: DOMSUF environment variable is not defined." + echo "$SCRIPTNAME: Fatal DOMSUF env. variable is not defined." exit 1 #does not need to be Exit, very early in script fi fi + if [ -z "$USE_IP" -o "$USE_IP" != "TRUE" ] ; then + HOSTADDR=${HOST}.${DOMSUF} + else + HOSTADDR=${IP_ADDRESS} + fi -#NOTE - this HOSTDIR migh not be set at the time of this test!!! -# the original had a -s maybe meant -z???? - first replaced it with -d -#which worked, but resulted in [ ! -d "" ] which doesn't make a lot of sense + #if running remote side of the distributed stress test we need to use the files that + #the server side gives us... + if [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then + for w in `ls -rtd ${TESTDIR}/${HOST}.[0-9]* 2>/dev/null | + sed -e "s/.*${HOST}.//"` ; do + version=$w + done + HOSTDIR=${TESTDIR}/${HOST}.$version + echo "$SCRIPTNAME init: HOSTDIR $HOSTDIR" + echo $HOSTDIR + if [ ! -d $HOSTDIR ] ; then + echo "$SCRIPTNAME: Fatal: Remote side of dist. stress test " + echo " - server HOSTDIR $HOSTDIR does not exist" + exit 1 #does not need to be Exit, very early in script + fi + fi - if [ -z "${HOSTDIR}" ]; then + if [ -n "${HOSTDIR}" ]; then + version=`echo $HOSTDIR | sed -e "s/.*${HOST}.//"` + else if [ -f "${TESTDIR}/${HOST}" ]; then version=`cat ${TESTDIR}/${HOST}` else @@ -213,6 +235,12 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then mkdir -p ${HOSTDIR} fi + if [ -z "${LOGFILE}" ]; then + LOGFILE=${HOSTDIR}/output.log + fi + if [ ! -f "${LOGFILE}" ]; then + touch ${LOGFILE} + fi if [ -z "${RESULTS}" ]; then RESULTS=${HOSTDIR}/results.html fi @@ -220,21 +248,28 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then cp ${COMMON}/results_header.html ${RESULTS} html "<H4>Platform: ${OBJDIR}<BR>" html "Test Run: ${HOST}.$version</H4>" + html "${BC_ACTION}" html "<HR><BR>" html "<HTML><BODY>" - echo "********************************************" - echo " Platform: ${OBJDIR}" - echo " Results: ${HOST}.$version" - echo "********************************************" - fi - if [ -z "${LOGFILE}" ]; then - LOGFILE=${HOSTDIR}/output.log - fi - if [ ! -f "${LOGFILE}" ]; then - touch ${LOGFILE} + echo "********************************************" | tee ${LOGFILE} + echo " Platform: ${OBJDIR}" | tee ${LOGFILE} + echo " Results: ${HOST}.$version" | tee ${LOGFILE} + echo "********************************************" | tee ${LOGFILE} + echo "$BC_ACTION" | tee ${LOGFILE} + #if running remote side of the distributed stress test let the user know who it is... + elif [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then + echo "********************************************" | tee ${LOGFILE} + echo " Platform: ${OBJDIR}" | tee ${LOGFILE} + echo " Results: ${HOST}.$version" | tee ${LOGFILE} + echo " remote side of distributed stress test " | tee ${LOGFILE} + echo " `uname -n -s`" | tee ${LOGFILE} + echo "********************************************" | tee ${LOGFILE} fi + echo "$SCRIPTNAME init: Testing PATH $PATH against LIB $LD_LIBRARY_PATH" | + tee ${LOGFILE} + KILL="kill" if [ "${OS_ARCH}" = "Linux" ]; then SLEEP="sleep 30" @@ -244,6 +279,16 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then else PS="ps" fi + #found 3 rsh's so far that do not work as expected - cygnus mks6 (restricted sh) and mks 7 + if [ -z "$RSH" ]; then + if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then + RSH=/cygdrive/c/winnt/system32/rsh + elif [ "${OS_ARCH}" = "WINNT" ]; then + RSH=c:/winnt/system32/rsh + else + RSH=rsh + fi + fi CURDIR=`pwd` @@ -289,11 +334,23 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then trap "Exit $0 Signal_caught" 2 3 export PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH - export DOMSUF + export DOMSUF HOSTADDR export KILL SLEEP PS export MOZILLA_ROOT SECURITY_ROOT DIST TESTDIR OBJDIR HOSTDIR QADIR export LOGFILE SCRIPTNAME + if [ -z "$GLOB_MIN_CERT" ] ; then + GLOB_MIN_CERT=0 + fi + if [ -z "$GLOBMAX_CERT" ] ; then + GLOB_MAX_CERT=200 + fi + if [ -z "$MIN_CERT" ] ; then + MIN_CERT=$GLOB_MIN_CERT + fi + if [ -z "$MAX_CERT" ] ; then + MAX_CERT=$GLOB_MAX_CERT + fi SCRIPTNAME=$0 INIT_SOURCED=TRUE #whatever one does - NEVER export this one please diff --git a/security/nss/tests/header b/security/nss/tests/header index f39bddeb9..47c111ddd 100644 --- a/security/nss/tests/header +++ b/security/nss/tests/header @@ -15,7 +15,7 @@ # # parameters # ---------- -# nssversion (supported: 30b, 31, tip) +# nssversion (supported: 30b, 31, tip 32) # builddate (default - today) # # options @@ -156,6 +156,11 @@ then # want the init to wait forever for directories to WIN_WAIT_FOREVER=OFF fi +if [ -z "$BC_MASTER" ] # master directory for backwardscompatibility testing +then + BC_MASTER="20010212.1.nss32_rtm" +fi + EARLY_EXIT=TRUE #before the report file has been created, causes Exit to #create it @@ -329,7 +334,6 @@ set_files() write_to_tmpfile() { O_CRONFILE=ON - Debug "Writing to the TMPFILE" O_FILE=ON FILENAME=${TMP}/nsstmp.$$ # for now write to the temporary file # since we don't know the hostname yet @@ -414,8 +418,8 @@ eval_opts() NSSVER=$1 if [ -z "$NSSVER" ] then - NSSVER="tip" - Debug "NSS Version: Parameters missing - defaulting to tip!" + NSSVER="32" + Debug "NSS Version: Parameters missing - defaulting to 32!" else BUILDDATE=$2 if [ -z "$BUILDDATE" ] @@ -431,8 +435,6 @@ eval_opts() shift done - Debug "Builddate $BUILDDATE NssVersion $NSSVER" - if [ -z "$BUILDDATE" ] then BUILDDATE=`date +%m%d` @@ -440,8 +442,8 @@ eval_opts() fi if [ -z "$NSSVER" ] then - NSSVER="tip" - Debug "NSS Version: Parameters missing - defaulting to tip!" + NSSVER="32" + Debug "NSS Version: Parameters missing - defaulting to 32!" fi Debug "Builddate $BUILDDATE NssVersion $NSSVER" @@ -580,20 +582,76 @@ set_objdir() #at this point $MASTEBUILD is be either NT or unix LOCALDIST=${D1}/builds/${QAYEAR}${BUILDDATE}.${BUILDNUMBER}/${MASTERBUILD}/mozilla/dist + BCDIST=${D1}/builds/${BC_MASTER}/${MASTERBUILD}/mozilla/dist LOCALDIST_BIN=${LOCALDIST}/${OBJDIR}/bin DIST=$LOCALDIST -#FIXME - test so PATH won't contai it double - PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH + if [ -z "${TEST_LEVEL}" ] ; then + TEST_LEVEL=0 + fi + bc ${TEST_LEVEL} #set the path for the backward compatibility test + PATH_CONTAINS_BIN="TRUE" export PATH_CONTAINS_BIN - Debug "Path after set_objdir $PATH" - Debug "PATH $PATH" + export OBJDIR OS_ARCH LOCALDIST LOCALDIST_BIN DIST PATH BCDIST +} - export OBJDIR OS_ARCH LOCALDIST LOCALDIST_BIN DIST PATH +########################### bc ######################################### +# global shell function , sets paths for the backward compatibility test +######################################################################## +bc() +{ + DON_T_SET_PATHS="TRUE" + case $1 in + 0) + if [ "$O_WIN" = "ON" -a "$O_CYGNUS" != ON ] ; then + PATH="$TESTSCRIPTDIR;$LOCALDIST_BIN;$BASEPATH" + else + PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH + fi + BC_ACTION="" + DON_T_SET_PATHS="FALSE" #let init.sh override - FIXME - check if necessary + ;; + 1) + BC_ACTION="backward compatibility against shlibs in $BC_MASTER" + LD_LIBRARY_PATH=${BCDIST}/${OBJDIR}/lib + if [ "$O_WIN" = "ON" ] ; then + if [ "$O_CYGNUS" = ON ] ; then + PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH:$LD_LIBRARY_PATH + else + PATH="$TESTSCRIPTDIR;$LOCALDIST_BIN;$BASEPATH;$LD_LIBRARY_PATH" + fi + else + PATH=$TESTSCRIPTDIR:$LOCALDIST_BIN:$BASEPATH + fi + Debug "1st stage of backward compatibility test" + ;; + *) + BC_ACTION="forward compatibility of binaries in $BC_MASTER" + BCDIST_BIN=${BCDIST}/${OBJDIR}/bin + LD_LIBRARY_PATH=${LOCALDIST}/${OBJDIR}/lib + if [ "$O_WIN" = "ON" ] ; then + if [ "$O_CYGNUS" = ON ] ; then + PATH=$TESTSCRIPTDIR:$BCDIST_BIN:$BASEPATH:$LD_LIBRARY_PATH + else + PATH="$TESTSCRIPTDIR;$BCDIST_BIN;$BASEPATH;$LD_LIBRARY_PATH" + fi + else + PATH=$TESTSCRIPTDIR:$BCDIST_BIN:$BASEPATH + fi + Debug "2nd stage of backward compatibility test" + ;; + esac + SHLIB_PATH=${LD_LIBRARY_PATH} + LIBPATH=${LD_LIBRARY_PATH} + Debug "PATH $PATH" + Debug "LD_LIBRARY_PATH $LD_LIBRARY_PATH" + export PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH + export DON_T_SET_PATHS BC_ACTION } + ########################### Ps ######################################### # global shell function , attempts a platform specific ps ######################################################################## @@ -710,7 +768,7 @@ Exit() then cat $FILENAME | rmail $MAILINGLIST fi - rm $FILENAME 2>/dev/null + #rm $FILENAME 2>/dev/null elif [ $O_MAIL = "ON" -a $EARLY_EXIT = TRUE ] then early_exit "$1" diff --git a/security/nss/tests/nssqa b/security/nss/tests/nssqa index 6bac0ce21..979f3d2db 100755 --- a/security/nss/tests/nssqa +++ b/security/nss/tests/nssqa @@ -252,11 +252,21 @@ nssqa_main() } -if [ $O_FILE = ON ] -then - nssqa_main 2>>$FILENAME -else - nssqa_main -fi +#FIXME start TEST_LEVEL with 0 + +TEST_LEVEL=0 + +while [ $TEST_LEVEL -lt 3 ] ; do + unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT" + unset USE_64;export USE_64;Debug "USE_64 $USE_64" + bc $TEST_LEVEL + if [ $O_FILE = ON ] + then + nssqa_main 2>>$FILENAME + else + nssqa_main + fi + TEST_LEVEL=`expr $TEST_LEVEL + 1 ` +done Exit "Done." diff --git a/security/nss/tests/qa_stat b/security/nss/tests/qa_stat index 301479510..8b5b58f58 100755 --- a/security/nss/tests/qa_stat +++ b/security/nss/tests/qa_stat @@ -341,6 +341,18 @@ qa_errorlist() grep -v '0 cache hits; 1 cache misses, 0 cache not reusable' | grep -v '0 cache hits; 0 cache misses, 0 cache not reusable' | grep -v ' cache hits; 1 cache misses, 0 cache not reusable' + grep -i error */output.log | + grep -vi "write to SSL socket" | + grep -vi "HDX PR_Read returned error" | + grep -vi "no error" | + grep -vi "12285" + grep -i failed */output.log | + grep -vi "write to SSL socket" | + grep -vi "peer cannot verify" | + grep -vi "error" | + grep -vi "fatal" | + grep -vi "TCP connection reset" + grep -i fatal */output.log #grep -v '999 cache hits; 1 cache misses, 0 cache not reusable' #if [ "$1" = "1" ] #then diff --git a/security/nss/tests/set_environment b/security/nss/tests/set_environment index 13dedabc4..7489668e5 100644 --- a/security/nss/tests/set_environment +++ b/security/nss/tests/set_environment @@ -20,10 +20,6 @@ then QASCRIPT_DIR=`dirname $0` fi - -#FIXME - where do we need the OLDPATH - -OLDPATH="$PATH" PATH=.:$HOME/bin:/tools/ns/bin:/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/dist/local/exe:/usr/bin/X11:/usr/audio/bin:/u/sonmi/bin:$PATH CVSROOT=:pserver:svbld@cvsserver:/m/src @@ -119,20 +115,18 @@ then os_name="Windows" O_CYGNUS=ON O_WIN=ON - OLDPATH=`echo "$OLDPATH" | sed -e 's/\\\/\//g'` PATH="`dirname $0`:.:/cygdrive/c/cygwin/bin:/cygdrive/z/nstools/bin:/cygdrive/z/nstools/perl5:/cygdrive/z/bin:/cygdrive/c/WINNT/System32:/cygdrive/c/WINNT" -#:$OLDPATH: RM=/cygdrive/c/cygwin/bin/rm.exe #FIXME - in case we cant cporrect #these with the PATH alone PATH=`perl $QASCRIPT_DIR/path_uniq "$PATH"` + RSH=/cygdrive/c/winnt/system32/rsh elif [ "$os_name" = "Windows_95" -o \ "$os_name" = "Windows_NT" -o \ "$os_name" = "WINNT" -o \ + "$os_name" = "Windows" -o \ "$os_name" = "Windows_98" ] then #FIXME net use, mount the neccessary pnetwork drives and partitiones first - #OLDPATH=`echo "$OLDPATH" | sed -e 's/\\\/\//g'` FIXME - MKS shell - # interprets \bin as <backspace>in... PATH=`echo $SHELL | sed -e "s/.ksh.exe//g" -e "s/.sh.exe//g"` PATH="Z:/nstools/bin;Z:/nstools/perl5;z:/bin;$PATH" @@ -149,6 +143,7 @@ then os_name="Windows" O_MKS=ON O_WIN=ON + RSH=c:/winnt/system32/rsh else EDITOR=vi @@ -158,6 +153,7 @@ else XMCD_LIBDIR=/usr/local/lib/xmcd DISPLAY=:0.0 PATH=`perl $QASCRIPT_DIR/path_uniq "$PATH"` + RSH=rsh fi BASEPATH=$PATH # in case we we set and reset DIST directories the PATH diff --git a/security/nss/tests/ssl/ssl.sh b/security/nss/tests/ssl/ssl.sh index 399334db9..7d0539ea4 100755 --- a/security/nss/tests/ssl/ssl.sh +++ b/security/nss/tests/ssl/ssl.sh @@ -94,6 +94,7 @@ ssl_init() #fileout=1 #verbose="-v" #FIXME - see where this is usefull cd ${CLIENTDIR} + } ########################### is_selfserv_alive ########################## @@ -157,15 +158,15 @@ start_selfserv() echo "$SCRIPTNAME: $testname ----" fi sparam=`echo $sparam | sed -e 's;_; ;g'` - echo "selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \\" + echo "selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \\" echo " -w nss ${sparam} -i ${R_SERVERPID} $verbose &" echo "selfserv started at `date`" if [ ${fileout} -eq 1 ]; then - selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \ + selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \ -w nss ${sparam} -i ${R_SERVERPID} $verbose \ > ${SERVEROUTFILE} 2>&1 & else - selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOST}.${DOMSUF} \ + selfserv -p ${PORT} -d ${R_SERVERDIR} -n ${HOSTADDR} \ -w nss ${sparam} -i ${R_SERVERPID} $verbose & fi wait_for_selfserv @@ -258,9 +259,9 @@ ssl_stress() start_selfserv echo "strsclnt -p ${PORT} -d . -w nss $cparam $verbose \\" - echo " ${HOST}.${DOMSUF}" + echo " ${HOSTADDR}" echo "strsclnt started at `date`" - strsclnt -p ${PORT} -d . -w nss $cparam $verbose ${HOST}.${DOMSUF} + strsclnt -p ${PORT} -d . -w nss $cparam $verbose ${HOSTADDR} echo "strsclnt completed at `date`" html_msg $? $value "${testname}" @@ -271,6 +272,7 @@ ssl_stress() html "</TABLE><BR>" } + ############################## ssl_cleanup ############################# # local shell function to finish this script (no exit since it might be # sourced) @@ -284,8 +286,12 @@ ssl_cleanup() ################## main ################################################# -ssl_init -ssl_cov -ssl_auth -ssl_stress -ssl_cleanup +#this script may be sourced from the distributed stress test - in this case do nothing... + +if [ -z "$DO_REM_ST" -a -z "$DO_DIST_ST" ] ; then + ssl_init + ssl_cov + ssl_auth + ssl_stress + ssl_cleanup +fi diff --git a/security/nss/tests/ssl/ssl_dist_stress.sh b/security/nss/tests/ssl/ssl_dist_stress.sh new file mode 100755 index 000000000..9a5cb63af --- /dev/null +++ b/security/nss/tests/ssl/ssl_dist_stress.sh @@ -0,0 +1,344 @@ +#! /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/tests/ssl/ssl_dist_stress.sh +# +# Script to test NSS SSL - distributed stresstest - this script needs to +# source the regular ssl.sh (for shellfunctions, certs and variables +# initialisation) +# create certs +# start server +# start itself via rsh on different systems to connect back to the server +# +# +# needs to work on all Unix and Windows platforms +# +# special strings +# --------------- +# FIXME ... known problems, search for this string +# NOTE .... unexpected behavior +# +# FIXME _ don't know yet how long to wait until the server needs to be killed +# especially on NT +# +######################################################################## + +############################## ssl_ds_init ############################# +# local shell function to initialize this script +######################################################################## +ssl_ds_init() +{ + if [ -z "$GLOB_MIN_CERT" ] ; then + GLOB_MIN_CERT=0 + fi + if [ -z "$GLOBMAX_CERT" ] ; then + GLOB_MAX_CERT=200 + fi + IP_PARAM="" + CD_QADIR_SSL="" + + + if [ -n "$1" ] ; then + ssl_ds_eval_opts $* + fi + SCRIPTNAME=ssl_dist_stress.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 + + ssl_init # let some other script do the hard work (initialize, generate certs, ... + + SCRIPTNAME=ssl_dist_stress.sh + echo "$SCRIPTNAME: SSL distributed stress tests ===============================" + +} + +######################### ssl_ds_usage ################################# +# local shell function to explain the usage +######################################################################## +ssl_ds_usage() +{ + echo "Usage: `basename $1`" + echo " -host hostname " + echo " ...host who runs the server, for distributed stress test" + echo " -stress " + echo " ...runs the server sider of the distributed stress test" + echo " -dir unixdirectory " + echo " ...lets the server side of the distributed stress test" + echo " know where to find the scritp to start on the remote side" + echo " -certnum start-end" + echo " ... provides the range of certs for distributed stress test" + echo " for example -certnum 10-20 will connect 10 times" + echo " no blanks in the range string (not 10 - 20)" + echo " valid range ${GLOB_MIN_CERT}-${GLOB_MAX_CERT}" + echo " -? ...prints this text" + exit 1 #does not need to be Exit, very early in script +} + +######################### ssl_ds_eval_opts ############################# +# local shell function to deal with options and parameters +######################################################################## +ssl_ds_eval_opts() +{ + #use $0 not $SCRIPTNAM<E, too early, SCRIPTNAME not yet set + + while [ -n "$1" ] + do + case $1 in + -host) + BUILD_OPT=1 + export BUILD_OPT + DO_REM_ST="TRUE" + shift + SERVERHOST=$1 + HOST=$1 + if [ -z $SERVERHOST ] ; then + echo "$0 `uname -n`: -host requires hostname" + ssl_ds_usage + fi + echo "$0 `uname -n`: host $HOST ($1)" + ;; + -certn*) + shift + rangeOK=`echo $1 | sed -e 's/[0-9][0-9]*-[0-9][0-9]*/OK/'` + MIN_CERT=`echo $1 | sed -e 's/-[0-9][0-9]*//' -e 's/^00*//'` + MAX_CERT=`echo $1 | sed -e 's/[0-9][0-9]*-//' -e 's/^00*//'` + if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o \ + -z "$MIN_CERT" -o -z "$MAX_CERT" -o \ + "$MIN_CERT" -gt "$MAX_CERT" -o \ + "$MIN_CERT" -lt "$GLOB_MIN_CERT" -o \ + "$MAX_CERT" -gt "$GLOB_MAX_CERT" ] ; then + echo "$0 `uname -n`: -certn range not valid" + ssl_ds_usage + fi + echo "$0 `uname -n`: will use certs from $MIN_CERT to $MAX_CERT" + ;; + -server|-stress|-dist*st*) + BUILD_OPT=1 + export BUILD_OPT + DO_DIST_ST="TRUE" + ;; + -dir|-unixdir|-uxdir|-qadir) + shift + UX_DIR=$1 + #FIXME - we need a default unixdir + if [ -z "$UX_DIR" ] ; then # -o ! -d "$UX_DIR" ] ; then can't do, Win doesn't know... + echo "$0 `uname -n`: -dir requires directoryname " + ssl_ds_usage + fi + CD_QADIR_SSL="cd $UX_DIR" + ;; + -ip*) + shift + IP_ADDRESS=$1 + if [ -z "$IP_ADDRESS" ] ; then + echo "$0 `uname -n`: -ip requires ip-address " + ssl_ds_usage + fi + USE_IP=TRUE + IP_PARAM="-ip $IP_ADDRESS" + ;; + -h|-help|"-?"|*) + ssl_ds_usage + ;; + esac + shift + done +} + +############################## ssl_ds_rem_stress ####################### +# local shell function to perform the client part of the SSL stress test +######################################################################## + +ssl_ds_rem_stress() +{ + testname="SSL remote part of Stress test (`uname -n`)" + echo "$SCRIPTNAME `uname -n`: $testname" + + #cp -r "${CLIENTDIR}" /tmp/ssl_ds.$$ #FIXME + #cd /tmp/ssl_ds.$$ + #verbose="-v" + + cd ${CLIENTDIR} + + CONTINUE=$MAX_CERT + while [ $CONTINUE -ge $MIN_CERT ] + do + echo "strsclnt -D -p ${PORT} -d . -w nss -c 1 $verbose " + echo " -n TestUser$CONTINUE ${HOSTADDR} #`uname -n`" + strsclnt -D -p ${PORT} -d . -w nss -c 1 $verbose \ + -n "TestUser$CONTINUE" ${HOSTADDR} & + #${HOSTADDR} & + CONTINUE=`expr $CONTINUE - 1 ` + #sleep 4 #give process time to start up + done + + html_msg 0 0 "${testname}" #FIXME +} + +######################### ssl_ds_dist_stress ########################### +# local shell function to perform the server part of the new, distributed +# SSL stress test +######################################################################## + +ssl_ds_dist_stress() +{ + max_clientlist=" + box-200 + washer-200 + dryer-200 + hornet-50 + shabadoo-50 + y2sun2-10 + galileo-10 + shame-10 + axilla-10 + columbus-10 + smarch-10 + nugget-10 + charm-10 + hp64-10 + biggayal-10 + orville-10 + kwyjibo-10 + hbombaix-10 + raven-10 + jordan-10 + phaedrus-10 + louie-10 + trex-10 + compaqtor-10" + + #clientlist=" box-200 washer-50 charm-10 jordan-10 louie-10 smarch-10 phaedrus-10 charm-10 hbombaix-20 box-200 washer-50 " + #clientlist=" box-200 washer-50 louie-10 hbombaix-10 charm-10 trex-20 jordan-10 box-200 compaqtor-10 " + #clientlist=" box-2 washer-5" #FIXME ADJUST + clientlist=" box-200 charm-10 jordan-10 louie-10 smarch-10 phaedrus-10 charm-10 " + + html_head "SSL Distributed Stress Test" + + testname="SSL distributed Stress test" + + echo cd "${CLIENTDIR}" + cd "${CLIENTDIR}" + if [ -z "CD_QADIR_SSL" ] ; then + CD_QADIR_SSL="cd $QADIR/ssl" + else + cp -r $HOSTDIR $HOSTDIR/../../../../../y2sun2_Solaris8/mozilla/tests_results/security + fi + + #sparam=" -t 128 -D -r " + sparam=" -t 16 -D -r -r " + start_selfserv + + for c in $clientlist + do + client=`echo $c | sed -e "s/-.*//"` + number=`echo $c | sed -e "s/.*-//"` + CLIENT_OK="TRUE" + echo $client + ping $client >/dev/null || CLIENT_OK="FALSE" + if [ "$CLIENT_OK" = "FALSE" ] ; then + echo "$SCRIPTNAME `uname -n`: $client can't be reached - skipping" + else + get_certrange $number + echo "$SCRIPTNAME `uname -n`: $RSH $client -l svbld \\ " + echo " \" $CD_QADIR_SSL ;ssl_dist_stress.sh \\" + echo " -host $HOST -certnum $CERTRANGE $IP_PARAM \" " + $RSH $client -l svbld \ + " $CD_QADIR_SSL;ssl_dist_stress.sh -host $HOST -certnum $CERTRANGE $IP_PARAM " & + fi + done + + echo cd "${CLIENTDIR}" + cd "${CLIENTDIR}" + + sleep 300 # give the clients time to finish #FIXME ADJUST + + echo "GET /stop HTTP/1.0\n\n" > stdin.txt #check to make sure it has /r/n + echo "tstclnt -h clio.red.iplanet.com -p 8443 -d ${CLIENTDIR} -n TestUser0 " + echo " -w nss -f < stdin.txt" + tstclnt -h clio.red.iplanet.com -p 8443 -d ${CLIENTDIR} -n TestUser0 \ + -w nss -f < stdin.txt + + html_msg 0 0 "${testname}" + html "</TABLE><BR>" +} + +############################ get_certrange ############################# +# local shell function to find the range of certs that the next remote +# client is supposed to use (only for server side of the dist stress test +######################################################################## +get_certrange() +{ + rangeOK=`echo $1 | sed -e 's/[0-9][0-9]*/OK/'` + if [ -z "$rangeOK" -o "$rangeOK" != "OK" -o $1 = "OK" ] ; then + range=10 + echo "$SCRIPTNAME `uname -n`: $1 is not a valid number of certs " + echo " defaulting to 10 for $client" + else + range=$1 + if [ $range -gt $GLOB_MAX_CERT ] ; then + range=$GLOB_MAX_CERT + fi + fi + if [ -z "$FROM_CERT" ] ; then # start new on top of the cert stack + FROM_CERT=$GLOB_MAX_CERT + elif [ `expr $FROM_CERT - $range + 1 ` -lt 0 ] ; then + FROM_CERT=$GLOB_MAX_CERT # dont let it fall below 0 on the TO_CERT + + fi + TO_CERT=`expr $FROM_CERT - $range + 1 ` + if [ $TO_CERT -lt 0 ] ; then # it's not that I'm bad in math, I just + TO_CERT=0 # don't trust expr... + fi + CERTRANGE="${TO_CERT}-${FROM_CERT}" + FROM_CERT=`expr ${TO_CERT} - 1 ` #start the next client one below +} + + +################## main ################################################# + +DO_DIST_ST="TRUE" +. ssl.sh +ssl_ds_init $* +if [ -n "$DO_REM_ST" -a "$DO_REM_ST" = "TRUE" ] ; then + ssl_ds_rem_stress + exit 0 #no cleanup on purpose +elif [ -n "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then + ssl_ds_dist_stress +fi +ssl_cleanup diff --git a/security/nss/tests/tools/tools.sh b/security/nss/tests/tools/tools.sh index 25b42866b..34dc76145 100644 --- a/security/nss/tests/tools/tools.sh +++ b/security/nss/tests/tools/tools.sh @@ -158,7 +158,17 @@ tools_cleanup() ################## main ################################################# tools_init -tools_p12 + +#FIXME - tmp workaround for tests that do not work in 3.2 RTM +#echo $BC_ACTION | grep "forward compatibility" && RUN_TOOLS_P12="FALSE" +echo $BC_ACTION | grep "compatibility" && RUN_TOOLS_P12="FALSE" +if [ -n "${RUN_TOOLS_P12}" -a "${RUN_TOOLS_P12}" = "FALSE" ] ; then + html_msg 0 0 "Can't run pk12util tests for NSS 3.2 (pk12util -i)" + html_msg 0 0 "Can't run pk12util tests for NSS 3.2 (pk12util -o)" +else + tools_p12 +fi + tools_sign tools_cleanup |