summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/pgcrypto.c
diff options
context:
space:
mode:
authorPavan Deolasee2017-07-13 09:22:22 +0000
committerPavan Deolasee2017-07-13 09:22:22 +0000
commit03162cb93078de77532bf08498d96345fe14ea68 (patch)
treee165038efc76fc408b6541edc3eccb121cce1eb5 /contrib/pgcrypto/pgcrypto.c
parente26a0e07d863777079bfe9fc335ca2b71377b731 (diff)
parentbc2d716ad09fceeb391c755f78c256ddac9d3b9f (diff)
Merge remote-tracking branch 'remotes/PGSQL/master' of PG 10
This merge includes all commits upto bc2d716ad09fceeb391c755f78c256ddac9d3b9f of PG 10.
Diffstat (limited to 'contrib/pgcrypto/pgcrypto.c')
-rw-r--r--contrib/pgcrypto/pgcrypto.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c
index 4e3516a86a..e09f3378da 100644
--- a/contrib/pgcrypto/pgcrypto.c
+++ b/contrib/pgcrypto/pgcrypto.c
@@ -451,13 +451,10 @@ PG_FUNCTION_INFO_V1(pg_random_uuid);
Datum
pg_random_uuid(PG_FUNCTION_ARGS)
{
+#ifdef HAVE_STRONG_RANDOM
uint8 *buf = (uint8 *) palloc(UUID_LEN);
- /*
- * Generate random bits. pg_backend_random() will do here, we don't promis
- * UUIDs to be cryptographically random, when built with
- * --disable-strong-random.
- */
+ /* Generate random bits. */
if (!pg_backend_random((char *) buf, UUID_LEN))
px_THROW_ERROR(PXE_NO_RANDOM);
@@ -469,6 +466,9 @@ pg_random_uuid(PG_FUNCTION_ARGS)
buf[8] = (buf[8] & 0x3f) | 0x80; /* "variant" field */
PG_RETURN_UUID_P((pg_uuid_t *) buf);
+#else
+ px_THROW_ERROR(PXE_NO_RANDOM);
+#endif
}
static void *