Re: [PATCH] Windows port add support to BCryptGenRandom

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Windows port add support to BCryptGenRandom
Date: 2019-12-17 03:43:42
Message-ID: 20191217034342.GE2344@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 16, 2019 at 09:18:10PM +0000, Ranier Vilela wrote:
> According to microsoft documentation at:
> https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
> The function CryptGenRandom is deprecated, and may can be removed in future release.
> This patch add support to use BCryptGenRandom.

+#if defined(_MSC_VER) && _MSC_VER >= 1900 \
+ && defined(MIN_WINNT) && MIN_WINNT >= 0x0600
+#define USE_WIN32_BCRYPTGENRANDOM
[...]
+ $postgres->AddLibrary('bcrypt.lib') if ($vsVersion > '12.00');

And looking at this page, it is said that the minimum version
supported by this function is Windows 2008:
https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom

Now, your changes in MkvcBuild.pm and the backend code assume that
we need to include bcrypt.lib since MSVC 2015 (at least version
14.00 or _MSC_VER >= 1900. Do you have a reference about when this
has been introduced in VS? The MS docs don't seem to hold a hint
about that..
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2019-12-17 03:57:56 RE: [PATCH] Windows port add support to BCryptGenRandom
Previous Message Ranier Vilela 2019-12-17 03:37:02 RE: [Proposal] Level4 Warnings show many shadow vars