summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/pgcrypto.c
diff options
context:
space:
mode:
authorMichael Paquier2019-01-01 11:05:51 +0000
committerMichael Paquier2019-01-01 11:05:51 +0000
commit1707a0d2aa6b2bcfe78f63836c769943a1a6b9e0 (patch)
tree2e4acf6889358493cfda78582d54b8b751c3fbe5 /contrib/pgcrypto/pgcrypto.c
parentd880b208e5fcf55e3ae396d5fc5fa6639f58205f (diff)
Remove configure switch --disable-strong-random
This removes a portion of infrastructure introduced by fe0a0b5 to allow compilation of Postgres in environments where no strong random source is available, meaning that there is no linking to OpenSSL and no /dev/urandom (Windows having its own CryptoAPI). No systems shipped this century lack /dev/urandom, and the buildfarm is actually not testing this switch at all, so just remove it. This simplifies particularly some backend code which included a fallback implementation using shared memory, and removes a set of alternate regression output files from pgcrypto. Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/20181230063219.GG608@paquier.xyz
Diffstat (limited to 'contrib/pgcrypto/pgcrypto.c')
-rw-r--r--contrib/pgcrypto/pgcrypto.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c
index de09ececcfd..c5587679098 100644
--- a/contrib/pgcrypto/pgcrypto.c
+++ b/contrib/pgcrypto/pgcrypto.c
@@ -34,7 +34,6 @@
#include <ctype.h>
#include "parser/scansup.h"
-#include "utils/backend_random.h"
#include "utils/builtins.h"
#include "utils/uuid.h"
@@ -423,7 +422,6 @@ PG_FUNCTION_INFO_V1(pg_random_bytes);
Datum
pg_random_bytes(PG_FUNCTION_ARGS)
{
-#ifdef HAVE_STRONG_RANDOM
int len = PG_GETARG_INT32(0);
bytea *res;
@@ -440,9 +438,6 @@ pg_random_bytes(PG_FUNCTION_ARGS)
px_THROW_ERROR(PXE_NO_RANDOM);
PG_RETURN_BYTEA_P(res);
-#else
- px_THROW_ERROR(PXE_NO_RANDOM);
-#endif
}
/* SQL function: gen_random_uuid() returns uuid */
@@ -451,11 +446,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. */
- if (!pg_backend_random((char *) buf, UUID_LEN))
+ if (!pg_strong_random(buf, UUID_LEN))
px_THROW_ERROR(PXE_NO_RANDOM);
/*
@@ -466,9 +460,6 @@ 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 *