Commit dec2c77c authored by Neil Conway's avatar Neil Conway

Prevent pgcrypto from successfully compiling if no valid random source

has been defined. Previously, pgcrypto would compile but would be
unusable.
parent 2663e0c2
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * 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 @@ ...@@ -35,7 +35,7 @@
#include "px.h" #include "px.h"
#ifdef RAND_DEV #if defined(RAND_DEV)
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -77,9 +77,8 @@ px_get_random_bytes(uint8 *dst, unsigned count) ...@@ -77,9 +77,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
close(fd); close(fd);
return res; return res;
} }
#endif /* RAND_DEV */
#ifdef RAND_SILLY #elif defined(RAND_SILLY)
int int
px_get_random_bytes(uint8 *dst, unsigned count) px_get_random_bytes(uint8 *dst, unsigned count)
...@@ -90,9 +89,8 @@ px_get_random_bytes(uint8 *dst, unsigned count) ...@@ -90,9 +89,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
*dst++ = random(); *dst++ = random();
return i; return i;
} }
#endif /* RAND_SILLY */
#ifdef RAND_OPENSSL #elif defined(RAND_OPENSSL)
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/blowfish.h> #include <openssl/blowfish.h>
...@@ -125,4 +123,6 @@ px_get_random_bytes(uint8 *dst, unsigned count) ...@@ -125,4 +123,6 @@ px_get_random_bytes(uint8 *dst, unsigned count)
return -1; return -1;
} }
#endif /* RAND_OPENSSL */ #else
#error "Invalid random source"
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment