On 11/30/2016 03:22 PM, Michael Paquier wrote:
On Wed, Nov 30, 2016 at 8:51 PM, Heikki Linnakangas <hlinn...@iki.fi> wrote:
On 11/30/2016 09:01 AM, Michael Paquier wrote:
Attached is a patch for MSVC to apply on top of yours to enable the
build for strong and weak random functions. Feel free to hack it as
needs be, this base implementation works for the current
implementation.

Great, thanks! I wonder if this is overly complicated, though. For
comparison, we haven't bothered to expose --disable-spinlocks in
config_default.pl either. Perhaps we should just always use the Windows
native function on MSVC, whether or not configured with OpenSSL, and just
put USE_WIN32_RANDOM in pg_config.h.win32? See 2nd attached patch
(untested).

I could live with that. Your patch is not complete though, you need to
add pg_strong_random.c into the array @pgportfiles in Mkvcbuild.pm.
You also need to remove fortuna.c and random.c from the list of files
in $pgcrypto->AddFiles(). After doing so the code is able to compile
properly.

Ok, did that, I hope I got it right.

+               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+                errmsg("pg_random_bytes() is not supported by this build"),
+                errdetail("This functionality requires a source of
strong random numbers"),
+                errhint("You need to rebuild PostgreSQL using
--enable-strong-random")));
Perhaps this should say "You need to rebuild PostgreSQL without
--disable-strong-random", the docs do not mention
--enable-strong-random nor does ./configure --help.

I could go either way, but I left it as it is, to avoid the double negative "without disable".

+/* port/pg_strong_random.c */
+#ifndef USE_WEAK_RANDOM
+extern bool pg_strong_random(void *buf, size_t len);
+#endif
This should be HAVE_STRONG_RANDOM.

Fixed.

Pushed with those fixes. Let's see what the buildfarm thinks now.

Tom: I expect pademelon to fail at the configure step, complaining that "no source of strong random numbers was found". Let's wait for one cycle, to verify that it does fail like that. After that, can you add the --disable-strong-random flag to fix it, please?

- Heikki



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to