mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Replace PostmasterRandom() with a stronger way of generating randomness.
This adds a new routine, pg_strong_random() for generating random bytes, for use in both frontend and backend. At the moment, it's only used in the backend, but the upcoming SCRAM authentication patches need strong random numbers in libpq as well. pg_strong_random() is based on, and replaces, the existing implementation in pgcrypto. It can acquire strong random numbers from a number of sources, depending on what's available: - OpenSSL RAND_bytes(), if built with OpenSSL - On Windows, the native cryptographic functions are used - /dev/urandom - /dev/random Original patch by Magnus Hagander, with further work by Michael Paquier and me. Discussion: <CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com>
This commit is contained in:
@@ -454,6 +454,9 @@ extern int pg_codepage_to_encoding(UINT cp);
|
||||
extern char *inet_net_ntop(int af, const void *src, int bits,
|
||||
char *dst, size_t size);
|
||||
|
||||
/* port/pg_strong_random.c */
|
||||
extern bool pg_strong_random(void *buf, size_t len);
|
||||
|
||||
/* port/pgcheckdir.c */
|
||||
extern int pg_check_dir(const char *dir);
|
||||
|
||||
|
Reference in New Issue
Block a user