Hello,

while building openssl-1.0.1-stable-SNAP-20100920 from scratch
on OpenBSD-current i noticed that crypto/rand/randfile.c does
not compile because the local variable "ok" is neither declared
nor initialized, but only tested for its value.

After comparing to the (working) OpenBSD in-tree sources, i propose
the simple fix included below.  With that fix, the build goes through,
the test suite succeeds and i was able to perform the checks i originally
intended, namely, checking that the OpenSSL bugs causing the Astaro
y2k38 certificate generation issues are fixed in OpenSSL 1.0.0.

Yours,
  Ingo

--- crypto/rand/randfile.c.orig Tue Jun 15 19:25:11 2010
+++ crypto/rand/randfile.c      Mon Sep 20 14:08:45 2010
@@ -269,6 +269,7 @@ err:
 const char *RAND_file_name(char *buf, size_t size)
        {
        char *s=NULL;
+       int ok = 0;
 #ifdef __OpenBSD__
        struct stat sb;
 #endif
@@ -297,6 +298,7 @@ const char *RAND_file_name(char *buf, size_t size)
                        BUF_strlcat(buf,"/",size);
 #endif
                        BUF_strlcat(buf,RFILE,size);
+                       ok = 1;
                        }
                else
                        buf[0] = '\0'; /* no file name */
OpenSSL self-test report:

OpenSSL version:  1.0.1-dev
Last change:      Add EC_GFp_nistp224_method(), a 64-bit optimized implem...
Options:          --prefix=/usr/local/ischwarze 
--openssldir=/usr/local/ischwarze/etc 386 no-gmp no-jpake no-krb5 no-md2 no-rc5 
no-rfc3779 no-shared no-sse2 no-store no-threads no-zlib no-zlib-dynamic 
static-engine
OS (uname):       OpenBSD ischwarze00.intranet.astaro.de 4.8 GENERIC#126 i386
OS (config):      i386-whatever-openbsd
Target (default): BSD-x86-elf
Target:           BSD-x86-elf
Compiler:         Target: i386-unknown-openbsd4.8
Configured with: OpenBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719 

Test passed.

Reply via email to