Porting issue with openssl and no /dev/random - Mailing list pgsql-bugs

From Bruno Wolff III
Subject Porting issue with openssl and no /dev/random
Date
Msg-id 20011025153011.A5068@cerberus.csd.uwm.edu
Whole thread Raw
Responses Re: Porting issue with openssl and no /dev/random
List pgsql-bugs
I installed the client part of postgres on a Compaq Alpha running tru64
Unix 4 (or what they are calling it these days) using the openssl library.
This machine does not have random device and openssl's library insists
on some random data in order to start up. This prevented me from running
the software as downloaded. I made some changes to fe-connect.c to
read ~/.rnd for initial state so I could use the feature.

This isn't exactly a postgres problem, but it may be that you can check
for this case (no /dev/random and openssl) and call the ssl functions
to get random state from a file.

I am including the diff of changes I made to get this to work, though
it isn't a robust solution.

*** fe-connect.c    Sat Mar 31 17:14:37 2001
--- /home/bruno/fe-connect.c    Thu Oct 25 15:14:24 2001
***************
*** 48,53 ****
--- 48,57 ----
  #include "mb/pg_wchar.h"
  #endif

+ #ifdef USE_SSL
+ #include "openssl/rand.h"
+ #endif
+
  #ifdef WIN32
  static int
  inet_aton(const char *cp, struct in_addr * inp)
***************
*** 792,797 ****
--- 796,802 ----
  #ifdef USE_SSL
      StartupPacket np;            /* Used to negotiate SSL connection */
      char        SSLok;
+     char randfile[1000];

  #endif

***************
*** 986,991 ****
--- 991,1001 ----
              {
                  SSL_load_error_strings();
                  SSL_library_init();
+                 if (RAND_file_name(&randfile, sizeof randfile)) {
+                   if (RAND_load_file(&randfile, 1024) > 0) {
+                     RAND_write_file(&randfile);
+                   }
+                 }
                  SSL_context = SSL_CTX_new(SSLv23_method());
                  if (!SSL_context)
                  {

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #500: Cannot create View and Problems With the UNION clause
Next
From: "Rumi Szabolcs"
Date:
Subject: reference to inherited column in parent