On Sat, Feb 03, 2001 at 12:06:14PM +0100, Lutz Jaenicke wrote:
> On Sat, Feb 03, 2001 at 09:47:35AM +0100, Richard Levitte - VMS Whacker wrote:
> > Lutz.Jaenicke> 2. If nobody has an argument against it, I will change
> > Lutz.Jaenicke>    this for 0.9.7 and 0.9.6a tomorrow.
> > 
> > I suggest that unless you know 100% that the fix will work everywhere,
> > you leave 0.9.6a alone until you know.  0.9.6a is not supposed to be
> > "replace a bug with wnother bug" :-).
> 
> Hmm, that's true of course. We have already been sure for 100% before
> we encountered the Unixware problem, so speaking of 100% would be pretty
> thin ice :-)
> Anyway, I have just checked in the change discussed yesterday that helped
> for John Hughes, as I give it 100% :-) I will then take my time for the
> other change.

Continuing discussion of the problem:

"Boyd Lynn Gerber" <[EMAIL PROTECTED]> in the meantime arranged for an
account for me on his system so that I could investigate this issue.
(The system is identified as Unixware-7.)
1. When disabling threads in the Configure phase of OpenSSL, the connection
   to the entropy daemon is opened fine.
2. When supporting threads (the default for unixware-7), the 'connect()'
   system call comes back with EINTR. When calling connect() in a loop,
   it then returns with EISCONN, because it already seems to be connected.
   I have now patched rand_egd.c (0.9.6a-dev) to perform the following loop,
   which is working out fine for unixware-7 with threading (please ignore
   the fprintf-debugging at the end :-):

Index: rand_egd.c
===================================================================
RCS file: /e/openssl/cvs/openssl/crypto/rand/rand_egd.c,v
retrieving revision 1.10
diff -u -r1.10 rand_egd.c
--- rand_egd.c  2000/06/28 16:47:45     1.10
+++ rand_egd.c  2001/02/05 13:37:32
@@ -76,6 +76,8 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <string.h>
+#include <stdio.h>
+#include <errno.h>
 
 #ifndef offsetof
 #  define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
@@ -97,7 +99,11 @@
        len = offsetof(struct sockaddr_un, sun_path) + strlen(path);
        fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (fd == -1) return (-1);
-       if (connect(fd, (struct sockaddr *)&addr, len) == -1) goto err;
+       do {
+         ret=connect(fd, (struct sockaddr *)&addr, len)
+       } while ((ret < 0) && (errno == EINTR));
+       if ((ret < 0) && (errno != EISCONN))
+          goto err;
        buf[0] = 1;
        buf[1] = 255;
        write(fd, buf, 2);
@@ -109,6 +115,8 @@
        if (RAND_status() == 1)
                ret = num;
  err:
+       if (ret < 0)
+         fprintf(stderr, "errno = %d\n", errno);
        if (fd != -1) close(fd);
        return(ret);
        }

Would it make sense to include this into the openssl source as a standard
solution? Even more: are there better ideas avaible?

Best regards,
        Lutz
-- 
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to