/ Check-in [139081be]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On windows systems when rand_s() is available, use it to obtain additional seed material in winRandomness().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 139081bef9f63c3ebbe9e992408597b1349bdf37
User & Date: drh 2016-02-15 21:31:51
References
2017-09-12
23:58
Remove use of the rand_s() function (added by [139081bef9f63c3e]) as it appears to cause issues with some third-party DLLs. check-in: 3a2793aa user: mistachkin tags: trunk
Context
2016-02-15
22:01
Revise compiler checks for the rand_s() function. check-in: 287f508d user: mistachkin tags: trunk
21:31
On windows systems when rand_s() is available, use it to obtain additional seed material in winRandomness(). check-in: 139081be user: drh tags: trunk
20:41
Improved entropy gathering for the implementation of winRandomness(). check-in: fea3705e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/msvc.h.

    12     12   **
    13     13   ** This file contains code that is specific to MSVC.
    14     14   */
    15     15   #ifndef _MSVC_H_
    16     16   #define _MSVC_H_
    17     17   
    18     18   #if defined(_MSC_VER)
           19  +#define _CRT_RAND_S  /* Make rand_s() available on windows systems */
    19     20   #pragma warning(disable : 4054)
    20     21   #pragma warning(disable : 4055)
    21     22   #pragma warning(disable : 4100)
    22     23   #pragma warning(disable : 4127)
    23     24   #pragma warning(disable : 4130)
    24     25   #pragma warning(disable : 4152)
    25     26   #pragma warning(disable : 4189)

Changes to src/os_win.c.

  5420   5420     UNUSED_PARAMETER(pVfs);
  5421   5421     memset(zBuf, 0, nBuf);
  5422   5422     return nBuf;
  5423   5423   #else
  5424   5424     EntropyGatherer e;
  5425   5425     UNUSED_PARAMETER(pVfs);
  5426   5426     memset(zBuf, 0, nBuf);
         5427  +#ifdef _MSC_VER
         5428  +  rand_s((int*)zBuf);  /* rand_s() is not available with MinGW */
         5429  +#endif
  5427   5430     e.a = (unsigned char*)zBuf;
  5428   5431     e.na = nBuf;
  5429   5432     e.nXor = 0;
  5430   5433     e.i = 0;
  5431   5434     {
  5432   5435       SYSTEMTIME x;
  5433   5436       osGetSystemTime(&x);