PR: 1890
authorDr. Stephen Henson <steve@openssl.org>
Mon, 6 Apr 2009 14:31:36 +0000 (14:31 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 6 Apr 2009 14:31:36 +0000 (14:31 +0000)
Submitted by: "Green, Paul" <Paul.Green@stratus.com>
Approved by: steve@openssl.org

Fixes to --with-zlib-include and --with-zlib-lib and init PRNG for VOS.

Configure
Makefile.org
crypto/Makefile
crypto/rand/rand_unix.c

index ae8ce89e30c792276be9e9a8fa980763166b0f75..8f9f2ded4a78511347f6f483c9f60dd863a3c06a 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1218,7 +1218,14 @@ if ($zlib)
        $cflags = "-DZLIB $cflags";
        if (defined($disabled{"zlib-dynamic"}))
                {
-               $lflags = "$lflags -lz";
+               if (defined($withargs{"zlib-lib"}))
+                       {
+                       $lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
+                       }
+               else
+                       {
+                       $lflags = "$lflags -lz";
+                       }
                }
        else
                {
index 69be0f6ccaa8f6f0b606bc6753985344f5c62704..f60b7a15ce373c34a9053f4ace812b9f7cd7d333 100644 (file)
@@ -188,6 +188,7 @@ BUILDENV=   PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
                MAKEDEPPROG='$(MAKEDEPPROG)'                    \
                SHARED_LDFLAGS='$(SHARED_LDFLAGS)'              \
                KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'   \
+               ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
                EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
                SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
                PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'     \
index b730fa45d7bfa8915130d632e247398ee253ed8e..c1033f6d7765a9a92d38cac65e3e6c8e944a3360 100644 (file)
@@ -5,9 +5,9 @@
 DIR=           crypto
 TOP=           ..
 CC=            cc
-INCLUDE=       -I. -I$(TOP) -I../include
+INCLUDE=       -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
 # INCLUDES targets sudbirs!
-INCLUDES=      -I.. -I../.. -I../asn1 -I../evp -I../../include
+INCLUDES=      -I.. -I../.. -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE)
 CFLAG=         -g
 MAKEDEPPROG=   makedepend
 MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
index 550ad955f0c193ea1f56e2cc3d62cc35462058f6..e9ead3a529688fd2c49a95b6871240d24ac6d70d 100644 (file)
 # define FD_SETSIZE (8*sizeof(fd_set))
 #endif
 
-#ifdef __OpenBSD__
+#ifdef __VOS__
+int RAND_poll(void)
+{
+       unsigned char buf[ENTROPY_NEEDED];
+       pid_t curr_pid;
+       uid_t curr_uid;
+       static int first=1;
+       int i;
+       long rnd = 0;
+       struct timespec ts;
+       unsigned seed;
+
+/* The VOS random() function starts from a static seed so its
+   initial value is predictable.  If random() returns the
+   initial value, reseed it with dynamic data.  The VOS
+   real-time clock has a granularity of 1 nsec so it should be
+   reasonably difficult to predict its exact value.  Do not
+   gratuitously reseed the PRNG because other code in this
+   process or thread may be using it.  */
+
+       if (first) {
+               first = 0;
+               rnd = random ();
+               if (rnd == 1804289383) {
+                       clock_gettime (CLOCK_REALTIME, &ts);
+                       curr_pid = getpid();
+                       curr_uid = getuid();
+                       seed = ts.tv_sec ^ ts.tv_nsec ^ curr_pid ^ curr_uid;
+                       srandom (seed);
+               }
+       }
+
+       for (i = 0; i < sizeof(buf); i++) {
+               if (i % 4 == 0)
+                       rnd = random();
+               buf[i] = rnd;
+               rnd >>= 8;
+       }
+       RAND_add(buf, sizeof(buf), ENTROPY_NEEDED);
+       memset(buf, 0, sizeof(buf));
+
+       return 1;
+}
+#elif defined __OpenBSD__
 int RAND_poll(void)
 {
        u_int32_t rnd = 0, i;