summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2hg <devnull@localhost>2001-02-04 06:15:28 +0000
committercvs2hg <devnull@localhost>2001-02-04 06:15:28 +0000
commit9707e8f9a8f29f37b235d4d6506c03771a045be5 (patch)
tree5f19c24825ee360eeda14ecfd7aacc50d194b4fc
parent3b66d278c15e429d85b7b3f3020973d80e30d0ff (diff)
downloadnss-hg-MOZILLA_0_8_2001020916_BASE.tar.gz
fixup commit for branch 'MOZILLA_0_8_BRANCH'MOZILLA_0_8_20010215_RELEASEMOZILLA_0_8_2001020916_BASE
-rw-r--r--security/coreconf/OS2.mk72
-rw-r--r--security/coreconf/arch.mk17
-rw-r--r--security/coreconf/config.mk2
-rw-r--r--security/coreconf/prefix.mk2
-rw-r--r--security/coreconf/rules.mk26
-rw-r--r--security/coreconf/suffix.mk6
-rw-r--r--security/nss/Makefile6
-rw-r--r--security/nss/cmd/platlibs.mk8
-rw-r--r--security/nss/cmd/selfserv/selfserv.c4
-rw-r--r--security/nss/lib/base/hashops.c8
-rw-r--r--security/nss/lib/base/tracker.c4
-rw-r--r--security/nss/lib/certdb/certt.h4
-rw-r--r--security/nss/lib/ckfw/builtins/Makefile4
-rw-r--r--security/nss/lib/fortcrypt/swfort/swfutl.c2
-rw-r--r--security/nss/lib/jar/jarevil.c2
-rw-r--r--security/nss/lib/pki1/oid.c6
-rw-r--r--security/nss/lib/util/os2_rand.c112
-rw-r--r--security/nss/lib/util/unix_rand.c6
18 files changed, 240 insertions, 51 deletions
diff --git a/security/coreconf/OS2.mk b/security/coreconf/OS2.mk
index 64360348f..3912f03c8 100644
--- a/security/coreconf/OS2.mk
+++ b/security/coreconf/OS2.mk
@@ -57,17 +57,20 @@ ASM_SUFFIX = .asm
PROG_SUFFIX = .exe
+ifdef XP_OS2_EMX
+
#
# On OS/2 we proudly support gbash...
#
SHELL = GBASH.EXE
-CCC = icc -q -DXP_OS2 -DOS2=4 -N10
-LINK = ilink
+CCC = gcc
+LINK = gcc
AR = emxomfar -p256 r $@
# Keep AR_FLAGS blank so that we do not have to change rules.mk
AR_FLAGS =
RANLIB = @echo OS2 RANLIB
BSDECHO = @echo OS2 BSDECHO
+FILTER = emxexp
ifndef NO_SHARED_LIB
WRAP_MALLOC_LIB =
@@ -82,7 +85,7 @@ DSO_LDOPTS = -Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO
# DLL_SUFFIX = .dll
SHLIB_LDSTARTFILE =
SHLIB_LDENDFILE =
-endif
+endif #NO_SHARED_LIB
OS_CFLAGS = -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Zmtd -Zomf -Zmt -DDEBUG -DDEBUG_wintrinh -DTRACING -g
@@ -92,9 +95,8 @@ NSPR_LIBS = -lplds4 -lplc4 -lnspr4
NSPR_INCLUDE_DIR =
-
ifdef BUILD_OPT
-OPTIMIZER = -O+ -Oi
+OPTIMIZER = -O6
DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
@@ -106,7 +108,65 @@ DLLFLAGS = -DEBUG -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -DEBUG -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
OBJDIR_TAG = _DBG
LDFLAGS = -DEBUG
-endif
+endif # BUILD_OPT
+
+else # XP_OS2_VACPP
+
+#
+# On OS/2 we proudly support gbash...
+#
+SHELL = GBASH.EXE
+CCC = icc -q -DXP_OS2 -DOS2=4 -N10
+LINK = -ilink
+AR = -ilib /NOL /NOI /O:$(subst /,\\,$@)
+# Keep AR_FLAGS blank so that we do not have to change rules.mk
+AR_FLAGS =
+RANLIB = @echo OS2 RANLIB
+BSDECHO = @echo OS2 BSDECHO
+FILTER = cppfilt -b -p -q
+
+ifndef NO_SHARED_LIB
+WRAP_MALLOC_LIB =
+WRAP_MALLOC_CFLAGS =
+DSO_CFLAGS =
+DSO_PIC_CFLAGS =
+MKSHLIB = $(LD) $(DSO_LDOPTS)
+MKCSHLIB = $(LD) $(DSO_LDOPTS)
+MKSHLIB_FORCE_ALL =
+MKSHLIB_UNFORCE_ALL =
+DSO_LDOPTS =
+# DLL_SUFFIX = .dll
+SHLIB_LDSTARTFILE =
+SHLIB_LDENDFILE =
+endif #NO_SHARED_LIB
+
+OS_CFLAGS = /Q /qlibansi /Gd /Gm /Su4 /Mp /Tl-
+INCLUDES += -I$(CORE_DEPTH)/../dist/include
+DEFINES += -DXP_OS2_VACPP -DTCPV40HDRS
+
+# Where the libraries are
+NSPR_LIBS = $(DIST)/lib/nspr4.lib $(DIST)/lib/plc4.lib $(DIST)/lib/plds4.lib
+MOZ_COMPONENT_NSPR_LIBS=-L$(DIST)/lib $(NSPR_LIBS)
+NSPR_INCLUDE_DIR =
+
+
+ifdef BUILD_OPT
+OPTIMIZER = -O+ -Oi
+DEFINES += -UDEBUG -U_DEBUG -DNDEBUG
+DLLFLAGS = /DLL /O:$@ /INC:_dllentry /MAP:$(@:.dll=.map)
+EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
+OBJDIR_TAG = _OPT
+LDFLAGS = /FREE /NODEBUG /NOE /LINENUMBERS /nologo
+else
+OS_CFLAGS += /Ti+
+DEFINES += -DDEBUG -D_DEBUG -DDEBUGPRINTS #HCT Need += to avoid overidding manifest.mn
+DLLFLAGS = /DEBUG /DLL /O:$@ /INC:_dllentry /MAP:$(@:.dll=.map)
+EXEFLAGS = -DEBUG -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
+OBJDIR_TAG = _DBG
+LDFLAGS = /FREE /DE /NOE /LINENUMBERS /nologo
+endif # BUILD_OPT
+
+endif # XP_OS2_VACPP
# OS/2 use nsinstall that is included in the toolkit.
# since we do not wish to support and maintain 3 version of nsinstall in mozilla, nspr and nss
diff --git a/security/coreconf/arch.mk b/security/coreconf/arch.mk
index 57af21a2d..0e67c5577 100644
--- a/security/coreconf/arch.mk
+++ b/security/coreconf/arch.mk
@@ -138,6 +138,14 @@ ifeq ($(OS_ARCH),Linux)
OS_RELEASE := $(basename $(OS_RELEASE))
endif
+#
+# For OS/2
+#
+ifeq ($(OS_ARCH),OS_2)
+ OS_ARCH = OS2
+ OS_RELEASE := $(shell uname -v)
+endif
+
#######################################################################
# Master "Core Components" macros for getting the OS target #
#######################################################################
@@ -290,12 +298,3 @@ endif
endif
endif
-#
-# For OS/2
-#
-ifeq ($(OS_ARCH), OS_2)
-OS_ARCH := OS2
-OS_RELEASE := $(shell uname -v)
-OS_CONFIG := $(OS_ARCH)
-endif
-
diff --git a/security/coreconf/config.mk b/security/coreconf/config.mk
index 9ce293db5..613d3bc2e 100644
--- a/security/coreconf/config.mk
+++ b/security/coreconf/config.mk
@@ -56,7 +56,7 @@ include $(CORE_DEPTH)/coreconf/command.mk
# each OS release. #
#######################################################################
-ifeq (,$(filter-out NetBSD,$(OS_TARGET)))
+ifeq (,$(filter-out NetBSD OS2,$(OS_TARGET)))
include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
else
include $(CORE_DEPTH)/coreconf/$(OS_CONFIG).mk
diff --git a/security/coreconf/prefix.mk b/security/coreconf/prefix.mk
index af1142afd..b95b17b51 100644
--- a/security/coreconf/prefix.mk
+++ b/security/coreconf/prefix.mk
@@ -57,7 +57,7 @@ endif
ifndef DLL_PREFIX
- ifeq ($(OS_ARCH), WINNT)
+ ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
DLL_PREFIX =
else
DLL_PREFIX = lib
diff --git a/security/coreconf/rules.mk b/security/coreconf/rules.mk
index 21e6f3409..81245b88d 100644
--- a/security/coreconf/rules.mk
+++ b/security/coreconf/rules.mk
@@ -306,8 +306,12 @@ else
$(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
endif
else
+ifdef XP_OS2_VACPP
+ $(MKPROG) -Fe$@ $(CFLAGS) $(OBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
+else
$(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
endif
+endif
ifneq ($(POLICY),)
-$(PLCYPATCH) $(PLCYPATCH_ARGS) $@
endif
@@ -353,7 +357,19 @@ else
$(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS)
endif
else
+ifeq ($(OS_ARCH),OS2)
+ @cmd /C "echo LIBRARY $(notdir $(basename $(SHARED_LIBRARY))) INITINSTANCE TERMINSTANCE >$@.def"
+ @cmd /C "echo PROTMODE >>$@.def"
+ @cmd /C "echo CODE LOADONCALL MOVEABLE DISCARDABLE >>$@.def"
+ @cmd /C "echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >>$@.def"
+ @cmd /C "echo EXPORTS >>$@.def"
+ @cmd /C "$(FILTER) $(OBJS) >>$@.def"
+endif #OS2
+ifdef XP_OS2_VACPP
+ $(MKSHLIB) $(DLLFLAGS) $(LDFLAGS) $(OBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $@.def
+else
$(MKSHLIB) -o $@ $(OBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS)
+endif
chmod +x $@
endif
endif
@@ -410,8 +426,12 @@ else
$(CC) -Fo$@ -c $(CFLAGS) $*.c
endif
else
+ifdef XP_OS2_VACPP
+ $(CC) -Fo$@ -c $(CFLAGS) $*.c
+else
$(CC) -o $@ -c $(CFLAGS) $*.c
endif
+endif
ifneq ($(OS_ARCH), WINNT)
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s
@@ -452,8 +472,12 @@ else
ifeq ($(OS_ARCH),WINNT)
$(CCC) -Fo$@ -c $(CFLAGS) $*.cpp
else
+ifdef XP_OS2_VACPP
+ $(CCC) -Fo$@ -c $(CFLAGS) $*.cpp
+else
$(CCC) -o $@ -c $(CFLAGS) $*.cpp
endif
+endif
endif #STRICT_CPLUSPLUS_SUFFIX
%.i: %.cpp
@@ -852,7 +876,7 @@ endif
-include $(DEPENDENCIES)
-ifneq ($(OS_ARCH),WINNT)
+ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
# Can't use sed because of its 4000-char line length limit, so resort to perl
.DEFAULT:
@perl -e ' \
diff --git a/security/coreconf/suffix.mk b/security/coreconf/suffix.mk
index 9c741cce1..fcfea6b26 100644
--- a/security/coreconf/suffix.mk
+++ b/security/coreconf/suffix.mk
@@ -128,13 +128,9 @@ endif
#
ifndef PROG_SUFFIX
- ifeq ($(OS_ARCH), WINNT)
+ ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
PROG_SUFFIX = .exe
else
- ifeq ($(OS_ARCH), OS2)
- PROG_SUFFIX = .exe
- else
PROG_SUFFIX =
- endif
endif
endif
diff --git a/security/nss/Makefile b/security/nss/Makefile
index 77cc3e4ba..3a3ec2216 100644
--- a/security/nss/Makefile
+++ b/security/nss/Makefile
@@ -87,9 +87,9 @@ endif
mv $(DIST)/lib/dbm32.lib $(DIST)/lib/dbm.lib
else
ifeq ($(OS_ARCH),OS2)
- cp -r $(DIST)/../include $(DIST)
- cp -r $(DIST)/../lib $(DIST)
- mv $(DIST)/lib/libmozdbm_s.$(LIB_SUFFIX) $(DIST)/lib/libdbm.$(LIB_SUFFIX)
+ cp -rf $(DIST)/../include $(DIST)
+ cp -rf $(DIST)/../lib $(DIST)
+ cp -f $(DIST)/lib/libmozdbm_s.$(LIB_SUFFIX) $(DIST)/lib/libdbm.$(LIB_SUFFIX)
else
$(NSINSTALL) -L ../../dist include $(DIST)
$(NSINSTALL) -L ../../dist lib $(DIST)
diff --git a/security/nss/cmd/platlibs.mk b/security/nss/cmd/platlibs.mk
index d3da3727a..b9fb30619 100644
--- a/security/nss/cmd/platlibs.mk
+++ b/security/nss/cmd/platlibs.mk
@@ -107,6 +107,13 @@ EXTRA_LIBS += \
# $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS)
# $(EXTRA_SHARED_LIBS) come before $(OS_LIBS), except on AIX.
+ifdef XP_OS2_VACPP
+EXTRA_SHARED_LIBS += \
+ $(DIST)/lib/plc4.lib \
+ $(DIST)/lib/plds4.lib \
+ $(DIST)/lib/nspr4.lib \
+ $(NULL)
+else
EXTRA_SHARED_LIBS += \
-L$(DIST)/lib/ \
-lplc4 \
@@ -114,4 +121,5 @@ EXTRA_SHARED_LIBS += \
-lnspr4 \
$(NULL)
endif
+endif
diff --git a/security/nss/cmd/selfserv/selfserv.c b/security/nss/cmd/selfserv/selfserv.c
index 496e9a7bd..ceb5087fc 100644
--- a/security/nss/cmd/selfserv/selfserv.c
+++ b/security/nss/cmd/selfserv/selfserv.c
@@ -46,6 +46,10 @@
#include <unistd.h>
#endif
+#ifdef XP_OS2_VACPP
+#include <Process.h> /* for getpid() */
+#endif
+
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/security/nss/lib/base/hashops.c b/security/nss/lib/base/hashops.c
index bd2de9a9c..1628f3797 100644
--- a/security/nss/lib/base/hashops.c
+++ b/security/nss/lib/base/hashops.c
@@ -45,7 +45,7 @@ static const char CVS_ID[] = "@(#) $RCSfile$ $Revision$ $Date$ $Name$";
#include "base.h"
#endif /* BASE_H */
-static PR_CALLBACK void *
+static void * PR_CALLBACK
nss_arena_hash_alloc_table
(
void *pool,
@@ -65,7 +65,7 @@ nss_arena_hash_alloc_table
return nss_ZAlloc(arena, size);
}
-static PR_CALLBACK void
+static void PR_CALLBACK
nss_arena_hash_free_table
(
void *pool,
@@ -75,7 +75,7 @@ nss_arena_hash_free_table
(void)nss_ZFreeIf(item);
}
-static PR_CALLBACK PLHashEntry *
+static PLHashEntry * PR_CALLBACK
nss_arena_hash_alloc_entry
(
void *pool,
@@ -95,7 +95,7 @@ nss_arena_hash_alloc_entry
return nss_ZNEW(arena, PLHashEntry);
}
-static PR_CALLBACK void
+static void PR_CALLBACK
nss_arena_hash_free_entry
(
void *pool,
diff --git a/security/nss/lib/base/tracker.c b/security/nss/lib/base/tracker.c
index 00d499354..17a01a3f7 100644
--- a/security/nss/lib/base/tracker.c
+++ b/security/nss/lib/base/tracker.c
@@ -155,7 +155,7 @@ call_once
* There are no possible errors.
*/
-static PR_CALLBACK PLHashNumber
+static PLHashNumber PR_CALLBACK
identity_hash
(
const void *key
@@ -245,7 +245,7 @@ nssPointerTracker_initialize
* entries.
*/
-static PR_CALLBACK PRIntn
+static PRIntn PR_CALLBACK
count_entries
(
PLHashEntry *he,
diff --git a/security/nss/lib/certdb/certt.h b/security/nss/lib/certdb/certt.h
index ffaaaca66..90d18aa3d 100644
--- a/security/nss/lib/certdb/certt.h
+++ b/security/nss/lib/certdb/certt.h
@@ -699,12 +699,12 @@ struct CERTOKDomainNameStr {
};
-typedef SECStatus PR_CALLBACK (*CERTStatusChecker) (CERTCertDBHandle *handle,
+typedef SECStatus (PR_CALLBACK *CERTStatusChecker) (CERTCertDBHandle *handle,
CERTCertificate *cert,
int64 time,
void *pwArg);
-typedef SECStatus PR_CALLBACK (*CERTStatusDestroy) (CERTStatusConfig *handle);
+typedef SECStatus (PR_CALLBACK *CERTStatusDestroy) (CERTStatusConfig *handle);
struct CERTStatusConfigStr {
CERTStatusChecker statusChecker; /* NULL means no checking enabled */
diff --git a/security/nss/lib/ckfw/builtins/Makefile b/security/nss/lib/ckfw/builtins/Makefile
index c0a80527d..3753b013d 100644
--- a/security/nss/lib/ckfw/builtins/Makefile
+++ b/security/nss/lib/ckfw/builtins/Makefile
@@ -78,6 +78,10 @@ ifeq ($(OS_ARCH), WINNT)
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib
endif
+ifeq ($(OS_ARCH),OS2)
+ SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll
+endif
+
include $(CORE_DEPTH)/coreconf/rules.mk
diff --git a/security/nss/lib/fortcrypt/swfort/swfutl.c b/security/nss/lib/fortcrypt/swfort/swfutl.c
index db5a97b67..9ffb35ced 100644
--- a/security/nss/lib/fortcrypt/swfort/swfutl.c
+++ b/security/nss/lib/fortcrypt/swfort/swfutl.c
@@ -45,7 +45,7 @@
#include "secport.h"
#include "secrng.h"
#ifdef XP_OS2
-#include <stat.h> /* Needed for OS/2 emx */
+#include <sys/stat.h>
#endif
#ifdef XP_WIN
diff --git a/security/nss/lib/jar/jarevil.c b/security/nss/lib/jar/jarevil.c
index 08fa1ee6c..8ceba9d3c 100644
--- a/security/nss/lib/jar/jarevil.c
+++ b/security/nss/lib/jar/jarevil.c
@@ -57,7 +57,7 @@ extern void *mozilla_event_queue;
/* Special macros facilitate running on Win 16 */
-#if defined(XP_PC) && !defined(_WIN32) /* then we are win 16 */
+#if defined(XP_WIN16)
/*
* Allocate the data passed to the callback functions from the heap...
diff --git a/security/nss/lib/pki1/oid.c b/security/nss/lib/pki1/oid.c
index c4028a803..18b589234 100644
--- a/security/nss/lib/pki1/oid.c
+++ b/security/nss/lib/pki1/oid.c
@@ -282,7 +282,7 @@ static PRLock *oid_hash_lock;
* inclined student.
*/
-static PR_CALLBACK PLHashNumber
+static PLHashNumber PR_CALLBACK
oid_hash
(
const void *key
@@ -310,7 +310,7 @@ oid_hash
* but heck it's only used internally by the hash table anyway.
*/
-static PR_CALLBACK PRIntn
+static PRIntn PR_CALLBACK
oid_hash_compare
(
const void *k1,
@@ -407,7 +407,7 @@ static NSSArena *oid_arena;
* It also creates the aforementioned NSSArena.
*/
-static PR_CALLBACK PRStatus
+static PRStatus PR_CALLBACK
oid_once_func
(
void
diff --git a/security/nss/lib/util/os2_rand.c b/security/nss/lib/util/os2_rand.c
index 7ee06f854..b1dbba805 100644
--- a/security/nss/lib/util/os2_rand.c
+++ b/security/nss/lib/util/os2_rand.c
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
-#include <stat.h>
+#include <sys/stat.h>
static BOOL clockTickTime(unsigned long *phigh, unsigned long *plow)
{
@@ -106,6 +106,94 @@ size_t RNG_GetNoise(void *buf, size_t maxbuf)
return n;
}
+static BOOL
+EnumSystemFiles(void (*func)(char *))
+{
+ APIRET rc;
+ ULONG sysInfo = 0;
+ char bootLetter[2];
+ char sysDir[_MAX_PATH] = "";
+ char filename[_MAX_PATH];
+ HDIR hdir = HDIR_CREATE;
+ ULONG numFiles = 1;
+ FILEFINDBUF3 fileBuf = {0};
+ ULONG buflen = sizeof(FILEFINDBUF3);
+
+ if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, (PVOID)&sysInfo,
+ sizeof(ULONG)) == NO_ERROR)
+ {
+ bootLetter[0] = sysInfo + 'A' -1;
+ strcpy(sysDir, bootLetter);
+ strcpy(sysDir+1, ":\\OS2\\");
+
+ strcpy( filename, sysDir );
+ strcat( filename, "*.*" );
+ }
+
+ rc =DosFindFirst( filename, &hdir, FILE_NORMAL, &fileBuf, buflen,
+ &numFiles, FIL_STANDARD );
+ if( rc == NO_ERROR )
+ {
+ do {
+ // pass the full pathname to the callback
+ sprintf( filename, "%s\\%s", sysDir, fileBuf.achName );
+ (*func)(filename);
+
+ numFiles = 1;
+ rc = DosFindNext( hdir, &fileBuf, buflen, &numFiles );
+ if( rc != NO_ERROR && rc != ERROR_NO_MORE_FILES )
+ printf( "DosFindNext errod code = %d\n", rc );
+ } while ( rc == NO_ERROR );
+
+ rc = DosFindClose(hdir);
+ if( rc != NO_ERROR )
+ printf( "DosFindClose error code = %d", rc );
+ }
+ else
+ printf( "DosFindFirst error code = %d", rc );
+
+ return TRUE;
+}
+
+static int dwNumFiles, dwReadEvery;
+
+static void
+CountFiles(char *file)
+{
+ dwNumFiles++;
+}
+
+static void
+ReadFiles(char *file)
+{
+ if ((dwNumFiles % dwReadEvery) == 0)
+ RNG_FileForRNG(file);
+
+ dwNumFiles++;
+}
+
+static void
+ReadSystemFiles()
+{
+ // first count the number of files
+ dwNumFiles = 0;
+ if (!EnumSystemFiles(CountFiles))
+ return;
+
+ RNG_RandomUpdate(&dwNumFiles, sizeof(dwNumFiles));
+
+ // now read 10 files
+ if (dwNumFiles == 0)
+ return;
+
+ dwReadEvery = dwNumFiles / 10;
+ if (dwReadEvery == 0)
+ dwReadEvery = 1; // less than 10 files
+
+ dwNumFiles = 0;
+ EnumSystemFiles(ReadFiles);
+}
+
void RNG_SystemInfoForRNG(void)
{
unsigned long *plong = 0;
@@ -113,16 +201,17 @@ void RNG_SystemInfoForRNG(void)
PPIB ppib;
APIRET rc = NO_ERROR;
DATETIME dt;
- COUNTRYCODE cc;
- COUNTRYINFO ci;
- unsigned long actual;
+ COUNTRYCODE cc = {0};
+ COUNTRYINFO ci = {0};
+ unsigned long actual = 0;
char path[_MAX_PATH]="";
+ char fullpath[_MAX_PATH]="";
unsigned long pathlength = sizeof(path);
FSALLOCATE fsallocate;
FILESTATUS3 fstatus;
unsigned long defaultdrive = 0;
unsigned long logicaldrives = 0;
- unsigned long counter = 0;
+ unsigned long sysInfo[QSV_MAX] = {0};
char buffer[20];
int nBytes = 0;
@@ -161,11 +250,13 @@ void RNG_SystemInfoForRNG(void)
/* current directory */
rc = DosQueryCurrentDir(0, path, &pathlength);
+ strcat(fullpath, "\\");
+ strcat(fullpath, path);
if (rc == NO_ERROR)
{
- RNG_RandomUpdate(path, strlen(path));
+ RNG_RandomUpdate(fullpath, strlen(fullpath));
// path info
- rc = DosQueryPathInfo(path, FIL_STANDARD, &fstatus, sizeof(fstatus));
+ rc = DosQueryPathInfo(fullpath, FIL_STANDARD, &fstatus, sizeof(fstatus));
if (rc == NO_ERROR)
{
RNG_RandomUpdate(&fstatus, sizeof(fstatus));
@@ -188,12 +279,15 @@ void RNG_SystemInfoForRNG(void)
}
/* system info */
- rc = DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &counter, sizeof(counter));
+ rc = DosQuerySysInfo(1L, QSV_MAX, (PVOID)&sysInfo, sizeof(ULONG)*QSV_MAX);
if (rc == NO_ERROR)
{
- RNG_RandomUpdate(&counter, sizeof(counter));
+ RNG_RandomUpdate(&sysInfo, sizeof(sysInfo));
}
+ // now let's do some files
+ ReadSystemFiles();
+
/* more noise */
nBytes = RNG_GetNoise(buffer, sizeof(buffer));
RNG_RandomUpdate(buffer, nBytes);
diff --git a/security/nss/lib/util/unix_rand.c b/security/nss/lib/util/unix_rand.c
index 472f18197..625f30d4b 100644
--- a/security/nss/lib/util/unix_rand.c
+++ b/security/nss/lib/util/unix_rand.c
@@ -262,7 +262,7 @@ GiveSystemInfo(void)
}
#endif /* IBM R2 */
-#if defined(__linux)
+#if defined(LINUX)
#include <linux/kernel.h>
static size_t
@@ -283,7 +283,7 @@ GiveSystemInfo(void)
}
#endif
}
-#endif /* __linux */
+#endif /* LINUX */
#if defined(NCR)
@@ -700,7 +700,7 @@ void RNG_SystemInfoForRNG(void)
#ifdef DO_PS
For now it is considered that it is too expensive to run the ps command
for the small amount of entropy it provides.
-#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(__linux)
+#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX)
static char ps_cmd[] = "ps aux";
#else
static char ps_cmd[] = "ps -el";