summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway2004-11-23 23:44:08 +0000
committerNeil Conway2004-11-23 23:44:08 +0000
commit2c2a8175e38f056e489f3a728fff305858e88147 (patch)
treea76b9c9ba9cdb4b38dbf8b226b16f8a78b9665ad
parent70d65d10463c5079cc86a83369e07db097c51769 (diff)
Prevent pgcrypto from successfully compiling if no valid random source
has been defined. Previously, pgcrypto would compile but would be unusable.
-rw-r--r--contrib/pgcrypto/random.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/pgcrypto/random.c b/contrib/pgcrypto/random.c
index f528434bd7..7a43ca5b9f 100644
--- a/contrib/pgcrypto/random.c
+++ b/contrib/pgcrypto/random.c
@@ -35,7 +35,7 @@
#include "px.h"
-#ifdef RAND_DEV
+#if defined(RAND_DEV)
#include <errno.h>
#include <fcntl.h>
@@ -77,9 +77,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
close(fd);
return res;
}
-#endif /* RAND_DEV */
-#ifdef RAND_SILLY
+#elif defined(RAND_SILLY)
int
px_get_random_bytes(uint8 *dst, unsigned count)
@@ -90,9 +89,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
*dst++ = random();
return i;
}
-#endif /* RAND_SILLY */
-#ifdef RAND_OPENSSL
+#elif defined(RAND_OPENSSL)
#include <openssl/evp.h>
#include <openssl/blowfish.h>
@@ -125,4 +123,6 @@ px_get_random_bytes(uint8 *dst, unsigned count)
return -1;
}
-#endif /* RAND_OPENSSL */
+#else
+#error "Invalid random source"
+#endif