From: [EMAIL PROTECTED]
n2xjk> We figured out how to get randtest working on OS/390. We
n2xjk> determined that the RAND_xxx functions were not running the
n2xjk> functions they call in turn through the rand_meth structure
n2xjk> pointer. This is because in the scope of randtest.c, the
n2xjk> rand_meth pointer is not initialized.
Hmm?
n2xjk> In crypto/rand/rand_lib.c, removing the word "static" from
n2xjk> static RAND_METHOD *rand_meth= &rand_ssleay_meth;
n2xjk> solved the problem. Removing "static" still keeps it static
n2xjk> since it is declared at the file scope, but adding "static"
n2xjk> makes it no longer extern to this scope. I don't know if this
n2xjk> is a fluke in the static storage initialization in OS/390 or
n2xjk> what.
Uhmm, so you're telling us that variables that are defined static
(which in this case means they are in file scope, non-extern) can't be
initialized like that? I would say that's a big fluke in the C
compiler, unless it's said in the C standard that this kind of
initialization may not work.
Have you tested a program like this?
----- 8< -----
#include <stdio.h>
#include <stdlib.h>
static char word[] = "foo";
main()
{
printf("The world is %s today\n", foo);
}
----- 8< -----
If that program prints "The world is foo today", then the static
rand_meth in rand_lib.c should work, and it could be a good thing to
investigate why the C compiler behaves differently when compiling
OpenSSL. If the above little program doesn't print said phrase, you
have a buggy C compiler.
n2xjk> In case there are static storage problems on other platforms,
n2xjk> but I would suggest adding code to randtest.c to check the
n2xjk> return code from RAND_pseudo_bytes. If it returns -1, then the
n2xjk> function pointer is not resolved. If randtest had this test to
n2xjk> begin with, it would have saved considerable time in the
n2xjk> debugging of the problem.
That can be done...
--
Richard Levitte \ Spannv�gen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken \ S-168 35 BROMMA \ T: +46-8-26 52 47
Redakteur@Stacken \ SWEDEN \ or +46-709-50 36 10
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/
Software Engineer, Celo Communications: http://www.celocom.com/
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]