> From: Mladen Turk [mailto:[EMAIL PROTECTED] > Sent: 29 October 2001 19:46 > To: APR Dev List > Subject: [PATCH] apr_generate_random_bytes - WIN32 > > > Hi, > > The WIN-XP does not starts the cryptographic service provider (CSP) by > default (at least on my installation). > I think they move that out to boot faster. > Well, anyhow, the patch tries to create the new key container with the > default name if the CSP was not started allready. > > Interesting is that the call takes couple of seconds to finish when called > for the first time. > > MT. > > Index: rand.c > =================================================================== > RCS file: /home/cvspublic/apr/misc/win32/rand.c,v > retrieving revision 1.10 > diff -u -r1.10 rand.c > --- rand.c 2001/02/16 04:15:58 1.10 > +++ rand.c 2001/10/29 18:21:38 > @@ -63,7 +63,11 @@ > apr_status_t res = APR_SUCCESS; > > if (!CryptAcquireContext(&hProv,NULL,NULL,PROV_RSA_FULL,0)) { > - return apr_get_os_error(); > + /* Try to create the new key container */ > + if (CryptAcquireContext(&hProv,NULL,NULL,PROV_RSA_FULL, ^^^^ Seems you have reversed the logic here. Or was it wrong in the first place?
> + CRYPT_NEWKEYSET)) { > + return apr_get_os_error(); > + } > } > if (!CryptGenRandom(hProv,length,buf)) { > res = apr_get_os_error();