aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-11-23 23:44:08 +0000
committerNeil Conway <neilc@samurai.com>2004-11-23 23:44:08 +0000
commitdec2c77c1f6321200b65ebcda8aa0d9894c21190 (patch)
treef445064d7dd6bc632c534c04a3420d5c4f45862e
parent2663e0c2e98dce7fa4c95ea1ef780f72087dd83f (diff)
downloadpostgresql-dec2c77c1f6321200b65ebcda8aa0d9894c21190.tar.gz
postgresql-dec2c77c1f6321200b65ebcda8aa0d9894c21190.zip
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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/pgcrypto/random.c b/contrib/pgcrypto/random.c
index ce339a154a8..17c929c75bb 100644
--- a/contrib/pgcrypto/random.c
+++ b/contrib/pgcrypto/random.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.7 2003/11/29 22:39:28 pgsql Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.8 2004/11/23 23:44:08 neilc Exp $
*/
@@ -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