Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.158' '-r1.159' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2008/03/07 13:52:41 1.158 +++ ChangeLog 2008/06/04 17:27:27 1.159 @@ -13,6 +13,9 @@ Changes between 1.6.1 and 1.6.2 (21-Feb-2008 to 06-Mar-2008) + o Improve PRNG under Win32. + [Hiroshi Saito] + o Consistently annotate "RFC-XXXX" with "IETF" to clearly indicate from which standards body this comes from. [Ralf S. Engelschall] Index: ossp-pkg/uuid/uuid_prng.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_prng.c,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_prng.c,v' 2>/dev/null --- uuid_prng.c 2008/03/06 12:14:49 1.19 +++ uuid_prng.c 2008/06/04 17:27:27 1.20 @@ -37,6 +37,11 @@ #include #include #include +#if defined(WIN32) +#define WINVER 0x0500 +#include +#include +#endif /* own headers (part 2/2) */ #include "uuid_time.h" @@ -114,6 +119,9 @@ size_t md5_len; int retries; int i; +#if defined(WIN32) + HCRYPTPROV hProv; +#endif /* sanity check argument(s) */ if (prng == NULL || data_len == 0) @@ -138,6 +146,12 @@ p += (unsigned int)i; } } +#if defined(WIN32) + else { + if (CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)) + CryptGenRandom(hProv, n, p); + } +#endif /* approach 2: try to gather data via weaker libc PRNG API. */ while (n > 0) {