mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Previously, gen_random_uuid() would fall back to a weak random number generator, unlike gen_random_bytes() which would just fail. And this was not made very clear in the docs. For consistency, also make gen_random_uuid() fail outright, if compiled with --disable-strong-random. Re-word the error message you get with --disable-strong-random. It is also used by pgp functions that require random salts, and now also gen_random_uuid(). Reported by Radek Slupik. Discussion: https://www.postgresql.org/message-id/20170101232054.10135.50528@wrigleys.postgresql.org
43 lines
1.6 KiB
Plaintext
43 lines
1.6 KiB
Plaintext
--
|
|
-- PGP compression support
|
|
--
|
|
select pgp_sym_decrypt(dearmor('
|
|
-----BEGIN PGP MESSAGE-----
|
|
|
|
ww0ECQMCsci6AdHnELlh0kQB4jFcVwHMJg0Bulop7m3Mi36s15TAhBo0AnzIrRFrdLVCkKohsS6+
|
|
DMcmR53SXfLoDJOv/M8uKj3QSq7oWNIp95pxfA==
|
|
=tbSn
|
|
-----END PGP MESSAGE-----
|
|
'), 'key', 'expect-compress-algo=1');
|
|
pgp_sym_decrypt
|
|
-----------------
|
|
Secret message
|
|
(1 row)
|
|
|
|
select pgp_sym_decrypt(
|
|
pgp_sym_encrypt('Secret message', 'key', 'compress-algo=0'),
|
|
'key', 'expect-compress-algo=0');
|
|
ERROR: generating random data is not supported by this build
|
|
DETAIL: This functionality requires a source of strong random numbers
|
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
|
select pgp_sym_decrypt(
|
|
pgp_sym_encrypt('Secret message', 'key', 'compress-algo=1'),
|
|
'key', 'expect-compress-algo=1');
|
|
ERROR: generating random data is not supported by this build
|
|
DETAIL: This functionality requires a source of strong random numbers
|
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
|
select pgp_sym_decrypt(
|
|
pgp_sym_encrypt('Secret message', 'key', 'compress-algo=2'),
|
|
'key', 'expect-compress-algo=2');
|
|
ERROR: generating random data is not supported by this build
|
|
DETAIL: This functionality requires a source of strong random numbers
|
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
|
-- level=0 should turn compression off
|
|
select pgp_sym_decrypt(
|
|
pgp_sym_encrypt('Secret message', 'key',
|
|
'compress-algo=2, compress-level=0'),
|
|
'key', 'expect-compress-algo=0');
|
|
ERROR: generating random data is not supported by this build
|
|
DETAIL: This functionality requires a source of strong random numbers
|
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|