Skip to content

Commit dec2c77

Browse files
author
Neil Conway
committed
Prevent pgcrypto from successfully compiling if no valid random source
has been defined. Previously, pgcrypto would compile but would be unusable.
1 parent 2663e0c commit dec2c77

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

contrib/pgcrypto/random.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.7 2003/11/29 22:39:28 pgsql Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.8 2004/11/23 23:44:08 neilc Exp $
3030
*/
3131

3232

@@ -35,7 +35,7 @@
3535
#include "px.h"
3636

3737

38-
#ifdef RAND_DEV
38+
#if defined(RAND_DEV)
3939

4040
#include <errno.h>
4141
#include <fcntl.h>
@@ -77,9 +77,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
7777
close(fd);
7878
return res;
7979
}
80-
#endif /* RAND_DEV */
8180

82-
#ifdef RAND_SILLY
81+
#elif defined(RAND_SILLY)
8382

8483
int
8584
px_get_random_bytes(uint8 *dst, unsigned count)
@@ -90,9 +89,8 @@ px_get_random_bytes(uint8 *dst, unsigned count)
9089
*dst++ = random();
9190
return i;
9291
}
93-
#endif /* RAND_SILLY */
9492

95-
#ifdef RAND_OPENSSL
93+
#elif defined(RAND_OPENSSL)
9694

9795
#include <openssl/evp.h>
9896
#include <openssl/blowfish.h>
@@ -125,4 +123,6 @@ px_get_random_bytes(uint8 *dst, unsigned count)
125123
return -1;
126124
}
127125

128-
#endif /* RAND_OPENSSL */
126+
#else
127+
#error "Invalid random source"
128+
#endif

0 commit comments

Comments
 (0)