Hi all,

 

I’m using OpenSSL as a module in PHP (php_openssl), and I need to call the CGI page may times per second

 but the initialization process in RAND_poll is too slow.

 

I’m thinking to modify OpenSSL to use the rtlGenRandom call available in XP/2003 Server/Vista OSs

(see http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx for comments on rtlGenRandom )

 

the new function likes:

 

 

int RAND_poll()

{

if_any_error_in_block_return_old_RAND_poll()

{

 

HMODULE hlib;

BOOLEAN (APIENTRY *rtlgenrandom)(void*, ULONG);

char buffer[1024];

int c;

 

hlib=(HMODULE)LoadLibrary("ADVAPI32.DLL");

tlgenrandom=(BOOLEAN (APIENTRY *)(void*,ULONG))GetProcAddress(hlib,"SystemFunction036");

for(c=0;c<1+(ENTROPY_NEEDED/sizeof(buffer));++c)

{

            rtlgenrandom(buffer,sizeof(buffer)):

            RAND_add(buffer,sizeof(buffer),sizeof(buffer));

}

 

            }

}

 

a bad idea? Any thing bad here?

 

Thanks in advance,

 

Adrià

 

 

Reply via email to