Porting issue with openssl and no /dev/random

From: Bruno Wolff III <bruno(at)cerberus(dot)csd(dot)uwm(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Porting issue with openssl and no /dev/random
Date: 2001-10-25 20:30:11
Message-ID: 20011025153011.A5068@cerberus.csd.uwm.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)
{

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Roman Burgonov 2001-10-26 05:42:48 postgresql-7.1.3 bugs
Previous Message Tom Lane 2001-10-25 16:53:52 Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC