On Tue, Jul 9, 2013 at 8:11 PM, You Tube Videos <utubea...@gmail.com> wrote: > Hi, > > Not sure whether this query belongs in users or the dev group, so sending to > both. > > We have a windows client application where we use Open SSL (1.0.1e) for some > encryption as well as for SSL support. This application will run on Windows > XP and above. > > There is a key requirement that this application should launch in 2 seconds. > We have been able to bring to little over 3 seconds and based on profiling > results we have no other hot spot over 300ms except for RAND_poll in Open > SSL which takes about 1 second. > > I have gone through the history of how this function is used for generating > the seed value of sufficient entropy by taking bytes of data from various > sources like heap lists, thread, process and others. I have also gone though > the history of performance issues due to heap walking under windows and how > they are addressed by putting a timeout on the loops for each of the loops > collecting the bytes in this function. > > The MAXDELAY macro which defines this timeout is currently set to 1 second. > I tried changing this value to 200ms and everything still works fine. I have > also run the Open SSL unit tests to verify functionality. > > The hot spot has reduced to 175~180ms after this. The key question for us is > whether this is an acceptable change for our usage. What is the impact on > security or functionality that we are not aware of? If I got it right, its > the heap walking loop that takes the max time, but there are other sources > where its collecting the data for the seed. > You may consider attached patch if your application used on Windows XP/Windows Server 2003 or later. It makes OpenSSL rely on Windows CryptGenRandom and use other methods only if CryptGenRandom failed for some reason. I think it's pretty safe rely on CryptGenRandom because it used for all operating system purposes. And starting from Windows XP standard PRNG algorithms used.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa379942 -- Ivan Zhakov
openssl-trust-capi-random.patch
Description: Binary data