Hello!
We've got an issue using openssl (0.9.8a to 0.9.8d) libraries with our
product.
It works fine on any Unix or even on most windows platforms.
But, unfortunately, it crashes if run on a quadri pro Xeon Windows 2003
platform.
There is no evidence that's the only platform to show this issue, but it
actually happens on at least four instances of such a machine.
The stack of the crash often contains "RAND_POLL" but doesn't seem to be
reliable.
We could reproduce the same issue with the very simple code attached here.
It crashes only if a bunch of executables are launched in a very short time.
Sounds like a real time issue at loading time ... quite strange.
Well "loading time" is an hypothesis based on the stack: most of the
time it appears to happen before entering "main".
We know that windows loads and initialises the DLL modules before
calling main ... hence our hypothesis
A command line like the following one may be usefull to reproduce the
issue (it creates 200 wrnd instances):
for %i in (0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j) do start /min /high
wrnd.exe & start /min /high wrnd.exe & start /min /high wrnd.exe & start
/min /high wrnd.exe & start /min /high wrnd.exe & start /min /high
wrnd.exe & start /min /high wrnd.exe & start /min /high wrnd.exe & start
/min /high wrnd.exe & start /min /high wrnd.exe
wrnd.exe being built from the attached sample source code
Any hint or help around such an issue will be really welcome.
In case it could matter, here are the command lines used to build the
executable:
"c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Bin\cl.exe"
-IC:\3rdparty\openssl-0.9.8a\inc32 -I"c:\Program Files\Microsoft Visual
Studio .NET 2003\Vc7\Include" /D WIN32 /GR /Ob1 /Oi /Ot /Gs /Gm- /Gy /D
"NDEBUG" /MD /Zi /GL /wd4786 /GB /Oy /TC /c /W3 /EHsc /Zm1000 -c -o
test.obj test.c
"c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Bin\link.exe"
/LTCG:status /nologo /nodefaultlib /out:wrnd.exe test.obj
"C:\openssl\lib\libeay32.lib" "C:\openssl\lib\ssleay32.lib" "c:\Program
Files\Microsoft Visual Studio .NET 2003\Vc7\lib\msvcrt.lib" "c:\Program
Files\Microsoft SDK\lib\kernel32.lib" "c:\Program Files\Microsoft Visual
Studio .NET 2003\Vc7\lib\OLDNAMES.lib"
--
alea+
Luc
#include <stdio.h>
#include <time.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/rand.h>
#ifdef WIN32
#include <windows.h>
#define my_sleep(n) Sleep(1000*(n))
#else
#define my_sleep(n) sleep(n)
#endif
int main(int argc)
{
register int i, j;
int retcode = 0;
time_t start, end;
char buffer [2000];
unsigned char data [512];
const char *file = NULL;
const char rng_seed [] = "string to make the random number " \
"generator think it has entropy ;)";
time(&start);
if (argc != 1) {
#ifdef WIN32
DebugBreak();
#else
while (argc != 1) {
sleep(1);
}
#endif
}
ERR_load_crypto_strings ();
SSL_load_error_strings ();
file = RAND_file_name (buffer, sizeof (buffer));
if (file != NULL) {
printf("Rand file = %s\n", file);
retcode = RAND_load_file (file, -1);
}
#ifdef WIN32
RAND_screen ();
#endif
if (file == NULL || !retcode) {
if (RAND_status () == 0) {
RAND_seed (rng_seed, sizeof (rng_seed) - 1);
}
}
printf("RAND_status = %d\n", RAND_status());
j=123;
for (i=0; i<41; i++) {
my_sleep(1+(data[j]%13));
if (!RAND_bytes(data, 512)) {
printf("Rand generation stopped at step %d\n", i);
ERR_print_errors_fp(stdout);
break;
}
j=data[j];
}
if (file != NULL) {
retcode = RAND_write_file (file);
}
RAND_cleanup ();
ERR_print_errors_fp(stdout);
EVP_cleanup ();
CRYPTO_cleanup_all_ex_data ();
ERR_remove_state (0);
ERR_free_strings ();
time(&end);
printf("time ellapsed: %d seconds\n", (int)(end-start));
return retcode;
}
begin:vcard
fn:Luc Perthuis
n:Perthuis;Luc
org:Atempo S.A.;Engineering
adr:;;PIBS;VANNES;;56000;FRANCE
email;internet:[EMAIL PROTECTED]
title:Core Technologies Group Manager
tel;work:02 97 68 40 26
tel;fax:02 97 68 40 25
tel;cell:06 89 16 96 37
note;quoted-printable:Enabling Information Lifecycle Strategies=0D=0A=
x-mozilla-html:TRUE
url:http://www.atempo.com
version:2.1
end:vcard